Skip to content

Commit

Permalink
Fixup to use xdotool
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal committed Mar 24, 2024
1 parent 4fe4647 commit 22e6ffa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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} $<TARGET_FILE:f3d> ${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()
16 changes: 11 additions & 5 deletions application/testing/test_watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 22e6ffa

Please sign in to comment.