Add support for expected test failures

This commit is contained in:
Michael Hansen
2019-10-07 11:36:09 -07:00
parent 8014ac2b14
commit 0dc49b5872
8 changed files with 69 additions and 16 deletions

View File

@@ -16,10 +16,11 @@ fi
shopt -s nullglob
compfiles=( "$testdir/compiled/$testname".?.?.pyc )
xfcfiles=( "$testdir/xfail/$testname".?.?.pyc )
shopt -u nullglob
if (( ${#compfiles[@]} == 0 )); then
echo "No compiled modules found for compiled/$testname.*.pyc"
if (( ${#compfiles[@]} + ${#xfcfiles[@]} == 0 )); then
echo "No compiled/xfail modules found for $testname.*.pyc"
exit 1
fi
@@ -28,48 +29,100 @@ mkdir -p "$outdir"
echo -ne "\033[1m*** $testname:\033[0m "
fails=0
xfails=0
upass=0
efiles=()
errors=()
for pyc in "${compfiles[@]}"; do
upfiles=()
for pyc in "${compfiles[@]}" "${xfcfiles[@]}"; do
base="$outdir/$(basename "$pyc")"
./pycdc "$pyc" 2>"$base.err" 1>"$base.src.py"
if (( $? )) || [[ -s "$base.err" ]]
then
let fails+=1
efiles+=("$(basename "$pyc")")
errors+=("$(cat "$base.err")")
if [[ "$(dirname "$pyc")" =~ xfail ]]
then
let xfails+=1
else
let fails+=1
efiles+=("$(basename "$pyc")")
errors+=("$(cat "$base.err")")
fi
continue
fi
"$srcdir"/scripts/token_dump "$base.src.py" 2>"$base.tok.err" 1>"$base.tok.txt"
if (( $? )) || [[ -s "$base.tok.err" ]]
then
let fails+=1
efiles+=("$(basename "$pyc")")
errors+=("$(cat "$base.tok.err")")
if [[ "$(dirname "$pyc")" =~ xfail ]]
then
let xfails+=1
else
let fails+=1
efiles+=("$(basename "$pyc")")
errors+=("$(cat "$base.tok.err")")
fi
continue
fi
diff -u "$testdir/tokenized/$testname.txt" "$base.tok.txt" >"$base.tok.diff"
if (( $? ))
then
let fails+=1
efiles+=("$(basename "$pyc")")
errors+=("$base.tok.txt does not match $testdir/tokenized/$testname.txt:\n$(cat "$base.tok.diff")")
continue
if [[ "$(dirname "$pyc")" =~ xfail ]]
then
let xfails+=1
else
let fails+=1
efiles+=("$(basename "$pyc")")
errors+=("$base.tok.txt does not match $testdir/tokenized/$testname.txt:\n$(cat "$base.tok.diff")")
fi
else
if [[ "$(dirname "$pyc")" =~ xfail ]]
then
let upass+=1
upfiles+=("$(basename "$pyc")")
fi
fi
done
if (( $fails == 0 ))
then
echo -e "\033[32mPASS (${#compfiles[@]})\033[m"
if (( $xfails != 0 ))
then
if (( ${#compfiles[@]} == 0 ))
then
echo -e "\033[33mXFAIL ($xfails)\033[0m"
else
echo -e "\033[32mPASS (${#compfiles[@]})\033[33m + XFAIL ($xfails)\033[0m"
fi
else
echo -e "\033[32mPASS (${#compfiles[@]})\033[0m"
fi
else
echo -e "\033[31mFAIL ($fails of ${#compfiles[@]})\033[m"
if (( $xfails != 0 ))
then
echo -e "\033[31mFAIL ($fails of ${#compfiles[@]})\033[33m + XFAIL ($xfails)\033[0m"
else
echo -e "\033[31mFAIL ($fails of ${#compfiles[@]})\033[0m"
fi
for ((i=0; i<${#efiles[@]}; i++))
do
echo -e "\t\033[31m${efiles[i]}\033[m"
echo -e "\t\033[31m${efiles[i]}\033[0m"
echo -e "${errors[i]}\n"
done
fi
if (( $upass != 0 ))
then
echo -e "\033[1;34mUnexpected passes:\033[0m"
for ((i=0; i<${#upfiles[@]}; i++))
do
echo -e "\t\033[33m${upfiles[i]}\033[0m"
done
fi
if (( $fails != 0 ))
then
exit 1
fi

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.