@@ -34,7 +34,7 @@ declare -r EXAMPLEDIR=${EXAMPLEDIR:-"./examples"}
34
34
declare -r INTERACTIVE_TESTDIR=${INTERACTIVE_TESTDIR:- " ${TESTROOTDIR} /interactive" }
35
35
declare -r HARPOON_TESTDIR=${HARPOON_TESTDIR:- " ${TESTROOTDIR} /harpoon" }
36
36
37
- declare -i TIMEOUT=${TIMEOUT:- 10 }
37
+ declare -r TIMEOUT=${TIMEOUT:- " 10s " }
38
38
39
39
function rsync_test_artifacts {
40
40
rsync -ak " ${ROOTDIR} /.admissible-fail" " ${TEMPDIR} /.admissible-fail"
@@ -123,8 +123,6 @@ function parse_opts {
123
123
124
124
function do_testing {
125
125
local is_failed=0 file_path
126
- # Limit runtime of each test case, in seconds.
127
- ulimit -t " ${TIMEOUT} "
128
126
129
127
if [[ -n " ${RUN_CASE_STUDIES} " ]]; then
130
128
echo " ===== CASE STUDIES ====="
@@ -204,10 +202,10 @@ function check_example_test_case {
204
202
# ${...[@]+${...[@]}} is a workaround for bash < 4.4
205
203
# In bash < 4.4, array without an item is considered as an undefined variable.
206
204
output_file=" $( mktemp) "
207
- " ${BELUGA} " +test " ${BELUGA_FLAGS[@]+${BELUGA_FLAGS[@]} } " " ${file_path} " >> " ${output_file} " 2>&1
205
+ timeout --foreground " ${TIMEOUT} " " ${BELUGA} " +test " ${BELUGA_FLAGS[@]+${BELUGA_FLAGS[@]} } " " ${file_path} " >> " ${output_file} " 2>&1
208
206
exit_code=$?
209
207
210
- if [ " ${exit_code} " -eq 152 ]; then
208
+ if [ " ${exit_code} " -eq 124 ]; then
211
209
if grep -q " ${file_path} " .admissible-fail; then
212
210
echo -e " ${C_ADMISSIBLE} ADMISSIBLE TIMEOUT${C_END} "
213
211
(( TEST_RESULT_ADMISSIBLE+= 1 ))
@@ -242,10 +240,10 @@ function check_compiler_test_case {
242
240
# ${...[@]+${...[@]}} is a workaround for bash < 4.4
243
241
# In bash < 4.4, array without an item is considered as an undefined variable.
244
242
output_file=" $( mktemp) "
245
- " ${BELUGA} " +test " ${BELUGA_FLAGS[@]+${BELUGA_FLAGS[@]} } " " ${file_path} " >> " ${output_file} " 2>&1
243
+ timeout --foreground " ${TIMEOUT} " " ${BELUGA} " +test " ${BELUGA_FLAGS[@]+${BELUGA_FLAGS[@]} } " " ${file_path} " >> " ${output_file} " 2>&1
246
244
exit_code=$?
247
245
248
- if [ " ${exit_code} " -eq 152 ]; then
246
+ if [ " ${exit_code} " -eq 124 ]; then
249
247
if grep -q " ${file_path} " .admissible-fail; then
250
248
echo -e " ${C_ADMISSIBLE} ADMISSIBLE TIMEOUT${C_END} "
251
249
(( TEST_RESULT_ADMISSIBLE+= 1 ))
@@ -318,10 +316,10 @@ function check_interactive {
318
316
319
317
local output exit_code
320
318
321
- output=$( " ${REPLAY} " " ${BELUGA} " " ${file_path} " 2>&1 )
319
+ output=$( timeout --foreground " ${TIMEOUT} " " ${REPLAY} " " ${BELUGA} " " ${file_path} " 2>&1 )
322
320
exit_code=$?
323
321
324
- if [ " ${exit_code} " -eq 152 ]; then
322
+ if [ " ${exit_code} " -eq 124 ]; then
325
323
if grep -q " ${file_path} " .admissible-fail; then
326
324
echo -e " ${C_ADMISSIBLE} ADMISSIBLE TIMEOUT${C_END} "
327
325
(( TEST_RESULT_ADMISSIBLE+= 1 ))
@@ -355,10 +353,10 @@ function check_harpoon {
355
353
# Read the first line in the file at "${file_path}"
356
354
sig=$( sed -n ' 1p' " ${file_path} " )
357
355
358
- output=$( " ${HARPOON} " --sig " ${sig} " --test " ${file_path} " --test-start 2 --no-save-back --stop 2>&1 )
356
+ output=$( timeout --foreground " ${TIMEOUT} " " ${HARPOON} " --sig " ${sig} " --test " ${file_path} " --test-start 2 --no-save-back --stop 2>&1 )
359
357
exit_code=$?
360
358
361
- if [ " ${exit_code} " -eq 152 ]; then
359
+ if [ " ${exit_code} " -eq 124 ]; then
362
360
if grep -q " ${file_path} " .admissible-fail; then
363
361
echo -e " ${C_ADMISSIBLE} ADMISSIBLE TIMEOUT${C_END} "
364
362
(( TEST_RESULT_ADMISSIBLE+= 1 ))
@@ -448,7 +446,7 @@ function print_paths {
448
446
echo -e " \t TESTDIR: ${TESTDIR} "
449
447
echo -e " \t INTERACTIVE_TESTDIR: ${INTERACTIVE_TESTDIR} "
450
448
echo -e " \t EXAMPLEDIR: ${EXAMPLEDIR} "
451
- echo -e " \t TIMEOUT: ${TIMEOUT} " seconds
449
+ echo -e " \t TIMEOUT: ${TIMEOUT} "
452
450
echo
453
451
}
454
452
0 commit comments