aboutsummaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-04-02 17:12:23 -0700
committerGerald Combs <gerald@wireshark.org>2018-04-26 19:27:19 +0000
commit0ad423924992f8504b3e75980e1e9efb65d84214 (patch)
tree5b9039f1ba272037c10528860b28a99272908620 /CMakeLists.txt
parentf9522d8a23a375ddc8bd39cf556002cdec346ab1 (diff)
Start porting our test scripts to Python. Add ctest support.
Create Python versions of our various test shell scripts. Add CMake tests for each suite. Tests can now be run directly via test.py, via the "test" target, or via ctest, e.g. ctest --verbose --jobs 3 Add a testing chapter to the Developer's Guide. Add a way to disable ctest in dpkg-buildpackage. Suites completed: - capture - clopts - decryption - dissection Remaining suites: - fileformats - io - mergecap - nameres - text2pcap - unittests - wslua Change-Id: I8936e05edefc76a86b6a7a5da302e7461bbdda0f Reviewed-on: https://code.wireshark.org/review/27134 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt34
1 files changed, 33 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f57c882c7..1da14aae24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3134,7 +3134,7 @@ if (DOXYGEN_EXECUTABLE)
)
endif(DOXYGEN_EXECUTABLE)
-# Test suite wrapper
+# Old test suite wrapper
if(ENABLE_APPLICATION_BUNDLE)
set(TEST_SH_BIN_DIR ${CMAKE_BINARY_DIR}/run)
else()
@@ -3168,6 +3168,38 @@ set_target_properties(test-programs PROPERTIES
EXCLUDE_FROM_DEFAULT_BUILD True
)
+# Test suites
+enable_testing()
+file(GLOB _test_suite_py_list test/suite_*.py)
+if(WIN32)
+ set(_test_suite_program_path ./run/$<CONFIG>)
+else()
+ set(_test_suite_program_path ./run)
+endif()
+
+# We currently don't handle spaces in arguments. On Windows this
+# means that you will probably have to pass in an interface index
+# instead of a name.
+set(TEST_EXTRA_ARGS "" CACHE STRING "Extra arguments to pass to test/test.py")
+separate_arguments(TEST_EXTRA_ARGS)
+
+# We can enumerate suites two ways: by probing the filesystem and by
+# running `test.py --list-suites`. Probe the filesystem for now, which
+# should hopefully give us enough parallelization. If we want to split
+# our tests by cases or individual tests we'll have to run and parse
+# `test.py --list-cases` or `test.py --list` respectively.
+foreach(_suite_py ${_test_suite_py_list})
+ get_filename_component(_suite_name ${_suite_py} NAME_WE)
+ add_test(
+ NAME ${_suite_name}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test/test.py
+ --program-path ${_test_suite_program_path}
+ ${TEST_EXTRA_ARGS}
+ ${_suite_name}
+ )
+ set_tests_properties(${_suite_name} PROPERTIES TIMEOUT 600)
+endforeach()
+
if (GIT_EXECUTABLE)
# Update AUTHORS file with entries from git shortlog
add_custom_target(