From 8fe500d06bc32bfb83d822ade14831b434b3b184 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Mar 2021 01:46:02 +0100 Subject: tests/test-indicator-ng.c: Enable all tests --- tests/test-indicator-ng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test-indicator-ng.c b/tests/test-indicator-ng.c index 416c8da..774b000 100644 --- a/tests/test-indicator-ng.c +++ b/tests/test-indicator-ng.c @@ -105,7 +105,7 @@ test_instantiation_with_profile (void) * widgets to accommodate an icon. * */ -/*static const gchar * +static const gchar * get_label (GtkMenuItem *item) { GList *children = gtk_container_get_children (GTK_CONTAINER (item)); @@ -122,9 +122,9 @@ get_label (GtkMenuItem *item) } return label; -}*/ +} -/*static void +static void test_menu (void) { IndicatorNg *indicator; @@ -169,7 +169,7 @@ test_menu (void) g_list_free (entries); g_main_loop_unref (loop); g_object_unref (indicator); -}*/ +} int main (int argc, char **argv) @@ -187,7 +187,7 @@ main (int argc, char **argv) indicator_ng_test_add ("non-existing", test_non_existing); indicator_ng_test_add ("instantiation", test_instantiation); indicator_ng_test_add ("instantiation-with-profile", test_instantiation_with_profile); - //indicator_ng_test_add ("menu", test_menu); + indicator_ng_test_add ("menu", test_menu); return g_test_run (); } -- cgit v1.2.3 From 94ee3f92f2cf248a14009958324ab960d2ea675f Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Mar 2021 01:47:20 +0100 Subject: tests/session.conf.in: Fix placeholder --- tests/session.conf.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/session.conf.in b/tests/session.conf.in index 5c0cf36..40eae6e 100644 --- a/tests/session.conf.in +++ b/tests/session.conf.in @@ -9,7 +9,7 @@ unix:tmpdir=/tmp - @servicedir@ + @CMAKE_CURRENT_BINARY_DIR@ @@ -28,9 +28,9 @@ 1000000000 1000000000 1000000000 - 120000 + 120000 240000 - 100000 + 100000 10000 100000 10000 -- cgit v1.2.3 From b9842a31514a21d499ef0ac9ebc435d63858a611 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Mar 2021 01:48:19 +0100 Subject: tests/service-version-bad.service.in: Fix placeholder --- tests/service-version-bad.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service-version-bad.service.in b/tests/service-version-bad.service.in index 1e763eb..7366874 100644 --- a/tests/service-version-bad.service.in +++ b/tests/service-version-bad.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.ayatana.version.bad -Exec=@builddir@/service-version-bad-service +Exec=@CMAKE_CURRENT_BINARY_DIR@/service-version-bad-service -- cgit v1.2.3 From 4a5c70764a08eb5639dd7b4879eae1c17c5e7e06 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Mar 2021 01:49:05 +0100 Subject: tests/service-version-good.service.in: Fix placeholder --- tests/service-version-good.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service-version-good.service.in b/tests/service-version-good.service.in index c57a04f..ec9a4a4 100644 --- a/tests/service-version-good.service.in +++ b/tests/service-version-good.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.ayatana.version.good -Exec=@builddir@/service-version-good-service +Exec=@CMAKE_CURRENT_BINARY_DIR@/service-version-good-service -- cgit v1.2.3 From e37c1b8eaaa351ff5c835dfc102cd2be2971d033 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Mar 2021 01:49:50 +0100 Subject: tests/service-manager-connect.service.in: Fix placeholder --- tests/service-manager-connect.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/service-manager-connect.service.in b/tests/service-manager-connect.service.in index 7d3da6b..6ceeb6f 100644 --- a/tests/service-manager-connect.service.in +++ b/tests/service-manager-connect.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.ayatana.test -Exec=@builddir@/service-manager-connect-service +Exec=@CMAKE_CURRENT_BINARY_DIR@/service-manager-connect-service -- cgit v1.2.3 From 629f2a7e0b39b4395073779b6f26876101125060 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Tue, 16 Mar 2021 01:50:38 +0100 Subject: tests/org.ayatana.indicator.test.service.in: Fix placeholder --- tests/org.ayatana.indicator.test.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/org.ayatana.indicator.test.service.in b/tests/org.ayatana.indicator.test.service.in index bf8ec46..2e663dd 100644 --- a/tests/org.ayatana.indicator.test.service.in +++ b/tests/org.ayatana.indicator.test.service.in @@ -1,3 +1,3 @@ [D-BUS Service] Name=org.ayatana.indicator.test -Exec=@builddir@/indicator-test-service +Exec=@CMAKE_CURRENT_BINARY_DIR@/indicator-test-service -- cgit v1.2.3 From 9c35f2f49d11f5836b348874a655d51b7322e0f8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 16 May 2021 22:28:57 +0200 Subject: Revert "tests/run-xvfb.sh: Drop file, not required with CMake." This reverts commit c7a152ad3da254704945de297f0de957966fb6b8. --- tests/run-xvfb.sh | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/run-xvfb.sh diff --git a/tests/run-xvfb.sh b/tests/run-xvfb.sh new file mode 100644 index 0000000..63b6f0d --- /dev/null +++ b/tests/run-xvfb.sh @@ -0,0 +1,8 @@ +if [ "$DISPLAY" == "" ]; then +Xvfb -ac -noreset -screen 0 800x600x16 -help 2>/dev/null 1>&2 +XID=`for id in 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 ; do test -e /tmp/.X$id-lock || { echo $id; exit 0; }; done; exit 1` +{ Xvfb -ac -noreset -screen 0 800x600x16 :$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null >/dev/null 2>&1 & trap "kill -15 $! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } +DISPLAY=:$XID +export DISPLAY +echo Setting display: $DISPLAY +fi -- cgit v1.2.3 From 49d522e6bc2a513887277371e90838b742528b42 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 16 May 2021 22:50:26 +0200 Subject: tests/CMakeLists.txt: Rewrite to fix tests and coverage --- tests/CMakeLists.txt | 323 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 267 insertions(+), 56 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4c24321..98684fa 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,71 +6,282 @@ else() set (ayatana_indicator_gtkver "ayatana-indicator") endif() -function(add_test_helper_by_name name) - set (TEST_HELPER_NAME ${name}) - set_source_files_properties(${TEST_HELPER_NAME}.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) - add_library("${TEST_HELPER_NAME}" SHARED ${TEST_HELPER_NAME}.c) - target_include_directories("${TEST_HELPER_NAME}" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) - target_include_directories("${TEST_HELPER_NAME}" PUBLIC "${CMAKE_SOURCE_DIR}/src") - target_link_libraries("${TEST_HELPER_NAME}" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) - target_link_directories("${TEST_HELPER_NAME}" PUBLIC "${CMAKE_BINARY_DIR}/src") - add_dependencies("${TEST_HELPER_NAME}" "${ayatana_indicator_gtkver}") +find_program(DBUS_TEST_RUNNER dbus-test-runner) + +function(add_test_library_by_name name) + set (TEST_LIBRARY_NAME ${name}) + set_source_files_properties(${TEST_LIBRARY_NAME}.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) + add_library("${TEST_LIBRARY_NAME}" SHARED ${TEST_LIBRARY_NAME}.c) + target_include_directories("${TEST_LIBRARY_NAME}" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) + target_include_directories("${TEST_LIBRARY_NAME}" PUBLIC "${CMAKE_SOURCE_DIR}/src") + target_link_libraries("${TEST_LIBRARY_NAME}" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) + target_link_directories("${TEST_LIBRARY_NAME}" PUBLIC "${CMAKE_BINARY_DIR}/src") + add_dependencies("${TEST_LIBRARY_NAME}" "${ayatana_indicator_gtkver}") +endfunction() + +function(add_test_executable_by_name name) + set (TEST_EXECUTABLE_NAME ${name}) + set_source_files_properties(${TEST_EXECUTABLE_NAME}.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) + add_executable("${TEST_EXECUTABLE_NAME}" ${TEST_EXECUTABLE_NAME}.c) + target_compile_definitions("${TEST_EXECUTABLE_NAME}" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") + target_compile_definitions("${TEST_EXECUTABLE_NAME}" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") + target_include_directories("${TEST_EXECUTABLE_NAME}" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) + target_include_directories("${TEST_EXECUTABLE_NAME}" PUBLIC "${CMAKE_SOURCE_DIR}/src") + target_link_libraries("${TEST_EXECUTABLE_NAME}" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) + target_link_directories("${TEST_EXECUTABLE_NAME}" PUBLIC "${CMAKE_BINARY_DIR}/src") + add_dependencies("${TEST_EXECUTABLE_NAME}" "${ayatana_indicator_gtkver}") endfunction() -add_test_helper_by_name(dummy-indicator-blank) -add_test_helper_by_name(dummy-indicator-entry-func) -add_test_helper_by_name(dummy-indicator-null) -add_test_helper_by_name(dummy-indicator-signaler) -add_test_helper_by_name(dummy-indicator-simple) -add_test_helper_by_name(dummy-indicator-visible) -add_test_helper_by_name(service-manager-connect) -add_test_helper_by_name(service-manager-connect-service) -add_test_helper_by_name(service-manager-no-connect) -add_test_helper_by_name(service-manager-nostart-connect) -add_test_helper_by_name(service-shutdown-timeout) -add_test_helper_by_name(service-version-bad-service) -add_test_helper_by_name(service-version-good-service) -add_test_helper_by_name(service-version-manager) -add_test_helper_by_name(service-version-multiwatch-manager) -add_test_helper_by_name(service-version-multiwatch-manager-impolite) -add_test_helper_by_name(service-version-multiwatch-service) +add_test_library_by_name(dummy-indicator-blank) +add_test_library_by_name(dummy-indicator-entry-func) +add_test_library_by_name(dummy-indicator-null) +add_test_library_by_name(dummy-indicator-signaler) +add_test_library_by_name(dummy-indicator-simple) +add_test_library_by_name(dummy-indicator-visible) + +# session.conf +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/session.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/session.conf" @ONLY) + +# service-manager-connect.service +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/service-manager-connect.service.in" "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect.service" @ONLY) + +# service-manager-connect +add_test_executable_by_name(service-manager-connect) + +# service-manager-connect-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-tester" + DEPENDS "service-manager-connect" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-tester" + COMMAND + echo "${DBUS_TEST_RUNNER} --dbus-config ${CMAKE_CURRENT_BINARY_DIR}/session.conf --task ${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect" >> "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-tester" +) +add_test("service-manager-connect-tester" "service-manager-connect-tester") + +# service-manager-connect-service +add_test_executable_by_name(service-manager-connect-service) + +# service-manager-no-connect +add_test_executable_by_name(service-manager-no-connect) + +# service-manager-no-connect-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/service-manager-no-connect-tester" + DEPENDS "service-manager-no-connect" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/service-manager-no-connect-tester" + COMMAND + echo "${DBUS_TEST_RUNNER} --dbus-config /usr/share/dbus-test-runner/session.conf --task ${CMAKE_CURRENT_BINARY_DIR}/service-manager-no-connect" >> "${CMAKE_CURRENT_BINARY_DIR}/service-manager-no-connect-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/service-manager-no-connect-tester" +) +add_test("service-manager-no-connect-tester" "service-manager-no-connect-tester") + +# service-manager-nostart-connect +add_test_executable_by_name(service-manager-nostart-connect) + +# service-manager-connect-nostart-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-nostart-tester" + DEPENDS "service-manager-connect-service" + DEPENDS "service-manager-nostart-connect" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-nostart-tester" + COMMAND + echo "${DBUS_TEST_RUNNER} --task ${CMAKE_CURRENT_BINARY_DIR}/service-manager-nostart-connect --task ${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-service" >> "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-nostart-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/service-manager-connect-nostart-tester" +) +add_test("service-manager-connect-nostart-tester" "service-manager-connect-nostart-tester") + +# service-shutdown-timeout +add_test_executable_by_name(service-shutdown-timeout) + +# service-shutdown-timeout-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/service-shutdown-timeout-tester" + DEPENDS "service-shutdown-timeout" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/service-shutdown-timeout-tester" + COMMAND + echo "${DBUS_TEST_RUNNER} --dbus-config /usr/share/dbus-test-runner/session.conf --task ${CMAKE_CURRENT_BINARY_DIR}/service-shutdown-timeout" >> "${CMAKE_CURRENT_BINARY_DIR}/service-shutdown-timeout-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/service-shutdown-timeout-tester" +) +add_test("service-shutdown-timeout-tester" "service-shutdown-timeout-tester") + +# service-version-bad.service +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/service-version-bad.service.in" "${CMAKE_CURRENT_BINARY_DIR}/service-version-bad.service" @ONLY) + +# service-version-bad-service +add_test_executable_by_name(service-version-bad-service) + +# service-version-good.service +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/service-version-good.service.in" "${CMAKE_CURRENT_BINARY_DIR}/service-version-good.service" @ONLY) + +# service-version-good-service +add_test_executable_by_name(service-version-good-service) + +# service-version-manager +add_test_executable_by_name(service-version-manager) + +# service-version-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/service-version-tester" + DEPENDS "service-shutdown-timeout" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/service-version-tester" + COMMAND + echo "${DBUS_TEST_RUNNER} --dbus-config ${CMAKE_CURRENT_BINARY_DIR}/session.conf --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-manager" >> "${CMAKE_CURRENT_BINARY_DIR}/service-version-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/service-version-tester" +) +add_test("service-version-tester" "service-version-tester") + +# service-version-multiwatch-manager +add_test_executable_by_name(service-version-multiwatch-manager) + +# service-version-multiwatch-manager-impolite +add_test_executable_by_name(service-version-multiwatch-manager-impolite) + +# service-version-multiwatch-service +add_test_executable_by_name(service-version-multiwatch-service) + +# service-version-multiwatch-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-tester" + DEPENDS "service-version-multiwatch-manager" + DEPENDS "service-version-multiwatch-manager-impolite" + DEPENDS "service-version-multiwatch-service" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-tester" + COMMAND + echo "${DBUS_TEST_RUNNER} --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-service --task-name Service --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager --task-name Manager1 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager --task-name Manager2 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager --task-name Manager3 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager --task-name Manager4 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager --task-name Manager5 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager-impolite --task-name Impolite1 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager-impolite --task-name Impolite2 --task ${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-manager-impolite --task-name Impolite3" >> "${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/service-version-multiwatch-tester" +) +add_test("service-version-multiwatch-tester" "service-version-multiwatch-tester") # test-desktop-shortcuts +add_test_executable_by_name(test-desktop-shortcuts) -set_source_files_properties(test-desktop-shortcuts.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_executable("test-desktop-shortcuts" test-desktop-shortcuts.c) -target_compile_definitions("test-desktop-shortcuts" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") -target_compile_definitions("test-desktop-shortcuts" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") -target_include_directories("test-desktop-shortcuts" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("test-desktop-shortcuts" PUBLIC "${CMAKE_SOURCE_DIR}/src") -target_link_libraries("test-desktop-shortcuts" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) -target_link_directories("test-desktop-shortcuts" PUBLIC "${CMAKE_BINARY_DIR}/src") -add_dependencies("test-desktop-shortcuts" "${ayatana_indicator_gtkver}") -add_test("test-desktop-shortcuts" "test-desktop-shortcuts") +# test-desktop-shortcuts-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts-tester" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/bash" > "${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts-tester" + COMMAND + echo ". ${CMAKE_CURRENT_SOURCE_DIR}/run-xvfb.sh" >> "${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts-tester" + COMMAND + echo "gtester -k --verbose -o=${CMAKE_CURRENT_BINARY_DIR}/loader-check-results.xml ${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts" >> "${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/test-desktop-shortcuts-tester" +) +add_test("test-desktop-shortcuts-tester" "test-desktop-shortcuts-tester") + +if (FLAVOUR_GTK3) + # test-indicator-ng + add_test_executable_by_name(test-indicator-ng) + + # org.ayatana.indicator.test.service + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/org.ayatana.indicator.test.service.in" "${CMAKE_CURRENT_BINARY_DIR}/org.ayatana.indicator.test.service" @ONLY) + + # test-indicator-ng-dbus-runner + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-dbus-runner" + DEPENDS "test-indicator-ng" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/sh" > "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-dbus-runner" + COMMAND + echo "${DBUS_TEST_RUNNER} --dbus-config /usr/share/dbus-test-runner/session.conf --task ${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng" >> "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-dbus-runner" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-dbus-runner" + ) + + # test-indicator-ng-tester + add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-tester" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-dbus-runner" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/bash" > "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-tester" + COMMAND + echo ". ${CMAKE_CURRENT_SOURCE_DIR}/run-xvfb.sh" >> "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-tester" + COMMAND + echo "gtester -k --verbose -o=${CMAKE_CURRENT_BINARY_DIR}/loader-check-results.xml ${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-dbus-runner" >> "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/test-indicator-ng-tester" + ) + add_test("test-indicator-ng-tester" "test-indicator-ng-tester") +endif(FLAVOUR_GTK3) # test-loader +add_test_executable_by_name(test-loader) + +# loader-tester +add_custom_command( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/loader-tester" + DEPENDS "test-loader" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + VERBATIM + COMMAND + echo "#!/bin/bash" > "${CMAKE_CURRENT_BINARY_DIR}/loader-tester" + COMMAND + echo ". ${CMAKE_CURRENT_SOURCE_DIR}/run-xvfb.sh" >> "${CMAKE_CURRENT_BINARY_DIR}/loader-tester" + COMMAND + echo "gtester -k --verbose -o=${CMAKE_CURRENT_BINARY_DIR}/loader-check-results.xml ${CMAKE_CURRENT_BINARY_DIR}/test-loader" >> "${CMAKE_CURRENT_BINARY_DIR}/loader-tester" + COMMAND + chmod +x "${CMAKE_CURRENT_BINARY_DIR}/loader-tester" +) +add_test("loader-tester" "loader-tester") -set_source_files_properties(test-loader.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) -add_executable("test-loader" test-loader.c) -target_compile_definitions("test-loader" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") -target_include_directories("test-loader" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) -target_include_directories("test-loader" PUBLIC "${CMAKE_SOURCE_DIR}/src") -target_link_libraries("test-loader" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) -target_link_directories("test-loader" PUBLIC "${CMAKE_BINARY_DIR}/src") -add_dependencies("test-loader" "${ayatana_indicator_gtkver}") -add_test("test-loader" "test-loader") +# indicator-test-service +set_source_files_properties(indicator-test-service.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) +add_executable("indicator-test-service" indicator-test-service.c) +target_include_directories("indicator-test-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) +target_link_libraries("indicator-test-service" ${PROJECT_DEPS_LIBRARIES}) -# test-indicator-ng +set (ALL_TESTERS + "service-manager-connect-tester" + "service-manager-no-connect-tester" + "service-manager-connect-nostart-tester" + "service-shutdown-timeout-tester" + "service-version-tester" + "service-version-multiwatch-tester" + "test-desktop-shortcuts-tester" + "loader-tester" +) if (FLAVOUR_GTK3) - set_source_files_properties(test-indicator-ng.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) - add_executable("test-indicator-ng" test-indicator-ng.c) - target_compile_definitions("test-indicator-ng" PUBLIC BUILD_DIR="${CMAKE_CURRENT_BINARY_DIR}") - target_compile_definitions("test-indicator-ng" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}") - target_include_directories("test-indicator-ng" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) - target_include_directories("test-indicator-ng" PUBLIC "${CMAKE_SOURCE_DIR}/src") - target_link_libraries("test-indicator-ng" ${PROJECT_DEPS_LIBRARIES} -l${ayatana_indicator_gtkver}) - target_link_directories("test-indicator-ng" PUBLIC "${CMAKE_BINARY_DIR}/src") - add_dependencies("test-indicator-ng" "${ayatana_indicator_gtkver}") - add_test("test-indicator-ng" "test-indicator-ng") + set (ALL_TESTERS + ${ALL_TESTERS} + "test-indicator-ng-tester" + ) endif() + +add_custom_target("tests" + ALL + DEPENDS + ${ALL_TESTERS} +) -- cgit v1.2.3 From a9148486a7617afe336a93e365ef917240c44a10 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 16 May 2021 22:50:57 +0200 Subject: CMakeLists.txt: Fix coverage report. We need to reference the test executables here, not the test wrappers. --- CMakeLists.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bc65cee..c7444f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,29 @@ add_subdirectory(src) add_subdirectory(data) add_subdirectory(tools) +set (COVERAGE_TEST_EXECUTABLES + "service-manager-connect" + "service-manager-connect-service" + "service-manager-no-connect" + "service-manager-nostart-connect" + "service-shutdown-timeout" + "service-version-bad-service" + "service-version-good-service" + "service-version-manager" + "service-version-multiwatch-manager" + "service-version-multiwatch-manager-impolite" + "service-version-multiwatch-service" + "test-desktop-shortcuts" + "test-loader" +) + +if(FLAVOUR_GTK3) + set (COVERAGE_TEST_EXECUTABLES + ${COVERAGE_TEST_EXECUTABLES} + "test-indicator-ng" + ) +endif() + if(ENABLE_TESTS) include(CTest) enable_testing() @@ -90,7 +113,7 @@ if(ENABLE_TESTS) find_package(CoverageReport) ENABLE_COVERAGE_REPORT( TARGETS "ayatana-indicator3" - TESTS "test-desktop-shortcuts" "test-indicator-ng" "test-loader" + TESTS ${COVERAGE_TEST_EXECUTABLES} FILTER /usr/include ${CMAKE_BINARY_DIR}/* ) endif() -- cgit v1.2.3