aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-19 19:32:43 +0100
committerlemon <lsof@mailbox.org>2026-03-19 19:33:50 +0100
commit05e132851016d566629fcfd279eef025a14ddb32 (patch)
treed30140d50f676052558a3e6b9bf8bcfb0470e8bd /test
parentff143376a7b4ac3b370bd8683d7aeb0b4827a494 (diff)
Shell script changes for portability
Diffstat (limited to 'test')
-rwxr-xr-xtest/all.sh2
-rwxr-xr-xtest/run.sh16
2 files changed, 9 insertions, 9 deletions
diff --git a/test/all.sh b/test/all.sh
index d80db09..00f3f6c 100755
--- a/test/all.sh
+++ b/test/all.sh
@@ -1,4 +1,4 @@
-#!/bin/env sh
+#!/bin/sh
cd $(dirname "$0")
./run.sh
diff --git a/test/run.sh b/test/run.sh
index 485b0a8..ec40161 100755
--- a/test/run.sh
+++ b/test/run.sh
@@ -1,4 +1,4 @@
-#!/bin/env sh
+#!/bin/sh
cd $(dirname "$0")
ANTCC="../antcc $CFLAGS"
@@ -12,24 +12,24 @@ x() {
run() {
ntest=$(( ntest + 1 ))
f="$(basename "$1")"
- expected=build/"$(echo "$f" | sed -s 's/\.c$/.expected/')"
+ expected=build/"$(echo "$f" | sed 's/\.c$/.expected/')"
echo ---- "$f" ---- >> log.txt
mkdir -p build/
args=$(awk '/\/\* ARGS:.*$/ {ORS=" ";for (i=3;i<NF;++i)print $i;ORS="\n";print""}' "$f")
cflags=$(awk '/\/\* CFLAGS:.*$/ {ORS=" ";for (i=3;i<NF;++i)print $i;ORS="\n";print""}' "$f")
if awk '/\/\* EXPECT:$/ {x=k=any=1} x && /\*\// {x=0} x {if (!k)print $0;k=0} END{if(x||!any)exit 1;}' "$f" > "$expected"; then
- obj=build/"$(echo "$f" | sed -s 's/\.c$/.o/')"
- exe=build/"$(echo "$f" | sed -s 's/\.c$//')"
+ obj=build/"$(echo "$f" | sed 's/\.c$/.o/')"
+ exe=build/"$(echo "$f" | sed 's/\.c$//')"
if ! ( x $ANTCC $cflags "$f" -c -o "$obj" && x $ANTCC $cflags "$obj" -o "$exe" ); then
echo !TEST ERROR "$f"
echo !FAILED TO COMPILE
echo '-------'
else
- actual=build/"$(echo "$f" | sed -s 's/\.c$/.actual/')"
+ actual=build/"$(echo "$f" | sed 's/\.c$/.actual/')"
x "$exe" $args > "$actual"
- if [ "$(md5sum < "$actual")" != "$(md5sum < "$expected")" ]; then
+ if ! cmp "$actual" "$expected" > /dev/null; then
echo --- !TEST ERROR "$f"
- diff --unified=0 --color=auto "$expected" "$actual"
+ diff --unified=0 "$expected" "$actual"
echo '-------'
else
npass=$(( npass + 1 ))
@@ -41,7 +41,7 @@ run() {
}
: < /dev/null > log.txt
-tests=$(find . -regex '\./[0-9]+-.*\.c' | sort)
+tests=$(find . | grep -E '\./[0-9]+-.*\.c' | sort)
for test in $tests; do
run $test
done