<div dir="ltr">"works for me" --- i ran the tests locally with and without this patch, and saw no difference.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 27, 2023 at 5:59 AM Rob Landley <<a href="mailto:rob@landley.net">rob@landley.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I added ls --sort but not the tests for it yet, and I'm trying to clean up<br>
tests/ls.test so each test doesn't have to cd into a subdirectory and cd ..<br>
again at the end, and the _reason_ it's doing this is so "expected" and "actual"<br>
(argument $3 and where the command's output is redirected from, so we can diff<br>
them) aren't in the current directory, and thus don't show up in each ls test's<br>
output. (The "input" file is only created when argument 4 isn't blank, that one<br>
should already be ok?)<br>
<br>
scripts/test.sh sets up generated/testdir/testdir, and uses that middle<br>
directory as the install location for the binaries it's testing, which goes at<br>
the start of the $PATH, and I _think_ I can just move "expected" and "actual" up<br>
into there without too much trouble...<br>
<br>
Except Android's test plumbing doesn't use my scripts/test.sh, just<br>
scripts/runtest.sh, so don't know if ../expected and ../actual from the current<br>
testing directory are allowable there?<br>
<br>
Basically I want to do this:<br>
<br>
--- a/scripts/runtest.sh<br>
+++ b/scripts/runtest.sh<br>
@@ -132,15 +132,15 @@ testing()<br>
return 0<br>
fi<br>
<br>
- echo -ne "$3" > expected<br>
+ echo -ne "$3" > ../expected<br>
[ ! -z "$4" ] && echo -ne "$4" > input || rm -f input<br>
- echo -ne "$5" | ${EVAL:-eval --} "$2" > actual<br>
+ echo -ne "$5" | ${EVAL:-eval --} "$2" > ../actual<br>
RETVAL=$?<br>
<br>
# Catch segfaults<br>
[ $RETVAL -gt 128 ] &&<br>
echo "exited with signal (or returned $RETVAL)" >> actual<br>
- DIFF="$(diff -au${NOSPACE:+w} expected actual)"<br>
+ DIFF="$(cd ..; diff -au${NOSPACE:+w} expected actual)"<br>
[ -z "$DIFF" ] && do_pass || VERBOSE=all do_fail<br>
if ! verbose_has quiet && { [ -n "$DIFF" ] || verbose_has spam; }<br>
then<br>
@@ -150,7 +150,7 @@ testing()<br>
fi<br>
<br>
[ -n "$DIFF" ] && ! verbose_has all && exit 1<br>
- rm -f input expected actual<br>
+ rm -f input ../expected ../actual<br>
<br>
[ -n "$DEBUG" ] && set +x<br>
<br>
<br>
Rob<br>
</blockquote></div>