diff options
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/test_tables.c | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 168416c..194c25a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ option(BUILD_SHARED_LIBS "Build rabbitmq-c as a shared library" ON) option(BUILD_EXAMPLES "Build Examples" ON) 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) if (WIN32 AND NOT BUILD_SHARED_LIBS) message(FATAL_ERROR "The rabbitmq-c library cannot be built as a static library on Win32. Set BUILD_SHARED_LIBS=ON to get around this.") @@ -83,6 +84,11 @@ if (BUILD_TOOLS) endif () endif () +if (BUILD_TESTS) + enable_testing() + add_subdirectory(tests) +endif (BUILD_TESTS) + set(prefix ${CMAKE_INSTALL_PREFIX}) set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin) set(libdir ${CMAKE_INSTALL_PREFIX}/lib) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..93ccb9a --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,10 @@ +include_directories(${LIBRABBITMQ_INCLUDE_DIRS}) + +add_executable(test_parse_url test_parse_url.c) +target_link_libraries(test_parse_url rabbitmq) +add_test(parse_url test_parse_url) + +add_executable(test_tables test_tables.c) +target_link_libraries(test_tables rabbitmq) +add_test(tables test_tables) +configure_file(test_tables.expected ${CMAKE_CURRENT_BINARY_DIR}/tests/test_tables.expected COPY_ONLY) diff --git a/tests/test_tables.c b/tests/test_tables.c index e4b0f43..659db53 100644 --- a/tests/test_tables.c +++ b/tests/test_tables.c @@ -446,7 +446,7 @@ int main(void) test_dump_value(out); if (srcdir == NULL) - srcdir = "tests"; + srcdir = "."; expected_path = malloc(strlen(srcdir) + strlen(expected_file_name) + 2); sprintf(expected_path, "%s/%s", srcdir, expected_file_name); |