regtesting: handle empty lines and comments gracefully

This commit is contained in:
Tiziano Müller 2020-07-30 16:43:44 +02:00 committed by Tiziano Müller
parent 3fec431b0a
commit 447073b048

View file

@ -369,19 +369,19 @@ function run_regtest_dir() {
#
echo "Starting regression tests in ${dir_test}/tests/${dir} (${idir} of ${ndir})"
echo ">>> ${dir_test}/tests/${dir}" > ${dir_test}/status/REGTEST_TASK_TESTS-$task
ntest=`grep -v "#" TEST_FILES | ${awk} '{c=c+1}END{print c}'`
ntest=`grep '^\s*\w' TEST_FILES | wc -l`
t1=`date +%s`
for ((itest=1;itest<=ntest;itest++));
do
touch ${lockfile}
n_tests=$((n_tests+1))
this_test=""
input_file=`grep -v "#" TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) print $1}'`
test_type=`grep -v "#" TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) print $2}'`
input_file=`grep '^\s*\w' TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) print $1}'`
test_type=`grep '^\s*\w' TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) print $2}'`
# third field allows numerical tolerances to be read from the TEST_FILES
# if value does not exist set to the default of 1.0E-14
test_tolerance=`grep -v "#" TEST_FILES | ${awk} -v itest=$itest -v def_err_tol=$default_err_tolerance '{c=c+1;if (c==itest) if (NF >= 3) { print $3 } else { print def_err_tol } }'`
test_ref_value=`grep -v "#" TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) if (NF == 4) { print $4 } }'`
test_tolerance=`grep '^\s*\w' TEST_FILES | ${awk} -v itest=$itest -v def_err_tol=$default_err_tolerance '{c=c+1;if (c==itest) if (NF >= 3) { print $3 } else { print def_err_tol } }'`
test_ref_value=`grep '^\s*\w' TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) if (NF == 4) { print $4 } }'`
output_file=${dir_test}/${dir}/${input_file}.out
output_last=${dir_last}/${dir}/${input_file}.out
@ -1060,10 +1060,10 @@ EOF
# generate the equivalent farming input
#
idir=$((idir+1))
ntest=`grep -v "#" ${dir_test}/tests/${dir}/TEST_FILES | ${awk} '{c=c+1}END{print c}'`
ntest=`grep '^\s*\w' ${dir_test}/tests/${dir}/TEST_FILES | ${awk} '{c=c+1}END{print c}'`
for ((itest=1;itest<=ntest;itest++));
do
input_file=`grep -v "#" ${dir_test}/tests/${dir}/TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) print $1}'`
input_file=`grep '^\s*\w' ${dir_test}/tests/${dir}/TEST_FILES | ${awk} -v itest=$itest '{c=c+1;if (c==itest) print $1}'`
output_file=${dir_test}/${dir}/${input_file}.out
jobid=$((idir*100000+itest))
if [[ $itest != 1 ]]; then