Share some handling between two tests of rgbasm -M -

This commit is contained in:
Rangi
2025-10-20 20:57:48 -04:00
parent 7462bccb72
commit 400375b2e5
5 changed files with 35 additions and 27 deletions

View File

@@ -1 +0,0 @@
-M /dev/null -MG

View File

@@ -0,0 +1,2 @@
a.o: errors-after-missing-include/a.asm
a.o: does not exist

View File

@@ -163,32 +163,39 @@ done
# These tests do their own thing # These tests do their own thing
i="continues-after-missing-include" evaluateDepTest () {
RGBASMFLAGS="-Weverything -Bcollapse -M - -MG -MC" i="$1"
# Piping the .asm file to rgbasm would not make sense for dependency generation, RGBASMFLAGS="-Weverything -Bcollapse -M - $2"
# so just test the normal variant # Piping the .asm file to rgbasm would not make sense for dependency generation,
(( tests++ )) # so just test the normal variant
echo "${bold}${green}${i%.asm}...${rescolors}${resbold}" (( tests++ ))
"$RGBASM" $RGBASMFLAGS -o "$o" "$i"/a.asm >"$output" 2>"$errput" echo "${bold}${green}${i%.asm}...${rescolors}${resbold}"
fixed_output="$input" "$RGBASM" $RGBASMFLAGS -o "$o" "$i"/a.asm >"$output" 2>"$errput"
if which cygpath &>/dev/null; then
# MinGW needs the Windows path substituted but with forward slash separators; fixed_output="$input"
# Cygwin has `cygpath` but just needs the original path substituted. if which cygpath &>/dev/null; then
subst1="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')" # MinGW needs the Windows path substituted but with forward slash separators;
subst2="$(printf '%s\n' "$(cygpath -w "$o")" | sed -e 's:\\:/:g' -e 's:[][\/.^$*]:\\&:g')" # Cygwin has `cygpath` but just needs the original path substituted.
sed -e "s/$subst1/a.o/g" -e "s/$subst2/a.o/g" "$output" >"$fixed_output" subst1="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')"
else subst2="$(printf '%s\n' "$(cygpath -w "$o")" | sed -e 's:\\:/:g' -e 's:[][\/.^$*]:\\&:g')"
subst="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')" sed -e "s/$subst1/a.o/g" -e "s/$subst2/a.o/g" "$output" >"$fixed_output"
sed "s/$subst/a.o/g" "$output" >"$fixed_output" else
fi subst="$(printf '%s\n' "$o" | sed 's:[][\/.^$*]:\\&:g')"
tryDiff "$i"/a.out "$fixed_output" out sed "s/$subst/a.o/g" "$output" >"$fixed_output"
our_rc=$? fi
tryDiff "$i"/a.err "$errput" err
(( our_rc = our_rc || $? )) tryDiff "$i"/a.out "$fixed_output" out
(( rc = rc || our_rc )) our_rc=$?
if [[ $our_rc -ne 0 ]]; then tryDiff "$i"/a.err "$errput" err
(( failed++ )) (( our_rc = our_rc || $? ))
fi
(( 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" i="state-file"
if which cygpath &>/dev/null; then if which cygpath &>/dev/null; then