diff options
author | Robert Tari <robert@tari.in> | 2021-05-17 12:58:11 +0200 |
---|---|---|
committer | Robert Tari <robert@tari.in> | 2021-05-17 12:58:11 +0200 |
commit | f6baadaffdb58ba27d585f67680bd7e6172f4444 (patch) | |
tree | c4fcf46eed283b3bf950ae08d02c2dc540b4c687 /tests | |
parent | 763acdea57d43c9a5dd063879a050c76b72c26dc (diff) | |
parent | a9148486a7617afe336a93e365ef917240c44a10 (diff) | |
download | libayatana-indicator-f6baadaffdb58ba27d585f67680bd7e6172f4444.tar.gz libayatana-indicator-f6baadaffdb58ba27d585f67680bd7e6172f4444.tar.bz2 libayatana-indicator-f6baadaffdb58ba27d585f67680bd7e6172f4444.zip |
Merge branch 'tari01-pr/fix-tests-and-coverage'
Attributes GH PR #41: https://github.com/AyatanaIndicators/libayatana-indicator/pull/41
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 323 | ||||
-rw-r--r-- | tests/org.ayatana.indicator.test.service.in | 2 | ||||
-rw-r--r-- | tests/run-xvfb.sh | 8 | ||||
-rw-r--r-- | tests/service-manager-connect.service.in | 2 | ||||
-rw-r--r-- | tests/service-version-bad.service.in | 2 | ||||
-rw-r--r-- | tests/service-version-good.service.in | 2 | ||||
-rw-r--r-- | tests/session.conf.in | 6 | ||||
-rw-r--r-- | tests/test-indicator-ng.c | 10 |
8 files changed, 287 insertions, 68 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} +) 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 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 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 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 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 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 @@ <listen>unix:tmpdir=/tmp</listen> - <servicedir>@servicedir@</servicedir> + <servicedir>@CMAKE_CURRENT_BINARY_DIR@</servicedir> <policy context="default"> <!-- Allow everything to be sent --> @@ -28,9 +28,9 @@ <limit name="max_incoming_bytes">1000000000</limit> <limit name="max_outgoing_bytes">1000000000</limit> <limit name="max_message_size">1000000000</limit> - <limit name="service_start_timeout">120000</limit> + <limit name="service_start_timeout">120000</limit> <limit name="auth_timeout">240000</limit> - <limit name="max_completed_connections">100000</limit> + <limit name="max_completed_connections">100000</limit> <limit name="max_incomplete_connections">10000</limit> <limit name="max_connections_per_user">100000</limit> <limit name="max_pending_service_starts">10000</limit> 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 (); } |