From 2f1614efa929c57971fb4ad7d043c53fb6fdea33 Mon Sep 17 00:00:00 2001 From: Robert Adam Date: Fri, 11 Sep 2020 15:29:13 +0200 Subject: BUILD(cmake): Make online tests optional The TestServerResolver test requires an active internet connection. This is something that is not really expected when running the tests and will cause test failure if used without an internet connection. Therefore this commit makes this test optional. By default this test will not be built. If you want to enable it (and potential future tests that require an internet connection), you have to use -Donline-tests=ON when invoking cmake. --- src/tests/CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/tests') diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 685ccb449..ea81de7a8 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -5,6 +5,8 @@ find_pkg(Qt5 COMPONENTS Test REQUIRED) +option(online-tests "Whether or not tests that need a working internet connection should be included" OFF) + set(TESTS "") macro(use_test TEST_NAME) @@ -28,12 +30,18 @@ use_test("TestPacketDataStream") use_test("TestPasswordGenerator") use_test("TestSelfSignedCertificate") use_test("TestServerAddress") -use_test("TestServerResolver") use_test("TestSSLLocks") use_test("TestStdAbs") use_test("TestTimer") use_test("TestUnresolvedServerAddress") +if(online-tests) + message(STATUS "Including online tests - These will fail if you don't have a working internet connection when running them") + use_test("TestServerResolver") +else() + message(STATUS "Omitting online tests - Testing can be performed without an active internet connection") +endif() + # Set output directory foreach(CURRENT_TEST IN LISTS TESTS) -- cgit v1.2.3