From 7ca8bbc9021f5bd08acdc4f1bd9a8144760b6f9f Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 30 Nov 2016 13:02:01 +0100 Subject: [PATCH] Updated tests with v1.1 branch timed execution tests --- dev/tests/run_tests.sh | 46 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/dev/tests/run_tests.sh b/dev/tests/run_tests.sh index f4d42df..7046af6 100755 --- a/dev/tests/run_tests.sh +++ b/dev/tests/run_tests.sh @@ -7,7 +7,11 @@ ## On CYGWIN / MSYS, ACL and extended attributes aren't supported -# osync test suite 2016112901 + +# TODO: add waitfortaskcompletion tests compat with v1.1 +# TODO: render timed execution checks compat with v1.1 (only using config files) + +# osync test suite 2016113001 # 4 tests: # quicklocal @@ -32,7 +36,7 @@ # ParallelExec # daemon mode tests for both config files -#TODO: on BSD, remount UFS with ACL support using mount -o acls / +# on BSD, remount UFS with ACL support using mount -o acls / # setfacl needs double ':' to be compatible with both linux and BSD # setfacl -m o::rwx file @@ -832,14 +836,46 @@ function test_Locking () { } function test_WaitForTaskCompletion () { + local pids + + # Tests compatible with v1.1 syntax if [ "$OSYNC_MIN_VERSION" == "1" ]; then echo "Skipping WaitForTaskCompletion test because osync v1.1 does not support multiple pid monitoring" + + # Standard wait + sleep 2 & + WaitForTaskCompletion $! 0 0 ${FUNCNAME[0]} + assertEquals "WaitForTaskCompletion v1.1 test 1" "0" $? + + # Standard wait with warning + sleep 5 & + WaitForTaskCompletion $! 3 0 ${FUNCNAME[0]} + assertEquals "WaitForTaskCompletion test 2" "0" $? + + # Pid is killed + sleep 5 & + WaitForTaskCompletion $! 0 2 ${FUNCNAME[0]} + assertEquals "WaitForTaskCompletion test 3" "1" $? + + # Standard wait + sleep 2 & + WaitForCompletion $! 0 0 ${FUNCNAME[0]} + assertEquals "WaitForTaskCompletion v1.1 test 1" "0" $? + + # Standard wait with warning + sleep 5 & + WaitForCompletion $! 3 0 ${FUNCNAME[0]} + assertEquals "WaitForTaskCompletion test 2" "0" $? + + # Pid is killed + sleep 5 & + WaitForCompletion $! 0 2 ${FUNCNAME[0]} + assertEquals "WaitForTaskCompletion test 3" "1" $? + return 0 fi - local pids - - # Tests if wait for task completion works correctly + # Tests if wait for task completion works correctly with v1.2+ # Standard wait sleep 1 &