diff --git a/Testsuite/test/run_testsuite_with_cmake b/Testsuite/test/run_testsuite_with_cmake index 269e13a97fb..0bdad3f1d1a 100755 --- a/Testsuite/test/run_testsuite_with_cmake +++ b/Testsuite/test/run_testsuite_with_cmake @@ -21,6 +21,11 @@ if [ -n "$CGAL_TEST_PLATFORM" ]; then else PLATFORM=no-platform fi +if [ -n "${CGAL_TIMEOUT_PROG+x}" ]; then + TIMEOUT=$CGAL_TIMEOUT_PROG +else + TIMEOUT=`which timeout` +fi #clear the error file rm -f "$ERRORFILE" @@ -111,12 +116,17 @@ run_local_cgal_test() MAKEFLAGS= export MAKEFLAGS - eval ./cgal_test_with_cmake > current_compiler_output 2>&1 + if [ -n "$TIMEOUT" ]; then + "$TIMEOUT" $(( $TIME_PERIOD * 5 )) ./cgal_test_with_cmake > current_compiler_output 2>&1 + else + ./cgal_test_with_cmake > current_compiler_output 2>&1 + fi exit_value=$? if [ $exit_value -ne 0 ] then printf "%s\n" "$exit_value" > test_failure fi + return $exit_value } #test_directory @@ -152,23 +162,39 @@ test_directory() export PLATFORM TESTSUITE_CXXFLAGS TESTSUITE_LDFLAGS rm -f error.txt START=`date +%s` - run_local_cgal_test & - TIME_PERIOD=1200 if [ "$1" = "Polyhedron_Demo" ]; then TIME_PERIOD=2400 fi - if wait_for_process "$!" "$TIME_PERIOD" "5" - then - if [ -f test_failure ] ; then - exit_failure=`cat test_failure` - rm -f test_failure - echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERRORFILE" - echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERROR_OUTPUT" - fi + if [ -n "$TIMEOUT" ]; then + run_local_cgal_test + return_code=$? + if [ $return_code -eq 124 ]; then + echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERRORFILE" + echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERROR_OUTPUT" + else + if [ -f test_failure ] ; then + exit_failure=`cat test_failure` + rm -f test_failure + echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERRORFILE" + echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERROR_OUTPUT" + fi + fi else - echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERRORFILE" - echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERROR_OUTPUT" + run_local_cgal_test & + + if wait_for_process "$!" "$TIME_PERIOD" "5" + then + if [ -f test_failure ] ; then + exit_failure=`cat test_failure` + rm -f test_failure + echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERRORFILE" + echo "ERROR: cgal_test_with_cmake exited with error condition $exit_value" >> "$ERROR_OUTPUT" + fi + else + echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERRORFILE" + echo "ERROR: cgal_test_with_cmake did not finish within the time bound set" >> "$ERROR_OUTPUT" + fi fi STOP=`date +%s` DURATION=`expr "$STOP" - "$START"`