sbase

suckless unix tools
git clone git://git.suckless.org/sbase
Log | Files | Refs | README | LICENSE

commit c63dd6d49941778ad99fb1f2834f97626a511ccb
parent ae50e31d532df74e97d2e0525d0f282cf3377142
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date:   Mon,  8 Dec 2025 17:30:50 +0100

tests: Remove cleanup functions

Diffstat:
Mtests/0001-echo.sh | 10++--------
Mtests/0002-printf.sh | 10++--------
Mtests/0003-ed.sh | 10++--------
Mtests/0004-ed.sh | 10++--------
Mtests/0005-ed.sh | 10++--------
Mtests/runtests.sh | 10++--------
6 files changed, 12 insertions(+), 48 deletions(-)

diff --git a/tests/0001-echo.sh b/tests/0001-echo.sh @@ -4,14 +4,8 @@ set -e tmp=tmp1.$$ -cleanup() -{ - st=$? - rm -f $tmp - exit $st -} - -trap cleanup EXIT +trap 'rm -f $tmp' EXIT +trap 'rm -f $tmp; kill -KILL $$' HUP INT TERM ../echo -n --hello-- --world--! > $tmp diff --git a/tests/0002-printf.sh b/tests/0002-printf.sh @@ -5,14 +5,8 @@ set -e res1=tmp1.$$ res2=tmp2.$$ -cleanup() -{ - st=$? - rm -f $res1 $res2 - exit $st -} - -trap cleanup EXIT +trap 'rm -f $res1 $res2' EXIT +trap 'rm -f $res1 $res2; kill -KILL $$' HUP INT TERM ( ../printf '123\n' diff --git a/tests/0003-ed.sh b/tests/0003-ed.sh @@ -5,14 +5,8 @@ set -e tmp1=tmp1.$$ tmp2=tmp2.$$ -cleanup() -{ - st=$? - rm -f $tmp1 $tmp2 - exit $st -} - -trap cleanup EXIT +trap 'rm -f $tmp1 $tmp2' EXIT +trap 'rm -f $tmp1 $tmp2; kill -KILL $$' HUP INT TERM cat <<EOF >$tmp1 foo diff --git a/tests/0004-ed.sh b/tests/0004-ed.sh @@ -5,14 +5,8 @@ set -e tmp1=tmp1.$$ tmp2=tmp2.$$ -cleanup() -{ - st=$? - rm -f $tmp1 $tmp2 - exit $st -} - -trap cleanup EXIT +trap 'rm -f $tmp1 $tmp2' EXIT +trap 'rm -f $tmp1 $tmp2; kill -KILL $$' HUP INT TERM printf foo >$tmp1 ../ed $tmp1 <<EOF >$tmp2 diff --git a/tests/0005-ed.sh b/tests/0005-ed.sh @@ -4,14 +4,8 @@ set -e tmp1=tmp1.$$ -cleanup() -{ - st=$? - rm -f $tmp1 - exit $st -} - -trap cleanup EXIT +trap 'rm -f $tmp1' EXIT +trap 'rm -f $tmp1; kill -KILL $$' HUP INT TERM ../ed <<EOF >$tmp1 i diff --git a/tests/runtests.sh b/tests/runtests.sh @@ -2,14 +2,8 @@ export TZ=UTC -cleanup() -{ - st=$? - rm -f test.res - exit $st -} - -trap cleanup EXIT HUP INT TERM +trap 'rm -f test.res' EXIT HUP INT TERM +trap 'rm -f test.res' HUP INT TERM for i in *-*.sh do