|
|
|
@ -8,6 +8,9 @@ help_and_exit() {
|
|
|
|
echo "Usage: ./tests.sh [-p|--pdb] [-c|--cov] [<test-name-filter>]"
|
|
|
|
echo "Usage: ./tests.sh [-p|--pdb] [-c|--cov] [<test-name-filter>]"
|
|
|
|
echo " -p, --pdb enable pdb (Python debugger) post mortem debugger on failed tests"
|
|
|
|
echo " -p, --pdb enable pdb (Python debugger) post mortem debugger on failed tests"
|
|
|
|
echo " -c, --cov enable codecov"
|
|
|
|
echo " -c, --cov enable codecov"
|
|
|
|
|
|
|
|
echo " -v, --verbose display all test output instead of just failing test output"
|
|
|
|
|
|
|
|
echo " -k, --keep don't delete the temporary files containing the command output"
|
|
|
|
|
|
|
|
echo " --collect-only only show the output of test collection, don't run any tests"
|
|
|
|
echo " <test-name-filter> run only tests that match the regex"
|
|
|
|
echo " <test-name-filter> run only tests that match the regex"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -19,6 +22,9 @@ fi
|
|
|
|
USE_PDB=0
|
|
|
|
USE_PDB=0
|
|
|
|
TEST_NAME_FILTER=""
|
|
|
|
TEST_NAME_FILTER=""
|
|
|
|
RUN_CODECOV=0
|
|
|
|
RUN_CODECOV=0
|
|
|
|
|
|
|
|
KEEP=0
|
|
|
|
|
|
|
|
VERBOSE=0
|
|
|
|
|
|
|
|
COLLECT_ONLY=0
|
|
|
|
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
case $1 in
|
|
|
|
case $1 in
|
|
|
|
@ -32,6 +38,18 @@ while [[ $# -gt 0 ]]; do
|
|
|
|
RUN_CODECOV=1
|
|
|
|
RUN_CODECOV=1
|
|
|
|
shift
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
|
|
|
|
-v | --verbose)
|
|
|
|
|
|
|
|
VERBOSE=1
|
|
|
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
-k | --keep)
|
|
|
|
|
|
|
|
KEEP=1
|
|
|
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
--collect-only)
|
|
|
|
|
|
|
|
COLLECT_ONLY=1
|
|
|
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
;;
|
|
|
|
-h | --help)
|
|
|
|
-h | --help)
|
|
|
|
help_and_exit
|
|
|
|
help_and_exit
|
|
|
|
;;
|
|
|
|
;;
|
|
|
|
@ -66,6 +84,9 @@ TESTS_COLLECT_OUTPUT=$(run_gdb "${gdb_args[@]}")
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo -E "$TESTS_COLLECT_OUTPUT"
|
|
|
|
echo -E "$TESTS_COLLECT_OUTPUT"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
elif [ $COLLECT_ONLY -eq 1 ]; then
|
|
|
|
|
|
|
|
echo "$TESTS_COLLECT_OUTPUT"
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
TESTS_LIST=($(echo -E "$TESTS_COLLECT_OUTPUT" | grep -o "tests/.*::.*" | grep "${TEST_NAME_FILTER}"))
|
|
|
|
TESTS_LIST=($(echo -E "$TESTS_COLLECT_OUTPUT" | grep -o "tests/.*::.*" | grep "${TEST_NAME_FILTER}"))
|
|
|
|
@ -89,24 +110,31 @@ run_test() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
parse_output_file() {
|
|
|
|
parse_output_file() {
|
|
|
|
#echo $1
|
|
|
|
|
|
|
|
output_file="$1"
|
|
|
|
output_file="$1"
|
|
|
|
|
|
|
|
|
|
|
|
read -r testname result < <(grep -Po '(^tests/[^ ]+)|(\x1b\[3.m(PASSED|FAILED|SKIPPED)\x1b\[0m)' "$output_file" | tr '\n' ' ' | cut -d ' ' -f 1,2)
|
|
|
|
read -r testname result < <(
|
|
|
|
|
|
|
|
grep -Po '(^tests/[^ ]+)|(\x1b\[3.m(PASSED|FAILED|SKIPPED|XPASS|XFAIL)\x1b\[0m)' "$output_file" \
|
|
|
|
|
|
|
|
| tr '\n' ' ' \
|
|
|
|
|
|
|
|
| cut -d ' ' -f 1,2
|
|
|
|
|
|
|
|
)
|
|
|
|
testfile=${testname%::*}
|
|
|
|
testfile=${testname%::*}
|
|
|
|
testname=${testname#*::}
|
|
|
|
testname=${testname#*::}
|
|
|
|
|
|
|
|
|
|
|
|
printf '%-70s %s\n' $testname $result
|
|
|
|
printf '%-70s %s\n' $testname $result
|
|
|
|
|
|
|
|
|
|
|
|
# Only show the output of failed tests
|
|
|
|
# Only show the output of failed tests unless the verbose flag was used
|
|
|
|
if [[ "$result" =~ FAILED ]]; then
|
|
|
|
if [[ $VERBOSE -eq 1 || "$result" =~ FAIL ]]; then
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
cat "$output_file"
|
|
|
|
cat "$output_file"
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Delete the temporary file created by `parallel`
|
|
|
|
if [[ $KEEP -ne 1 ]]; then
|
|
|
|
rm "$output_file"
|
|
|
|
# Delete the temporary file created by `parallel`
|
|
|
|
|
|
|
|
rm "$output_file"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo "$output_file"
|
|
|
|
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
JOBLOG_PATH="$(mktemp)"
|
|
|
|
JOBLOG_PATH="$(mktemp)"
|
|
|
|
|