Skip to content

Commit

Permalink
run_tests.sh: always treat outputs as text data
Browse files Browse the repository at this point in the history
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  • Loading branch information
jow- committed Feb 3, 2022
1 parent 2cb627f commit 3ada6e0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/custom/run_tests.sh
Expand Up @@ -85,7 +85,10 @@ run_testcase() {

IFS=$' \t\n'

$ucode_bin $args -e '{ "REQUIRE_SEARCH_PATH": [ "'"$ucode_lib"'/*.so" ] }' -i - <"$in" >"$dir/res.out" 2>"$dir/res.err"
$ucode_bin $args -e '{
"REQUIRE_SEARCH_PATH": [ "'"$ucode_lib"'/*.so" ],
"TESTFILES_PATH": "'"$dir"'/files"
}' -i - <"$in" >"$dir/res.out" 2>"$dir/res.err"
)

printf "%d\n" $? > "$dir/res.code"
Expand All @@ -94,23 +97,23 @@ run_testcase() {
if ! cmp -s "$dir/res.err" "${err:-$dir/empty}"; then
[ $fail = 0 ] && printf "!\n"
printf "Testcase #%d: Expected stderr did not match:\n" $num
diff -u --color=always --label="Expected stderr" --label="Resulting stderr" "${err:-$dir/empty}" "$dir/res.err"
diff -au --color=always --label="Expected stderr" --label="Resulting stderr" "${err:-$dir/empty}" "$dir/res.err"
printf -- "---\n"
fail=1
fi

if ! cmp -s "$dir/res.out" "${out:-$dir/empty}"; then
[ $fail = 0 ] && printf "!\n"
printf "Testcase #%d: Expected stdout did not match:\n" $num
diff -u --color=always --label="Expected stdout" --label="Resulting stdout" "${out:-$dir/empty}" "$dir/res.out"
diff -au --color=always --label="Expected stdout" --label="Resulting stdout" "${out:-$dir/empty}" "$dir/res.out"
printf -- "---\n"
fail=1
fi

if [ -n "$code" ] && ! cmp -s "$dir/res.code" "$code"; then
[ $fail = 0 ] && printf "!\n"
printf "Testcase #%d: Expected exit code did not match:\n" $num
diff -u --color=always --label="Expected code" --label="Resulting code" "$code" "$dir/res.code"
diff -au --color=always --label="Expected code" --label="Resulting code" "$code" "$dir/res.code"
printf -- "---\n"
fail=1
fi
Expand Down

0 comments on commit 3ada6e0

Please sign in to comment.