From 22e6ffa14400f78aa089a9f9e4d457f28b377cc9 Mon Sep 17 00:00:00 2001 From: Mathieu Westphal Date: Sun, 24 Mar 2024 19:30:42 +0100 Subject: [PATCH] Fixup to use xdotool --- application/testing/CMakeLists.txt | 6 +++--- application/testing/test_watch.sh | 16 +++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/application/testing/CMakeLists.txt b/application/testing/CMakeLists.txt index 1f9bd4b063..bea8a4af1d 100644 --- a/application/testing/CMakeLists.txt +++ b/application/testing/CMakeLists.txt @@ -889,9 +889,6 @@ f3d_test(NAME TestBadRefNoOutput DATA cow.vtp ARGS --ref=${F3D_SOURCE_DIR}/testi # Test failure with a bad interaction play file, please do not create a dummy.log f3d_test(NAME TestPlayNoFile DATA cow.vtp ARGS --interaction-test-play=${CMAKE_BINARY_DIR}/Testing/Temporary/dummy.log WILL_FAIL) -# Test watch coverage, actual test is a custom test that is not taken into account by classic coverage computation -f3d_test(NAME TestWatchCoverage DATA cow.vtp ARGS --watch NO_BASELINE) - # Test scan plugins if(NOT F3D_MACOS_BUNDLE) f3d_test(NAME TestScanPluginsCheckNative ARGS --scan-plugins NO_RENDER NO_BASELINE REGEXP " - native") @@ -913,4 +910,7 @@ if(NOT VTK_OPENGL_HAS_EGL) endif() # Custom bash test for testing watch option add_test (NAME f3d::TestWatch COMMAND ${_f3d_os_run_exec} ${CMAKE_CURRENT_SOURCE_DIR}/test_watch.${_f3d_os_script_ext} $ ${F3D_SOURCE_DIR}/testing/data ${CMAKE_BINARY_DIR}/Testing/Temporary) + if(F3D_COVERAGE) # When running test for coverage, adapt the script to use xdotool + set_tests_properties(f3d::TestWatch PROPERTIES ENVIRONMENT "CTEST_F3D_COVERAGE=1") + endif() endif() diff --git a/application/testing/test_watch.sh b/application/testing/test_watch.sh index 76d57c0cd1..5fde3ec9ec 100755 --- a/application/testing/test_watch.sh +++ b/application/testing/test_watch.sh @@ -4,7 +4,7 @@ # rewriting it and checking the the file has been # automatically reloaded -set -uo pipefail +set -euo pipefail f3d_cmd=$1 data_dir=$2 tmp_dir=$3 @@ -19,12 +19,18 @@ log=$tmp_dir/output.log $f3d_cmd --watch --verbose $reloaded_data > $log & pid=$! +function cleanup() +{ + if [[ -z "${CTEST_F3D_COVERAGE}" ]]; then + kill $pid + else + xdotool key Escape + fi +} +trap "cleanup" EXIT + sleep 1 cp $lowres_data $reloaded_data sleep 1 grep -q "Number of points: 634" $log -ret=$? - -kill $pid -exit $ret