tests: USE $EXEC and fix ed path - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit c02bf1a70d8dc1e0e7fb3e1a691c012d594ac322
DIR parent 59f7e452709216715949d90bc9ba1872c33bc6b9
HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Tue, 13 Jan 2026 12:11:16 +0100
tests: USE $EXEC and fix ed path
Using an EXEC variable for every test make easy to run tools to
debug issues like for example using EXEC=valgrind ./0025-ed.sh.
Some tests for ed had a wrong path to the ed binary and they
were not testing the actual ed but the system one.
Diffstat:
M tests/0001-echo.sh | 2 +-
M tests/0002-printf.sh | 10 +++++-----
M tests/0003-ed.sh | 2 +-
M tests/0004-ed.sh | 2 +-
M tests/0005-ed.sh | 2 +-
M tests/0006-ed.sh | 2 +-
M tests/0007-ed.sh | 2 +-
M tests/0008-ed.sh | 2 +-
M tests/0009-ed.sh | 2 +-
M tests/0010-bc.sh | 2 +-
M tests/0011-ed.sh | 2 +-
M tests/0012-ed.sh | 2 +-
M tests/0013-ed.sh | 2 +-
M tests/0014-ed.sh | 2 +-
M tests/0015-ed.sh | 2 +-
M tests/0016-ed.sh | 2 +-
M tests/0017-ed.sh | 2 +-
M tests/0018-ed.sh | 2 +-
M tests/0019-ed.sh | 2 +-
M tests/0020-ed.sh | 2 +-
M tests/0021-ed.sh | 2 +-
M tests/0022-ed.sh | 2 +-
M tests/0023-ed.sh | 2 +-
M tests/0024-ed.sh | 2 +-
M tests/0025-ed.sh | 2 +-
25 files changed, 29 insertions(+), 29 deletions(-)
---
DIR diff --git a/tests/0001-echo.sh b/tests/0001-echo.sh
@@ -7,7 +7,7 @@ tmp=tmp1.$$
trap 'rm -f $tmp' EXIT
trap 'exit $?' HUP INT TERM
-../echo -n --hello-- --world--! > $tmp
+$EXEC ../echo -n --hello-- --world--! > $tmp
tr -d '\n' <<'EOF' | diff -u - $tmp
--hello-- --world--!
DIR diff --git a/tests/0002-printf.sh b/tests/0002-printf.sh
@@ -9,14 +9,14 @@ trap 'rm -f $res1 $res2' EXIT
trap 'exit $?' HUP INT TERM
(
- ../printf '123\n'
- ../printf '%d\n'
- ../printf '%b' 'foo\nbar\n'
+ $EXEC ../printf '123\n'
+ $EXEC ../printf '%d\n'
+ $EXEC ../printf '%b' 'foo\nbar\n'
# Two flags used simulatenously, + and 0
- ../printf '%+04d %+4d ' 1 2 3 -400; ../printf "\n"
+ $EXEC ../printf '%+04d %+4d ' 1 2 3 -400; ../printf "\n"
# Missing format specifier; should have sane error message
- ../printf '%000' FOO || echo "Expected failure"
+ $EXEC ../printf '%000' FOO || echo "Expected failure"
) > $res1 2> $res2
diff -u - $res1 <<'EOF'
DIR diff --git a/tests/0003-ed.sh b/tests/0003-ed.sh
@@ -16,7 +16,7 @@ baz
EOF
# Unspecified whether quit with a dirty buffer is considered an error, allow both
-../ed $tmp1 <<EOF >$tmp2 || test $? -eq 1
+$EXEC ../ed $tmp1 <<EOF >$tmp2 || test $? -eq 1
v#^\$#p
p
g/^\$/d
DIR diff --git a/tests/0004-ed.sh b/tests/0004-ed.sh
@@ -9,7 +9,7 @@ trap 'rm -f $tmp1 $tmp2' EXIT
trap 'exit $?' HUP INT TERM
printf foo >$tmp1
-../ed $tmp1 <<EOF >$tmp2
+$EXEC ../ed $tmp1 <<EOF >$tmp2
,p
w
EOF
DIR diff --git a/tests/0005-ed.sh b/tests/0005-ed.sh
@@ -7,7 +7,7 @@ tmp1=tmp1.$$
trap 'rm -f $tmp1' EXIT
trap 'exit $?' HUP INT TERM
-../ed <<EOF >$tmp1
+$EXEC ../ed <<EOF >$tmp1
i
foo
bar
DIR diff --git a/tests/0006-ed.sh b/tests/0006-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | (read a && read b && test $a-$b == 1-2)
+$EXEC ../ed -s /dev/null <<EOF | (read a && read b && test $a-$b == 1-2)
0a
1
2
DIR diff --git a/tests/0007-ed.sh b/tests/0007-ed.sh
@@ -8,6 +8,6 @@ trap 'rm -f $tmp' EXIT
trap 'exit $?' HUP INT TERM
printf 'something important' > $tmp
-../ed -s $tmp <<EOF 2>/dev/null | diff -w $tmp -
+$EXEC ../ed -s $tmp <<EOF 2>/dev/null | diff -w $tmp -
1p
EOF
DIR diff --git a/tests/0008-ed.sh b/tests/0008-ed.sh
@@ -7,7 +7,7 @@ tmp=tmp.$$
trap 'rm -f $tmp' EXIT
trap 'exit $?' HUP INT TERM
-../ed -s <<EOF > /dev/null
+$EXEC ../ed -s <<EOF > /dev/null
0a
This is important
.
DIR diff --git a/tests/0009-ed.sh b/tests/0009-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | (read a && test $a == 1)
+$EXEC ../ed -s /dev/null <<EOF | (read a && test $a == 1)
a
1
2
DIR diff --git a/tests/0010-bc.sh b/tests/0010-bc.sh
@@ -21,7 +21,7 @@ cat <<EOF >$tmp
.48609126058589107690
EOF
-../bc ../bc.library <<EOF | diff -u $tmp -
+$EXEC ../bc ../bc.library <<EOF | diff -u $tmp -
a(0)
a(1)
a(2)
DIR diff --git a/tests/0011-ed.sh b/tests/0011-ed.sh
@@ -12,7 +12,7 @@ x
y
EOF
-../ed -s /dev/null <<EOF | diff -u $tmp -
+$EXEC ../ed -s /dev/null <<EOF | diff -u $tmp -
a
1
2
DIR diff --git a/tests/0012-ed.sh b/tests/0012-ed.sh
@@ -11,7 +11,7 @@ y
/dev/null
EOF
-../ed -s /dev/null <<EOF | diff -u $tmp -
+$EXEC ../ed -s /dev/null <<EOF | diff -u $tmp -
a
1
2
DIR diff --git a/tests/0013-ed.sh b/tests/0013-ed.sh
@@ -11,7 +11,7 @@ y
/dev/null
EOF
-../ed -s /dev/null <<EOF | diff -u $tmp -
+$EXEC ../ed -s /dev/null <<EOF | diff -u $tmp -
a
1
2
DIR diff --git a/tests/0014-ed.sh b/tests/0014-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | (read a && test $a = a)
+$EXEC ../ed -s /dev/null <<EOF | (read a && test $a = a)
a
1
2
DIR diff --git a/tests/0015-ed.sh b/tests/0015-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | grep 'file modified' > /dev/null
+$EXEC ../ed -s /dev/null <<EOF | grep 'file modified' > /dev/null
a
1
2
DIR diff --git a/tests/0016-ed.sh b/tests/0016-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | grep 'file modified' > /dev/null
+$EXEC ../ed -s /dev/null <<EOF | grep 'file modified' > /dev/null
a
1
2
DIR diff --git a/tests/0017-ed.sh b/tests/0017-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | grep 'file modified' > /dev/null
+$EXEC ../ed -s /dev/null <<EOF | grep 'file modified' > /dev/null
a
1
2
DIR diff --git a/tests/0018-ed.sh b/tests/0018-ed.sh
@@ -6,7 +6,7 @@ trap 'rm -f $tmp' EXIT
trap 'exit $?' HUP INT TERM
touch $tmp
-../ed -s $tmp <<EOF | (read a && test $a = 1)
+$EXEC ../ed -s $tmp <<EOF | (read a && test $a = 1)
a
1
.
DIR diff --git a/tests/0019-ed.sh b/tests/0019-ed.sh
@@ -6,7 +6,7 @@ trap 'exit $?' HUP INT TERM
set -e
-../ed -s $tmp <<EOF >/dev/null
+$EXEC ../ed -s $tmp <<EOF >/dev/null
a
1
2
DIR diff --git a/tests/0020-ed.sh b/tests/0020-ed.sh
@@ -6,7 +6,7 @@ trap 'exit $?' HUP INT TERM
set -e
-../ed -s $tmp <<EOF >/dev/null
+$EXEC ../ed -s $tmp <<EOF >/dev/null
a
1
2
DIR diff --git a/tests/0021-ed.sh b/tests/0021-ed.sh
@@ -11,7 +11,7 @@ cat <<EOF >$tmp
3
EOF
-../ed -s /dev/null <<EOF | diff -u $tmp -
+$EXEC ../ed -s /dev/null <<EOF | diff -u $tmp -
a
1
2
DIR diff --git a/tests/0022-ed.sh b/tests/0022-ed.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-../ed -s /dev/null <<EOF | wc -l | grep 0 >/dev/null
+$EXEC ../ed -s /dev/null <<EOF | wc -l | grep 0 >/dev/null
a
line
.
DIR diff --git a/tests/0023-ed.sh b/tests/0023-ed.sh
@@ -9,7 +9,7 @@ cat <<EOF >$tmp
Line
EOF
-ed -s /dev/null <<EOF | diff -u $tmp -
+$EXEC timeout 5 ../ed -s /dev/null <<EOF | diff -u $tmp -
0a
Line
.
DIR diff --git a/tests/0024-ed.sh b/tests/0024-ed.sh
@@ -16,7 +16,7 @@ static int arflag;
EOF
-ed -s /dev/null <<EOF | diff -u $tmp -
+$EXEC ../ed -s /dev/null <<EOF | diff -u $tmp -
a
int radix = 16;
int Pflag;
DIR diff --git a/tests/0025-ed.sh b/tests/0025-ed.sh
@@ -12,7 +12,7 @@ static int gflag = 0;
extern long arflag = 0;
EOF
-../ed -s /dev/null <<'EOF' | diff -u $tmp -
+$EXEC ../ed -s /dev/null <<'EOF' | diff -u $tmp -
i
LLL
.