summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lepasteur <simon.lepasteur@swissdotnet.ch>2020-03-11 15:13:29 +0100
committerAlan Antonuk <alan.antonuk@gmail.com>2020-03-12 00:20:38 -0700
commit26ecf6d3012be81f5dfb8a2d822c722e916a86cb (patch)
treecf9caf54a7c53f23539549b4b2f9ed3db00099c6
parentfffeb013df0d7eac7dd22eef5f6d55fe1f43335c (diff)
downloadrabbitmq-c-26ecf6d3012be81f5dfb8a2d822c722e916a86cb.tar.gz
Add option to run system tests (disabled by default).
System tests require a RabbitMQ or other AMQP server to be running on `localhost` at TCP port number 5672 and therefore fails if no such server is running on the build machine. This is surprising for everyone running the standard `make test` to ensure the library is built correctly.
-rw-r--r--.travis.yml2
-rw-r--r--CMakeLists.txt1
-rw-r--r--README.md2
-rw-r--r--appveyor.yml2
-rw-r--r--tests/CMakeLists.txt8
5 files changed, 10 insertions, 5 deletions
diff --git a/.travis.yml b/.travis.yml
index 52a66b9..5f56cb0 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,7 +19,7 @@ addons:
name: "alanxz/rabbitmq-c"
description: "C AMQP client for RabbitMQ"
notification_email: alan.antonuk@gmail.com
- build_command_prepend: mkdir build && pushd build && cmake .. && popd
+ build_command_prepend: mkdir build && pushd build && cmake .. -DRUN_SYSTEM_TESTS=ON && popd
build_command: cmake --build ./build
branch_pattern: coverity_scan
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f620ddc..a39645f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -266,6 +266,7 @@ option(BUILD_TOOLS "Build Tools (requires POPT Library)" ${POPT_FOUND})
option(BUILD_TOOLS_DOCS "Build man pages for Tools (requires xmlto)" ${DO_DOCS})
option(BUILD_TESTS "Build tests (run tests with make test)" ON)
option(BUILD_API_DOCS "Build Doxygen API docs" ${DOXYGEN_FOUND})
+option(RUN_SYSTEM_TESTS "Run system tests (i.e. tests requiring an accessible RabbitMQ server instance on localhost)" OFF)
if (NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS)
message(FATAL_ERROR "One or both of BUILD_SHARED_LIBS or BUILD_STATIC_LIBS must be set to ON to build")
diff --git a/README.md b/README.md
index b7776c6..31347b1 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,8 @@ Other interesting flags that can be passed to CMake:
default this is ON if the OpenSSL headers and library can be found.
* `BUILD_API_DOCS=ON/OFF` - toggles building the Doxygen API documentation, by
default this is OFF
+* `RUN_SYSTEM_TESTS=ON/OFF` toggles building the system tests (i.e. tests requiring
+ an accessible RabbitMQ server instance on localhost), by default this is OFF
## Running the examples
diff --git a/appveyor.yml b/appveyor.yml
index 7e41c09..af31522 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -30,7 +30,7 @@ install:
- "Win%BITS%OpenSSL-%OPENSSL_VER%.exe /SP- /SILENT /SUPPRESSMSGBOXES /NORESTART"
before_build:
- - cmake -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_TESTS=ON -DENABLE_SSL_SUPPORT=True -G"%GENERATOR%" .
+ - cmake -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_TESTS=ON -DRUN_SYSTEM_TESTS=ON -DENABLE_SSL_SUPPORT=True -G"%GENERATOR%" .
build:
project: ALL_BUILD.vcxproj
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index cf042b0..320a73d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -33,9 +33,11 @@ add_executable(test_basic
test_basic.c)
target_link_libraries(test_basic rabbitmq-static)
-if (NOT APPLE)
- add_test(basic test_basic)
-endif()
+if (RUN_SYSTEM_TESTS)
+ if (NOT APPLE)
+ add_test(basic test_basic)
+ endif()
+endif(RUN_SYSTEM_TESTS)
add_executable(test_sasl_mechanism test_sasl_mechanism.c)
target_link_libraries(test_sasl_mechanism rabbitmq-static)