diff --git a/test/asm/errors-after-missing-include.flags b/test/asm/errors-after-missing-include.flags deleted file mode 100644 index 1fb54a3b..00000000 --- a/test/asm/errors-after-missing-include.flags +++ /dev/null @@ -1 +0,0 @@ --M /dev/null -MG diff --git a/test/asm/errors-after-missing-include.asm b/test/asm/errors-after-missing-include/a.asm similarity index 100% rename from test/asm/errors-after-missing-include.asm rename to test/asm/errors-after-missing-include/a.asm diff --git a/test/asm/errors-after-missing-include/a.err b/test/asm/errors-after-missing-include/a.err new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/errors-after-missing-include/a.out b/test/asm/errors-after-missing-include/a.out new file mode 100644 index 00000000..c04f2440 --- /dev/null +++ b/test/asm/errors-after-missing-include/a.out @@ -0,0 +1,2 @@ +a.o: errors-after-missing-include/a.asm +a.o: does not exist diff --git a/test/asm/test.sh b/test/asm/test.sh index 5c879603..8a4ffcad 100755 --- a/test/asm/test.sh +++ b/test/asm/test.sh @@ -163,32 +163,39 @@ done # These tests do their own thing -i="continues-after-missing-include" -RGBASMFLAGS="-Weverything -Bcollapse -M - -MG -MC" -# Piping the .asm file to rgbasm would not make sense for dependency generation, -# so just test the normal variant -(( tests++ )) -echo "${bold}${green}${i%.asm}...${rescolors}${resbold}" -"$RGBASM" $RGBASMFLAGS -o "$o" "$i"/a.asm >"$output" 2>"$errput" -fixed_output="$input" -if which cygpath &>/dev/null; then - # MinGW needs the Windows path substituted but with forward slash separators; - # Cygwin has `cygpath` but just needs the original path substituted. - subst1="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')" - subst2="$(printf '%s\n' "$(cygpath -w "$o")" | sed -e 's:\\:/:g' -e 's:[][\/.^$*]:\\&:g')" - sed -e "s/$subst1/a.o/g" -e "s/$subst2/a.o/g" "$output" >"$fixed_output" -else - subst="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')" - sed "s/$subst/a.o/g" "$output" >"$fixed_output" -fi -tryDiff "$i"/a.out "$fixed_output" out -our_rc=$? -tryDiff "$i"/a.err "$errput" err -(( our_rc = our_rc || $? )) -(( rc = rc || our_rc )) -if [[ $our_rc -ne 0 ]]; then - (( failed++ )) -fi +evaluateDepTest () { + i="$1" + RGBASMFLAGS="-Weverything -Bcollapse -M - $2" + # Piping the .asm file to rgbasm would not make sense for dependency generation, + # so just test the normal variant + (( tests++ )) + echo "${bold}${green}${i%.asm}...${rescolors}${resbold}" + "$RGBASM" $RGBASMFLAGS -o "$o" "$i"/a.asm >"$output" 2>"$errput" + + fixed_output="$input" + if which cygpath &>/dev/null; then + # MinGW needs the Windows path substituted but with forward slash separators; + # Cygwin has `cygpath` but just needs the original path substituted. + subst1="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')" + subst2="$(printf '%s\n' "$(cygpath -w "$o")" | sed -e 's:\\:/:g' -e 's:[][\/.^$*]:\\&:g')" + sed -e "s/$subst1/a.o/g" -e "s/$subst2/a.o/g" "$output" >"$fixed_output" + else + subst="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')" + sed "s/$subst/a.o/g" "$output" >"$fixed_output" + fi + + tryDiff "$i"/a.out "$fixed_output" out + our_rc=$? + tryDiff "$i"/a.err "$errput" err + (( our_rc = our_rc || $? )) + + (( rc = rc || our_rc )) + if [[ $our_rc -ne 0 ]]; then + (( failed++ )) + fi +} +evaluateDepTest "continues-after-missing-include" "-MG -MC" +evaluateDepTest "errors-after-missing-include" "-MG" i="state-file" if which cygpath &>/dev/null; then