Skip to content

Commit

Permalink
Adding a test
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal committed Mar 20, 2024
1 parent 11f24dc commit 096ba11
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
5 changes: 5 additions & 0 deletions application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -894,3 +894,8 @@ if(NOT F3D_MACOS_BUNDLE)
f3d_test(NAME TestScanPluginsCheckExodus ARGS --scan-plugins NO_RENDER NO_BASELINE REGEXP " - exodus")
endif()
endif()

if(UNIX)
# Custom bash test for testing auto-reload
add_test (NAME f3d::TestAutoReload COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/auto_reload.sh $<TARGET_FILE:f3d> ${F3D_SOURCE_DIR}/testing/data ${CMAKE_BINARY_DIR}/Testing/Temporary)
endif()
30 changes: 30 additions & 0 deletions application/testing/auto_reload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Test the auto-reload feature by opening a file
# rewriting it and checking the the file has been
# automatically reloaded

set -uo pipefail
f3d_cmd=$1
data_dir=$2
tmp_dir=$3

hires_data=$data_dir/cow.vtp
lowres_data=$data_dir/cowlow.vtp
reloaded_data=$tmp_dir/cow.vtp

cp $hires_data $reloaded_data

log=$tmp_dir/output.log
$f3d_cmd --auto-reload --verbose $reloaded_data > $log &
pid=$!

sleep 1
cp $lowres_data $reloaded_data
sleep 1

grep -q "Number of points: 634" $log
ret=$?

kill $pid
exit $ret
3 changes: 3 additions & 0 deletions testing/data/cowlow.vtp
Git LFS file not shown

0 comments on commit 096ba11

Please sign in to comment.