Skip to content
Snippets Groups Projects
Commit 9e600c1c authored by Anh Nguyen-Tuong's avatar Anh Nguyen-Tuong
Browse files

Verbose output on failure

Former-commit-id: 4614bc785211792bcf01d86e1170d978b66f81a8
parent c81002fe
No related branches found
No related tags found
No related merge requests found
......@@ -343,6 +343,12 @@ compare_exit_status()
fi
}
show_log()
{
echo "=== Show content of $1 ==="
cat $1
}
#assumes that orig_status, test_status, orig_error, test_error, orig_out, and test_out
#all exists, and does a comparison of each.
compare_std_results()
......@@ -356,6 +362,12 @@ compare_std_results()
if [ ! "$?" -eq 0 ]; then
echo "Exit Status Failure"
if [ ! -z "$TEST_VERBOSE" ]; then
show_log orig_out
show_log test_out
show_log orig_error
show_log test_error
fi
report_failure
fi
......@@ -365,6 +377,10 @@ compare_std_results()
diff orig_error test_error
if [ ! $? -eq 0 ]; then
echo "Stderr Failure"
if [ ! -z "$TEST_VERBOSE" ]; then
show_log orig_error
show_log test_error
fi
report_failure
fi
......@@ -375,6 +391,10 @@ compare_std_results()
if [ ! $? -eq 0 ]; then
echo "run_test Stdout Failure"
report_failure
if [ ! -z "$TEST_VERBOSE" ]; then
show_log orig_out
show_log test_out
fi
fi
}
......
#!/bin/bash
apps=""
positional=""
show_logs_on_failure=0
had_fails=0
apps=""
default_apps="bzip2 grep du ncal ls objdump readelf sort tar touch tcpdump"
configs=""
default_configs="rida"
do_tests()
{
......@@ -183,7 +184,7 @@ do_tests()
fi
echo "TEST ($config) ${prog}: Running tests..."
timeout 300 ../$prog/test_script.sh $progpath ./$protected > test_${prog}.log 2>&1
TEST_VERBOSE=1 timeout 300 ../$prog/test_script.sh $progpath ./$protected > test_${prog}.log 2>&1
if [ $? -eq 0 ]; then
echo "TEST ($config) ${prog}: PASS"
progs_pass="$progs_pass $prog.$config"
......@@ -214,22 +215,23 @@ do_tests()
usage()
{
echo "test_cmds.sh [options] [configs...]"
echo "test_cmds.sh [options]"
echo
echo "options:"
echo " -h, --help print help info"
echo " -l print logs on failure"
echo " -a, --app <appname> app to test (may be repeated)"
echo " appname: bzip2 grep du ncal ls objdump readelf sort tar touch tcpdump"
echo " -c, --config <config>"
echo
echo "configs:"
echo "config:"
echo " rida (default configuration)"
echo " p1 P1 transform"
echo " mgx move globals"
echo " mgx_p1 move globals, followed by P1"
echo " kill_deads xform with bogus random values for dead registers"
echo
echo " ...too many configs to list, consult script"
echo " ...too many other configs to list, consult script"
}
parse_args()
......@@ -248,9 +250,12 @@ parse_args()
shift
;;
-a|--app)
shift
apps="$apps $1 "
shift
apps="$apps $2 "
shift 2
;;
-c|--config)
configs="$configs $2 "
shift 2
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
......@@ -264,26 +269,34 @@ parse_args()
done
eval set -- "$PARAMS"
positional=($PARAMS)
}
main()
{
parse_args $*
# backward compatibility where all configs passed as positional parameters
# should really use -c option only
local configs="$positional"
positional=($PARAMS)
if [[ $positional != "" ]]; then
configs="$configs $positional"
fi
if [[ $configs == "" ]]; then
configs="rida"
configs=" $default_configs"
fi
if [[ $apps == "" ]]; then
apps="bzip2 grep du ncal ls objdump readelf sort tar touch tcpdump"
apps=" $default_apps"
fi
}
main()
{
parse_args "$@"
echo
echo "test configuration"
echo " apps: $apps"
echo " configs: $configs"
echo " configs: $configs"
if [ $show_logs_on_failure -eq 1 ]; then
echo "test log: show-on-failure"
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment