build: Fix use of trap - scc - simple c99 compiler
HTML git clone git://git.simple-cc.org/scc
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit 6d67d778d8a2bfe2093233d1fae81663f712aa2a
DIR parent c825c03e6f3b1e3a757a47c75d77ce57ebb1624d
HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Sat, 3 Jan 2026 14:14:58 +0100
build: Fix use of trap
Using the same trap for EXIT and signals has the problem that
signals don't finish the current execution. For that reason
is better to use different traps and do the cleaning only in
the EXIT trap while the signals just use exits that eventually
will call the EXIT trap.
Diffstat:
M scripts/mkdep | 4 +++-
M scripts/rules.mk | 38 ++++++++-----------------------
M src/cmd/scc-as/mktbl | 3 ++-
M src/cmd/scc-cc/cc2/Makefile | 4 ++--
M src/libc/arch/mkerrstr | 3 ++-
M tests/ar/execute/0001-append.sh | 16 +++++-----------
M tests/ar/execute/0002-append.sh | 17 ++++++-----------
M tests/ar/execute/0003-append.sh | 16 +++++-----------
M tests/ar/execute/0004-append.sh | 6 ++----
M tests/ar/execute/0005-append.sh | 6 ++----
M tests/ar/execute/0006-append.sh | 8 +++-----
M tests/ar/execute/0007-delete.sh | 4 ++--
M tests/ar/execute/0008-delete.sh | 6 +++---
M tests/ar/execute/0009-delete.sh | 4 ++--
M tests/ar/execute/0010-delete.sh | 4 ++--
M tests/ar/execute/0011-delete.sh | 4 ++--
M tests/ar/execute/0012-delete.sh | 4 ++--
M tests/ar/execute/0013-print.sh | 13 +++++--------
M tests/ar/execute/0014-print.sh | 14 ++++++--------
M tests/ar/execute/0015-print.sh | 14 ++++++--------
M tests/ar/execute/0016-print.sh | 14 ++++++--------
M tests/ar/execute/0017-print.sh | 22 +++++++++++++---------
M tests/ar/execute/0018-list.sh | 13 +++++--------
M tests/ar/execute/0019-list.sh | 14 ++++++--------
M tests/ar/execute/0020-list.sh | 14 ++++++--------
M tests/ar/execute/0021-list.sh | 14 ++++++--------
M tests/ar/execute/0022-list.sh | 41 ++++++++++++-------------------
M tests/ar/execute/0023-extract.sh | 12 ++++--------
M tests/ar/execute/0024-extract.sh | 12 ++++--------
M tests/ar/execute/0025-extract.sh | 12 ++++--------
M tests/ar/execute/0026-extract.sh | 16 +++++++---------
M tests/ar/execute/0027-extract.sh | 22 +++++++++++++---------
M tests/ar/execute/0029-move.sh | 10 ++++------
M tests/ar/execute/0030-move.sh | 10 ++++------
M tests/ar/execute/0031-move.sh | 17 +++++++++++------
M tests/ar/execute/0032-update.sh | 11 ++++-------
M tests/ar/execute/0033-update.sh | 11 ++++-------
M tests/ar/execute/0034-update.sh | 16 +++++-----------
M tests/ar/execute/0035-update.sh | 16 +++++-----------
M tests/ar/execute/0036-update.sh | 16 +++++-----------
M tests/ar/execute/0037-update.sh | 16 +++++-----------
M tests/ar/execute/0038-update.sh | 10 ++++------
M tests/ar/execute/0039-update.sh | 16 +++++-----------
M tests/ar/execute/chktest.sh | 6 +++---
M tests/as/execute/chktest.sh | 5 ++---
M tests/as/execute/test.sh | 1 -
M tests/libc/execute/chktest.sh | 11 +++++++----
M tests/make/error/0001-macro.sh | 14 ++++++--------
M tests/make/error/chktest.sh | 1 -
M tests/make/execute/0001-rule.sh | 10 ++++++----
M tests/make/execute/0002-fflag.sh | 8 +++-----
M tests/make/execute/0003-fflag.sh | 8 +++-----
M tests/make/execute/0004-fflag.sh | 7 +++----
M tests/make/execute/0005-fflag.sh | 8 +++-----
M tests/make/execute/0006-iflag.sh | 14 ++++++--------
M tests/make/execute/0007-iflag.sh | 14 ++++++--------
M tests/make/execute/0008-ignore.sh | 14 ++++++--------
M tests/make/execute/0009-ignore.sh | 16 +++++++---------
M tests/make/execute/0010-kflag.sh | 18 ++++++++----------
M tests/make/execute/0011-kflag.sh | 18 ++++++++----------
M tests/make/execute/0012-nflag.sh | 16 +++++++---------
M tests/make/execute/0013-nflag.sh | 16 +++++++---------
M tests/make/execute/0014-nflag.sh | 12 +++++-------
M tests/make/execute/0015-pflag.sh | 18 ++++++++----------
M tests/make/execute/0016-qflag.sh | 12 +++++-------
M tests/make/execute/0017-qflag.sh | 9 ++++-----
M tests/make/execute/0018-qflag.sh | 14 ++++++--------
M tests/make/execute/0019-qflag.sh | 14 ++++++--------
M tests/make/execute/0020-rflag.sh | 12 +++++-------
M tests/make/execute/0021-rflag.sh | 12 +++++-------
M tests/make/execute/0022-Sflag.sh | 14 ++++++--------
M tests/make/execute/0023-Sflag.sh | 14 ++++++--------
M tests/make/execute/0024-sflag.sh | 12 +++++-------
M tests/make/execute/0025-sflag.sh | 12 +++++-------
M tests/make/execute/0026-silent.sh | 12 +++++-------
M tests/make/execute/0027-silent.sh | 12 +++++-------
M tests/make/execute/0028-tflag.sh | 12 +++++-------
M tests/make/execute/0029-tflag.sh | 3 ++-
M tests/make/execute/0030-tflag.sh | 12 +++++-------
M tests/make/execute/0031-tflag.sh | 12 +++++-------
M tests/make/execute/0032-tflag.sh | 3 ++-
M tests/make/execute/0033-macro.sh | 10 +++++-----
M tests/make/execute/0034-macro.sh | 10 +++++-----
M tests/make/execute/0035-macro.sh | 10 +++++-----
M tests/make/execute/0036-macro.sh | 10 +++++-----
M tests/make/execute/0037-macro.sh | 12 ++++++------
M tests/make/execute/0038-rules.sh | 10 +++++-----
M tests/make/execute/0039-rules.sh | 3 ++-
M tests/make/execute/0040-makefile.sh | 12 +++++-------
M tests/make/execute/0041-comment.sh | 12 ++++++------
M tests/make/execute/0042-comment.sh | 12 ++++++------
M tests/make/execute/0043-comment.sh | 12 ++++++------
M tests/make/execute/0044-macro.sh | 10 +++++-----
M tests/make/execute/0045-comment.sh | 12 +++++-------
M tests/make/execute/0046-makefile.sh | 10 +++++-----
M tests/make/execute/0047-include.sh | 10 +++++-----
M tests/make/execute/0048-include.sh | 14 +++++++-------
M tests/make/execute/0049-rule.sh | 14 ++++++--------
M tests/make/execute/0050-rule.sh | 12 +++++-------
M tests/make/execute/0051-rule.sh | 10 +++++-----
M tests/make/execute/0052-rule.sh | 16 +++++++---------
M tests/make/execute/0053-rule.sh | 16 +++++++---------
M tests/make/execute/0054-rule.sh | 16 +++++++---------
M tests/make/execute/0055-rule.sh | 16 +++++++---------
M tests/make/execute/0056-rule.sh | 10 +++++-----
M tests/make/execute/0057-default.sh | 12 +++++-------
M tests/make/execute/0058-default.sh | 10 +++++-----
M tests/make/execute/0059-macro.sh | 10 +++++-----
M tests/make/execute/0060-macro.sh | 10 +++++-----
M tests/make/execute/0061-macro.sh | 10 +++++-----
M tests/make/execute/0062-macro.sh | 10 +++++-----
M tests/make/execute/0063-macro.sh | 10 +++++-----
M tests/make/execute/0064-macro.sh | 10 +++++-----
M tests/make/execute/0065-macro.sh | 10 +++++-----
M tests/make/execute/0066-macro.sh | 10 +++++-----
M tests/make/execute/0067-macro.sh | 10 +++++-----
M tests/make/execute/0068-macro.sh | 10 +++++-----
M tests/make/execute/0069-macro.sh | 10 +++++-----
M tests/make/execute/0070-macro.sh | 10 +++++-----
M tests/make/execute/0071-macro.sh | 10 +++++-----
M tests/make/execute/0072-macro.sh | 10 +++++-----
M tests/make/execute/0073-macro.sh | 10 +++++-----
M tests/make/execute/0074-macro.sh | 10 +++++-----
M tests/make/execute/0075-macro.sh | 10 +++++-----
M tests/make/execute/0076-macro.sh | 10 +++++-----
M tests/make/execute/0077-macro.sh | 11 +++++++----
M tests/make/execute/0078-macro.sh | 11 +++++++----
M tests/make/execute/0079-macro.sh | 11 +++++++----
M tests/make/execute/0080-rule.sh | 3 ++-
M tests/make/execute/0081-rule.sh | 3 ++-
M tests/make/execute/0082-rule.sh | 12 +++++-------
M tests/make/execute/0083-rule.sh | 9 +++++----
M tests/make/execute/0084-rule.sh | 10 +++++-----
M tests/make/execute/0085-rule.sh | 16 +++++++---------
M tests/make/execute/0086-rule.sh | 16 +++++++---------
M tests/make/execute/0087-rule.sh | 10 +++++-----
M tests/make/execute/0088-comment.sh | 14 ++++++--------
M tests/make/execute/0089-comment.sh | 12 +++++-------
M tests/make/execute/0090-comment.sh | 12 +++++-------
M tests/make/execute/0091-expansion.… | 14 ++++++--------
M tests/make/execute/0092-expansion.… | 14 ++++++--------
M tests/make/execute/0093-inference.… | 18 ++++++++----------
M tests/make/execute/0094-expansion.… | 31 +++++++++++++++----------------
M tests/make/execute/0095-include.sh | 15 +++++++--------
M tests/make/execute/0096-escape.sh | 15 ++++++---------
M tests/make/execute/0097-rule.sh | 16 +++++++---------
M tests/make/execute/0098-signal.sh | 3 +++
M tests/make/execute/0103-env.sh | 14 ++++++--------
M tests/make/execute/0104-env.sh | 14 ++++++--------
M tests/make/execute/0105-include.sh | 14 ++++++--------
M tests/make/execute/0106-inference.… | 14 ++++++--------
M tests/make/execute/0107-inference.… | 14 ++++++--------
M tests/make/execute/0108-lastopt.sh | 18 ++++++++----------
M tests/make/execute/chktest.sh | 1 -
M tests/nm/execute/0001-z80.sh | 11 +++++------
M tests/nm/execute/0002-z80-u.sh | 11 +++++------
M tests/nm/execute/0003-z80-g.sh | 11 +++++------
M tests/nm/execute/0004-z80-v.sh | 11 +++++------
M tests/nm/execute/0005-z80-A.sh | 11 +++++------
M tests/nm/execute/0006-z80-o.sh | 11 +++++------
M tests/nm/execute/0007-z80-d.sh | 11 +++++------
M tests/nm/execute/0008-z80-x.sh | 11 +++++------
M tests/nm/execute/0009-z80-P-o.sh | 11 +++++------
M tests/nm/execute/0010-z80-P-d.sh | 11 +++++------
M tests/nm/execute/0011-z80-P-x.sh | 11 +++++------
M tests/nm/execute/0012-z80-f.sh | 10 ++++------
M tests/nm/execute/0013-z80-a.sh | 11 +++++------
M tests/nm/execute/chktest.sh | 6 ++----
M tests/size/execute/0001-z80.sh | 11 +++++------
M tests/size/execute/0002-z80-t.sh | 11 +++++------
M tests/size/execute/chktest.sh | 6 ++----
M tests/strip/execute/0001-z80.sh | 13 ++++++-------
M tests/strip/execute/chktest.sh | 6 ++----
173 files changed, 892 insertions(+), 1118 deletions(-)
---
DIR diff --git a/scripts/mkdep b/scripts/mkdep
@@ -2,8 +2,10 @@
set -e
+trap 'rm -f $tmp' EXIT
+trap 'exit 1' HUP INT TERM
+
tmp=$$.tmp
-trap "rm -f $tmp" EXIT INT TERM HUP
(cat Makefile
printf "\n#deps\n"
DIR diff --git a/scripts/rules.mk b/scripts/rules.mk
@@ -133,48 +133,28 @@ $(DIRS) DUMMY : FORCE
$(OC) -O binary $< $@
.o.dump:
- trap "rm -f $$$$.eps" EXIT QUIT INT TERM;\
+ trap "rm -f $$$$.dump" EXIT;\
+ trap "exit 1" HUP INT TERM;\
$(OD) -D $< > $$$$.dump && mv $$$$.dump $@
.elf.map:
- trap "rm -f $$$$.eps" EXIT QUIT INT TERM;\
$(LD) -Map=$@ $< -o /dev/null
.puml.eps:
- trap "rm -f $$$$.eps" EXIT QUIT INT TERM;\
+ trap "rm -f $$$$.eps" EXIT;\
+ trap "exit 1" HUP INT TERM;\
plantuml -p -teps < $< > $$$$.eps && mv $$$$.eps $@
.ms.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
+ trap "rm -f $$$$.ps" EXIT;\
+ trap "exit 1" HUP INT TERM;\
$(SOELIM) $< | $(GRAP) | $(PIC) | $(EQN) | $(TBL) |\
$(TROFF) -ms | $(DPOST) > $$$$.ps &&\
mv $$$$.ps $@
-.1.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
- $(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
-
-.2.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
- $(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
-
-.3.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
- $(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
-
-.4.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
- $(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
-
-.5.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
- $(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
-
-.6.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
- $(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
-.7.ps:
- trap "rm -f $$$$.ps" EXIT QUIT INT TERM;\
+.1.ps .2.ps .3.ps .4.ps .5.ps .6.ps .7.ps:
+ trap "rm -f $$$$.ps" EXIT;\
+ trap "exit 1" HUP INT TERM;\
$(TBL) $< | $(TROFF) -man | $(DPOST) > $$$$.ps && mv $$$$.ps $@
.ps.pdf:
DIR diff --git a/src/cmd/scc-as/mktbl b/src/cmd/scc-as/mktbl
@@ -20,7 +20,8 @@ do
done
rm -f $$.c $family/${cpu}tbl.c
-trap "rm -f $$.c" 0 2 3
+trap "rm -f $$.c" EXIT
+trap "exit 1" HUP INT TERM
awk '!/^$/ {print $1,NR,$2,$3,$4,$5,$6}' ops.dat |
sort -k1 -k2n |
DIR diff --git a/src/cmd/scc-cc/cc2/Makefile b/src/cmd/scc-cc/cc2/Makefile
@@ -61,8 +61,8 @@ qbe_amd64-sysv: amd64-sysv
qbe_arm64-sysv: arm64-sysv
error.h: cc2.h
- rm -f $@;\
- trap 'rm -f $$$$.h' EXIT INT QUIT TERM HUP;\
+ trap 'rm -f $$$$.h' EXIT;\
+ trap 'exit 1' HUP INT TERM;\
awk -f generror.awk cc2.h > $$$$.h && mv $$$$.h $@
cc2-qbe_amd64-sysv: $(LIBSCC) $(QBE_AMD64_SYSV_OBJS)
DIR diff --git a/src/libc/arch/mkerrstr b/src/libc/arch/mkerrstr
@@ -1,6 +1,7 @@
#!/bin/sh
-trap 'rm -f $$.tmp' EXIT HUP INT QUIT TERM
+trap 'rm -f $$.tmp' EXIT
+trap 'exit 1' HUP INT TERM
awk '
/^#define[ \t]*E/{
DIR diff --git a/tests/ar/execute/0001-append.sh b/tests/ar/execute/0001-append.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
###########################################################################
#Append generated files at once to an empty archive
@@ -18,21 +18,15 @@ rm -f file.a
$EXEC scc ar -qv file.a file1 file2 file3
$EXEC scc ar -t file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file1
file2
file3
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -p file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
Second
Third
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0002-append.sh b/tests/ar/execute/0002-append.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
###########################################################################
#Append generated files one by one to an empty file
@@ -18,22 +18,17 @@ rm -f file.a
$EXEC scc ar -qv file.a file1
$EXEC scc ar -qv file.a file2
$EXEC scc ar -qv file.a file3
-$EXEC scc ar -t file.a > $tmp1
-cat <<EOF > $tmp2
+$EXEC scc ar -t file.a > $tmp1
+diff -u $tmp1 - <<EOF
file1
file2
file3
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -p file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
Second
Third
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0003-append.sh b/tests/ar/execute/0003-append.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* f1 f2 f3 $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
###########################################################################
#Append generated files at once to an existing archive
@@ -18,21 +18,15 @@ cp master.a file.a
$EXEC scc ar -qv file.a file-1 file-2 file-3
$EXEC scc ar -t file.a file-1 file-2 file-3 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file-1
file-2
file-3
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -p file.a file-1 file-2 file-3 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
Second
Third
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0004-append.sh b/tests/ar/execute/0004-append.sh
@@ -2,10 +2,8 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-
-trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
###########################################################################
#empty file list
DIR diff --git a/tests/ar/execute/0005-append.sh b/tests/ar/execute/0005-append.sh
@@ -2,10 +2,8 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-
-trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
###########################################################################
#empty file list
DIR diff --git a/tests/ar/execute/0006-append.sh b/tests/ar/execute/0006-append.sh
@@ -2,13 +2,11 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-
-trap "rm -f file.a f1 f2 f3 $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
###########################################################################
-#empty file list
+#recursive inclusion
rm -f file.a
$EXEC scc ar -qv file.a file.a
DIR diff --git a/tests/ar/execute/0007-delete.sh b/tests/ar/execute/0007-delete.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-
set -e
-trap "rm -f file.a" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#delete one member
DIR diff --git a/tests/ar/execute/0008-delete.sh b/tests/ar/execute/0008-delete.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-
set -e
-trap "rm -f file.a" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#delete two members, 1st and 2nd
@@ -14,6 +14,6 @@ $EXEC scc ar -dv file.a file1 file2
if $EXEC scc ar -tv file.a file1 file2
then
- echo file-1 or file-2 were not deleted >&2
+ echo file1 or file2 were not deleted >&2
exit 1
fi
DIR diff --git a/tests/ar/execute/0009-delete.sh b/tests/ar/execute/0009-delete.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-
set -e
-trap "rm -f file.a" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#delete two members, 2nd and 3rd
DIR diff --git a/tests/ar/execute/0010-delete.sh b/tests/ar/execute/0010-delete.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-
set -e
-trap "rm -f file.a" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#remove all the members
DIR diff --git a/tests/ar/execute/0011-delete.sh b/tests/ar/execute/0011-delete.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-
set -e
-trap "rm -f file.a" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#no members
DIR diff --git a/tests/ar/execute/0012-delete.sh b/tests/ar/execute/0012-delete.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-
set -e
-trap "rm -f file.a" 0 2 3 15
+trap 'rm -f file.a' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#delete one member
DIR diff --git a/tests/ar/execute/0013-print.sh b/tests/ar/execute/0013-print.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#print 1st member
@@ -13,11 +13,8 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
cp master.a file.a
$EXEC scc ar -p file.a file1 > $tmp1
-
-cat <<! > $tmp2
+diff $tmp1 - <<EOF
This is the first file,
and it should go in the
first position in the archive.
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0014-print.sh b/tests/ar/execute/0014-print.sh
@@ -2,21 +2,19 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#print 3rd member
cp master.a file.a
-$EXEC scc ar -p file.a file3 > $tmp1
-cat <<! > $tmp2
+$EXEC scc ar -p file.a file3 > $tmp1
+diff -u $tmp1 - <<EOF
and at the end, this is the last file
that should go at the end of the file,
thus it should go in the third position.
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0015-print.sh b/tests/ar/execute/0015-print.sh
@@ -2,24 +2,22 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#print 2nd member with verbose
cp master.a file.a
-$EXEC scc ar -pv file.a file2 >$tmp1
-cat <<! > $tmp2
+$EXEC scc ar -pv file.a file2 >$tmp1
+diff -u $tmp1 - <<EOF
<file2>
But this other one is the second one,
and it shouldn't go in the first position
because it should go in the second position.
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0016-print.sh b/tests/ar/execute/0016-print.sh
@@ -2,18 +2,18 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#print all members
cp master.a file.a
-$EXEC scc ar -p file.a file1 file2 file3 >$tmp1
-cat <<! > $tmp2
+$EXEC scc ar -p file.a file1 file2 file3 >$tmp1
+diff $tmp1 - <<EOF
This is the first file,
and it should go in the
first position in the archive.
@@ -23,6 +23,4 @@ because it should go in the second position.
and at the end, this is the last file
that should go at the end of the file,
thus it should go in the third position.
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0017-print.sh b/tests/ar/execute/0017-print.sh
@@ -2,17 +2,23 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+cleanup()
+{
+ st=$?
+ rm -f file.a $tmp1 $tmp2
+ exit $st
+}
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-#and now with no members in command line
+tmp1=tmp1.$$
+#and now with no members in command line
cp master.a file.a
-$EXEC scc ar -p file.a > $tmp1
-cat <<! > $tmp2
+$EXEC scc ar -p file.a > $tmp1
+diff -u $tmp1 - <<EOF
This is the first file,
and it should go in the
first position in the archive.
@@ -22,6 +28,4 @@ because it should go in the second position.
and at the end, this is the last file
that should go at the end of the file,
thus it should go in the third position.
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0018-list.sh b/tests/ar/execute/0018-list.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#list 1st member
@@ -13,9 +13,6 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
cp master.a file.a
$EXEC scc ar -t file.a file1 > $tmp1
-
-cat <<! > $tmp2
+diff -u $tmp1 - <<EOF
file1
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0019-list.sh b/tests/ar/execute/0019-list.sh
@@ -2,19 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=`mktemp`
############################################################################
#print 3rd member
cp master.a file.a
-$EXEC scc ar -t file.a file3 > $tmp1
-cat <<! > $tmp2
+$EXEC scc ar -t file.a file3 > $tmp1
+diff -u $tmp1 - <<EOF
file3
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0020-list.sh b/tests/ar/execute/0020-list.sh
@@ -2,19 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#print 2nd member with verbose
cp master.a file.a
-$EXEC scc ar -tv file.a file2 >$tmp1
-cat <<! > $tmp2
+$EXEC scc ar -tv file.a file2 >$tmp1
+diff $tmp1 - <<EOF
rw-r--r-- `id -u`/`id -g` Tue Jan 1 00:00:00 1980 file2
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0021-list.sh b/tests/ar/execute/0021-list.sh
@@ -2,21 +2,19 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#print all members
cp master.a file.a
-$EXEC scc ar -t file.a file1 file2 file3 >$tmp1
-cat <<! > $tmp2
+$EXEC scc ar -t file.a file1 file2 file3 >$tmp1
+diff -u $tmp1 - <<EOF
file1
file2
file3
-!
-
-cmp $tmp1 $tmp2
+EOF
DIR diff --git a/tests/ar/execute/0022-list.sh b/tests/ar/execute/0022-list.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#list 1st member
@@ -13,50 +13,41 @@ trap "rm -f file.a $tmp1 $tmp2" 0 2 3 15
cp master.a file.a
$EXEC scc ar -t file.a file1 > $tmp1
-
-cat <<! > $tmp2
+diff -u $tmp1 - <<EOF
file1
-!
-
-cmp $tmp1 $tmp2
+EOF
############################################################################
#print 3rd member
$EXEC scc ar -t file.a file3 > $tmp1
-
-cat <<! > $tmp2
+diff -u $tmp1 - <<EOF
file3
-!
-
-cmp $tmp1 $tmp2
+EOF
############################################################################
#print 2nd member with verbose
$EXEC scc ar -tv file.a file2 >$tmp1
-
-cat <<! > $tmp2
+diff -u $tmp1 - <<EOF
rw-r--r-- `id -u`/`id -g` Tue Jan 1 00:00:00 1980 file2
-!
-
-cmp $tmp1 $tmp2
+EOF
############################################################################
#print all members
$EXEC scc ar -t file.a file1 file2 file3 >$tmp1
-
-cat <<! > $tmp2
+diff -u $tmp1 - <<EOF
file1
file2
file3
-!
-
-cmp $tmp1 $tmp2
+EOF
#and now with no members in command line
$EXEC scc ar -t file.a > $tmp1
-
-cmp $tmp1 $tmp2
+diff -u $tmp1 - <<EOF
+file1
+file2
+file3
+EOF
DIR diff --git a/tests/ar/execute/0023-extract.sh b/tests/ar/execute/0023-extract.sh
@@ -2,21 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file*' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#extract 1st member
cp master.a file.a
-$EXEC scc ar -xv file.a file1
-cat <<EOF > $tmp1
+$EXEC scc ar -xv file.a file1
+diff -u file1 - <<EOF
This is the first file,
and it should go in the
first position in the archive.
EOF
-
-cmp file1 $tmp1
DIR diff --git a/tests/ar/execute/0024-extract.sh b/tests/ar/execute/0024-extract.sh
@@ -2,21 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file*' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#extract 3rd member
cp master.a file.a
-$EXEC scc ar -xv file.a file3
-cat <<EOF > $tmp1
+$EXEC scc ar -xv file.a file3
+diff -u file3 - <<EOF
and at the end, this is the last file
that should go at the end of the file,
thus it should go in the third position.
EOF
-
-cmp file3 $tmp1
DIR diff --git a/tests/ar/execute/0025-extract.sh b/tests/ar/execute/0025-extract.sh
@@ -2,21 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file*' EXIT
+trap 'exit 1' HUP INT TERM
############################################################################
#extract 3rd member
cp master.a file.a
-$EXEC scc ar -xv file.a file3
-cat <<EOF > $tmp1
+$EXEC scc ar -xv file.a file3
+diff -u file3 - <<EOF
and at the end, this is the last file
that should go at the end of the file,
thus it should go in the third position.
EOF
-
-cmp file3 $tmp1
DIR diff --git a/tests/ar/execute/0026-extract.sh b/tests/ar/execute/0026-extract.sh
@@ -2,18 +2,20 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#extract all members
cp master.a file.a
+
$EXEC scc ar -xv file.a file1 file2 file3
+cat file1 file2 file3 > $tmp1
-cat <<EOF > $tmp1
+diff -u $tmp1 - <<EOF
This is the first file,
and it should go in the
first position in the archive.
@@ -25,12 +27,8 @@ that should go at the end of the file,
thus it should go in the third position.
EOF
-cat file1 file2 file3 > $tmp2
-
-cmp $tmp1 $tmp2
-
if test `ls file? | wc -l` -ne 3
then
echo some error extracting files
- exit
+ exit 1
fi
DIR diff --git a/tests/ar/execute/0027-extract.sh b/tests/ar/execute/0027-extract.sh
@@ -2,10 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+cleanup()
+{
+ st=$?
+ rm -f file* $tmp1 $tmp2
+ exit $st
+}
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
############################################################################
#extract without parameters
@@ -13,7 +20,8 @@ trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
cp master.a file.a
$EXEC scc ar -xv file.a
-cat <<EOF > $tmp1
+cat file1 file2 file3 > $tmp1
+diff -u $tmp1 - <<EOF
This is the first file,
and it should go in the
first position in the archive.
@@ -25,12 +33,8 @@ that should go at the end of the file,
thus it should go in the third position.
EOF
-cat file1 file2 file3 > $tmp2
-
-cmp $tmp1 $tmp2
-
if test `ls file? | wc -l` -ne 3
then
echo some error extracting files
- exit
+ exit 1
fi
DIR diff --git a/tests/ar/execute/0029-move.sh b/tests/ar/execute/0029-move.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#move 1st without specifier
@@ -14,10 +14,8 @@ cp master.a file.a
$EXEC scc ar -mv file.a file1
$EXEC scc ar -t file.a > $tmp1
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file2
file3
file1
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0030-move.sh b/tests/ar/execute/0030-move.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#move 1st at the end
@@ -14,10 +14,8 @@ cp master.a file.a
$EXEC scc ar -mv -a file3 file.a file1
$EXEC scc ar -t file.a > $tmp1
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file2
file3
file1
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0031-move.sh b/tests/ar/execute/0031-move.sh
@@ -2,10 +2,17 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+cleanup()
+{
+ st=$?
+ rm -f file* $tmp1 $tmp2
+ exit $st
+}
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
############################################################################
#and now, test without parameters
@@ -14,10 +21,8 @@ cp master.a file.a
$EXEC scc ar -mv file.a
$EXEC scc ar -t file.a > $tmp1
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file1
file2
file3
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0032-update.sh b/tests/ar/execute/0032-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that already exist
@@ -16,9 +16,6 @@ cp master.a file.a
$EXEC scc ar -rv file.a file1
$EXEC scc ar -p file.a file1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0033-update.sh b/tests/ar/execute/0033-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that doesn't exist
@@ -16,9 +16,6 @@ cp master.a file.a
$EXEC scc ar -rv file.a file-1
$EXEC scc ar -p file.a file-1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0034-update.sh b/tests/ar/execute/0034-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that exists and using -a
@@ -16,19 +16,13 @@ cp master.a file.a
$EXEC scc ar -rv -a file1 file.a file1
$EXEC scc ar -p file.a file1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -t file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file1
file2
file3
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0035-update.sh b/tests/ar/execute/0035-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that exists and using -b
@@ -16,19 +16,13 @@ cp master.a file.a
$EXEC scc ar -rv -b file1 file.a file1
$EXEC scc ar -p file.a file1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -t file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file1
file2
file3
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0036-update.sh b/tests/ar/execute/0036-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that doesn't exist and using -b
@@ -16,20 +16,14 @@ cp master.a file.a
$EXEC scc ar -rv -b file1 file.a file-1
$EXEC scc ar -p file.a file-1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -t file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file-1
file1
file2
file3
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0037-update.sh b/tests/ar/execute/0037-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that doesn't exist and using -a
@@ -16,20 +16,14 @@ cp master.a file.a
$EXEC scc ar -rv -a file1 file.a file-1
$EXEC scc ar -p file.a file-1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-cmp $tmp1 $tmp2
-
$EXEC scc ar -t file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file1
file-1
file2
file3
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0038-update.sh b/tests/ar/execute/0038-update.sh
@@ -2,11 +2,12 @@
set -e
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
tmp1=`mktemp`
tmp2=`mktemp`
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
-
############################################################################
#Update without parameters
@@ -14,11 +15,8 @@ cp master.a file.a
$EXEC scc ar -rv file.a
$EXEC scc ar -t file.a > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
file1
file2
file3
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/0039-update.sh b/tests/ar/execute/0039-update.sh
@@ -2,10 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f file* $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
-trap "rm -f file* $tmp1 $tmp2" 0 2 3 15
+tmp1=tmp1.$$
############################################################################
#Update one member that already exist
@@ -18,21 +18,15 @@ touch file1
$EXEC scc ar -ruv file.a file1
$EXEC scc ar -p file.a file1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-cmp $tmp1 $tmp2
-
echo Second > file1
touch -t 197001010000 file1
$EXEC scc ar -ruv file.a file1
$EXEC scc ar -p file.a file1 > $tmp1
-
-cat <<EOF > $tmp2
+diff -u $tmp1 - <<EOF
First
EOF
-
-cmp $tmp1 $tmp2
DIR diff --git a/tests/ar/execute/chktest.sh b/tests/ar/execute/chktest.sh
@@ -1,9 +1,9 @@
#!/bin/sh
-trap "rm -rf file*" EXIT HUP INT QUIT TERM
-ulimit -c 0
+trap "rm -rf file*" EXIT
+trap "exit 1" HUP INT TERM
+
rm -f test.log
-rm -rf file*
export TZ=${TZ:-UTC}
DIR diff --git a/tests/as/execute/chktest.sh b/tests/as/execute/chktest.sh
@@ -1,12 +1,11 @@
#!/bin/sh
-ulimit -c 0
rm -f test.log
for i in *.s
do
cpu="${i%.s}"
printf "Test: %s\n\n" $cpu >> test.log
- ./test.sh $cpu && printf '[PASS]\t' || printf '[FAIL]\t'
- printf 'testing cpu=%s\n' "$cpu"
+ (./test.sh $cpu >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
+ echo testing cpu=$cpu) | tee -a test.log
done
DIR diff --git a/tests/as/execute/test.sh b/tests/as/execute/test.sh
@@ -40,5 +40,4 @@ sed -n '/^data:/,$ {
}' |
nl -b a > $tmp2
-echo diff
diff -u $tmp1 $tmp2
DIR diff --git a/tests/libc/execute/chktest.sh b/tests/libc/execute/chktest.sh
@@ -1,12 +1,15 @@
#!/bin/sh
file=${1?' empty input file'}
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f *.o $tmp1 $tmp2" EXIT INT QUIT TERM
-ulimit -c 0
+
+trap 'rm -f *.o $tmp1 $tmp2' EXIT
+trap 'exit 1' INT QUIT TERM
+
rm -f test.log
+tmp1=tmp1.$$
+tmp2=tmp2.$$
+
while read i state
do
rm -f *.o $i $tmp1 $tmp2
DIR diff --git a/tests/make/error/0001-macro.sh b/tests/make/error/0001-macro.sh
@@ -1,15 +1,11 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' INT TERM HUP
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-make: error: <stdin>:5: missing target
-EOF
-
-scc make -f - <<'EOF' > $tmp2 2>&1
+scc make -f - <<'EOF' > $tmp1 2>&1
FLAGS=Hello $(EFLAGS)
all: $(DIRS)
@echo Hello World
@@ -20,4 +16,6 @@ $(DIRS): FORCE
FORCE:
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+make: error: <stdin>:5: missing target
+EOF
DIR diff --git a/tests/make/error/chktest.sh b/tests/make/error/chktest.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-ulimit -c 0
rm -f test.log
for i in *-*.sh
DIR diff --git a/tests/make/execute/0001-rule.sh b/tests/make/execute/0001-rule.sh
@@ -1,10 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
tmp1=tmp1.$$
-tmp2=tmp2.$$
scc make hello > $tmp1 2>&1
-echo Hello World! > $tmp2
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0002-fflag.sh b/tests/make/execute/0002-fflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
scc make -f test.mk print-cc print-makeflags > $tmp1 2>&1
-cat <<EOF > $tmp2
+diff $tmp1 - <<EOF
c99
EOF
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0003-fflag.sh b/tests/make/execute/0003-fflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
scc make -ftest.mk print-cc print-makeflags > $tmp1 2>&1
-cat <<EOF > $tmp2
+diff $tmp1 - <<EOF
c99
EOF
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0004-fflag.sh b/tests/make/execute/0004-fflag.sh
@@ -1,15 +1,14 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
MAKEFLAGS=-fff.mk scc make -f test.mk print-cc print-makeflags > $tmp1 2>&1
-cat <<EOF > $tmp2
+diff $tmp1 - <<EOF
c99
EOF
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0005-fflag.sh b/tests/make/execute/0005-fflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
MAKEFLAGS=ffff.mk scc make -f test.mk print-cc print-makeflags > $tmp1 2>&1
-cat <<EOF > $tmp2
+diff $tmp1 - <<EOF
c99
EOF
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0006-iflag.sh b/tests/make/execute/0006-iflag.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat <<EOF > $tmp2
+scc make -if test.mk error print-makeflags 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
no-valid-program
sh: no-valid-program: not found
-i
EOF
-
-scc make -if test.mk error print-makeflags 2>&1 |
-sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0007-iflag.sh b/tests/make/execute/0007-iflag.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat <<EOF > $tmp2
+MAKEFLAGS=-i scc make -f test.mk error print-makeflags 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
no-valid-program
sh: no-valid-program: not found
-i
EOF
-
-MAKEFLAGS=-i scc make -f test.mk error print-makeflags 2>&1 |
-sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0008-ignore.sh b/tests/make/execute/0008-ignore.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat <<EOF > $tmp2
+scc make -f test.mk ignored-error hello 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
no-valid-program
sh: no-valid-program: not found
Hello World!
EOF
-
-scc make -f test.mk ignored-error hello 2>&1 |
-sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0009-ignore.sh b/tests/make/execute/0009-ignore.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat <<EOF > $tmp2
-no-valid-program
-sh: no-valid-program: not found
-make: error: don't know how to make hello
-EOF
(scc make -f - error hello 2>&1 |
sed 's/sh:.*: *no-/sh: no-/' > $tmp1) <<EOF
@@ -19,4 +13,8 @@ error:
no-valid-program
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+no-valid-program
+sh: no-valid-program: not found
+make: error: don't know how to make hello
+EOF
DIR diff --git a/tests/make/execute/0010-kflag.sh b/tests/make/execute/0010-kflag.sh
@@ -1,11 +1,16 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat <<EOF > $tmp2
+(set -e
+ scc make -kf test.mk print-makeflags follow
+ echo fail) 2>&1 |
+sed 's/:.*: *no-/: no-/' > $tmp1
+
+diff $tmp1 - <<EOF
-k
no-valid-program
sh: no-valid-program: not found
@@ -13,10 +18,3 @@ make: warning: target error: error 32512
Hello World!
make: warning: target follow not remade because of errors
EOF
-
-(set -e
- scc make -kf test.mk print-makeflags follow
- echo fail) 2>&1 |
-sed 's/:.*: *no-/: no-/' > $tmp1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0011-kflag.sh b/tests/make/execute/0011-kflag.sh
@@ -1,11 +1,16 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat <<EOF > $tmp2
+(set -e
+ MAKEFLAGS=-k scc make -f test.mk print-makeflags follow
+ echo fail) 2>&1 |
+sed 's/:.*: *no-/: no-/' > $tmp1
+
+diff $tmp1 - <<EOF
-k
no-valid-program
sh: no-valid-program: not found
@@ -13,10 +18,3 @@ make: warning: target error: error 32512
Hello World!
make: warning: target follow not remade because of errors
EOF
-
-(set -e
- MAKEFLAGS=-k scc make -f test.mk print-makeflags follow
- echo fail) 2>&1 |
-sed 's/:.*: *no-/: no-/' > $tmp1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0012-nflag.sh b/tests/make/execute/0012-nflag.sh
@@ -1,18 +1,16 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT QUIT INT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat <<EOF > $tmp2
-echo -n
-no-valid-program
-correct
-EOF
(set -e
scc make -f test.mk -n print-makeflags error
echo correct) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+echo -n
+no-valid-program
+correct
+EOF
DIR diff --git a/tests/make/execute/0013-nflag.sh b/tests/make/execute/0013-nflag.sh
@@ -1,18 +1,16 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT QUIT INT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat <<EOF > $tmp2
-echo -n
-no-valid-program
-correct
-EOF
(set -e
MAKEFLAGS=-n scc make -f test.mk print-makeflags error
echo correct) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+echo -n
+no-valid-program
+correct
+EOF
DIR diff --git a/tests/make/execute/0014-nflag.sh b/tests/make/execute/0014-nflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT QUIT INT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat <<EOF > $tmp2
+scc make -nf test.mk print-hidden-hello > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
echo Hello World!
Hello World!
EOF
-
-scc make -nf test.mk print-hidden-hello > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0015-pflag.sh b/tests/make/execute/0015-pflag.sh
@@ -1,13 +1,18 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
unset MAKEFLAGS
-(cat > $tmp2) <<'EOF'
+(scc make -pf - all | grep -v MAKE > $tmp1 2>&1) <<'EOF'
+all:
+ @echo hello
+EOF
+
+diff -u $tmp1 - <<'EOF'
FC = fort77
YFLAGS =
ARFLAGS = -rv
@@ -72,10 +77,3 @@ all:
chmod a+x $@
EOF
-
-(scc make -pf - all | grep -v MAKE > $tmp1 2>&1) <<'EOF'
-all:
- @echo hello
-EOF
-
-diff -u $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0016-qflag.sh b/tests/make/execute/0016-qflag.sh
@@ -1,16 +1,14 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp3.$$
-
-cat > $tmp2 <<EOF
-pass
-EOF
(set -e
scc make -qf test.mk test.mk
echo pass) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+pass
+EOF
DIR diff --git a/tests/make/execute/0017-qflag.sh b/tests/make/execute/0017-qflag.sh
@@ -1,14 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp3.$$
-
-touch $tmp2
(set -e
scc make -qf test.mk error
echo fail) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+EOF
DIR diff --git a/tests/make/execute/0018-qflag.sh b/tests/make/execute/0018-qflag.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
--q
-pass
-EOF
(set -e
scc make -qf test.mk print-makeflags-always
echo pass) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+-q
+pass
+EOF
DIR diff --git a/tests/make/execute/0019-qflag.sh b/tests/make/execute/0019-qflag.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
--q
-pass
-EOF
(set -e
MAKEFLAGS=-q scc make -f test.mk print-makeflags-always
echo pass) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+-q
+pass
+EOF
DIR diff --git a/tests/make/execute/0020-rflag.sh b/tests/make/execute/0020-rflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file.c file.o' EXIT QUIT INT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp2 <<EOF
+scc make -rf test.mk file.o print-makeflags > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
-r
EOF
touch file.c
-
-scc make -rf test.mk file.o print-makeflags > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0021-rflag.sh b/tests/make/execute/0021-rflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file.c file.o' EXIT QUIT INT TERM HUP
+trap 'rm -f $tmp1 file.c file.o' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp2 <<EOF
--r
-EOF
touch file.c
-
MAKEFLAGS=-r scc make -f test.mk file.o print-makeflags > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+-r
+EOF
DIR diff --git a/tests/make/execute/0022-Sflag.sh b/tests/make/execute/0022-Sflag.sh
@@ -1,18 +1,16 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp2 <<EOF
+MAKEFLAGS=-k scc make -Sf test.mk print-makeflags follow 2>&1 |
+sed 's/:.*: no-/: no-/' > $tmp1
+
+diff $tmp1 - <<EOF
-k -S
no-valid-program
sh: no-valid-program: not found
make: error: target error: error 32512
EOF
-
-MAKEFLAGS=-k scc make -Sf test.mk print-makeflags follow 2>&1 |
-sed 's/:.*: no-/: no-/' > $tmp1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0023-Sflag.sh b/tests/make/execute/0023-Sflag.sh
@@ -1,11 +1,14 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp2 <<EOF
+MAKEFLAGS=-S scc make -kf test.mk print-makeflags follow 2>&1 |
+sed 's/:.*: *no-/: no-/' > $tmp1
+
+diff $tmp1 - <<EOF
-S -k
no-valid-program
sh: no-valid-program: not found
@@ -13,8 +16,3 @@ make: warning: target error: error 32512
Hello World!
make: warning: target follow not remade because of errors
EOF
-
-MAKEFLAGS=-S scc make -kf test.mk print-makeflags follow 2>&1 |
-sed 's/:.*: *no-/: no-/' > $tmp1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0024-sflag.sh b/tests/make/execute/0024-sflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat >$tmp2 <<EOF
+scc make -sf test.mk print-makeflags echo-hello > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
-s
Hello World!
EOF
-
-scc make -sf test.mk print-makeflags echo-hello > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0025-sflag.sh b/tests/make/execute/0025-sflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat >$tmp2 <<EOF
+MAKEFLAGS=-s scc make -f test.mk print-makeflags echo-hello > $tmp1 2>&1
+
+diff $tmp1 - <<EOF
-s
Hello World!
EOF
-
-MAKEFLAGS=-s scc make -f test.mk print-makeflags echo-hello > $tmp1 2>&1
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/make/execute/0026-silent.sh b/tests/make/execute/0026-silent.sh
@@ -1,14 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-Hello World!
-EOF
scc make -f test.mk silent-echo-hello >$tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0027-silent.sh b/tests/make/execute/0027-silent.sh
@@ -1,13 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-Hello World!
-EOF
scc make -f - <<EOF > $tmp1 2>&1
.SILENT:
@@ -16,4 +12,6 @@ hello:
echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0028-tflag.sh b/tests/make/execute/0028-tflag.sh
@@ -1,14 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file1' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 file1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-touch file1
-EOF
scc make -tf test.mk file1 > $tmp1 2>&1
-diff $tmp1 $tmp2 && test -f file1
+diff $tmp1 - <<EOF && test -f file1
+touch file1
+EOF
DIR diff --git a/tests/make/execute/0029-tflag.sh b/tests/make/execute/0029-tflag.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 $tmp2 file2' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
tmp2=tmp2.$$
DIR diff --git a/tests/make/execute/0030-tflag.sh b/tests/make/execute/0030-tflag.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file.o file.c' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 file.o file.c' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
touch file.c
-cat > $tmp2 <<EOF
+scc make -tf test.mk file.o > $tmp1 2>&1
+
+diff $tmp1 - <<EOF && test -f file.c -a -f file.o
touch file.c
touch file.o
EOF
-
-scc make -tf test.mk file.o > $tmp1 2>&1
-
-diff $tmp1 $tmp2 && test -f file.c -a -f file.o
DIR diff --git a/tests/make/execute/0031-tflag.sh b/tests/make/execute/0031-tflag.sh
@@ -1,15 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 print-makeflags-always' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 print-makeflags-always' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp2 <<EOF
+MAKEFLAGS=-t scc make -f test.mk print-makeflags-always > $tmp1 2>&1
+
+diff -u $tmp1 - <<EOF && test -f print-makeflags-always
-t
touch print-makeflags-always
EOF
-
-MAKEFLAGS=-t scc make -f test.mk print-makeflags-always > $tmp1 2>&1
-
-diff -u $tmp1 $tmp2 && test -f print-makeflags-always
DIR diff --git a/tests/make/execute/0032-tflag.sh b/tests/make/execute/0032-tflag.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file1' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 $tmp2 file1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
tmp2=tmp2.$$
DIR diff --git a/tests/make/execute/0033-macro.sh b/tests/make/execute/0033-macro.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo pcc > $tmp2
scc make -f test.mk CC=pcc print-cc > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+pcc
+EOF
DIR diff --git a/tests/make/execute/0034-macro.sh b/tests/make/execute/0034-macro.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo pcc > $tmp2
MAKEFLAGS='-S CC=pcc' scc make -f test.mk print-cc > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+pcc
+EOF
DIR diff --git a/tests/make/execute/0035-macro.sh b/tests/make/execute/0035-macro.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo > $tmp2
MAKEFLAGS='-S CC=pcc' scc make -f test.mk print-env-cc > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+
+EOF
DIR diff --git a/tests/make/execute/0036-macro.sh b/tests/make/execute/0036-macro.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo pcc > $tmp2
scc make -f test.mk CC=pcc print-env-cc > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+pcc
+EOF
DIR diff --git a/tests/make/execute/0037-macro.sh b/tests/make/execute/0037-macro.sh
@@ -1,13 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-make=`command -v scc-make`
-
-echo $make > $tmp2
+make=`command -v scc-make`
$make -f test.mk print-make > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+$make
+EOF
DIR diff --git a/tests/make/execute/0038-rules.sh b/tests/make/execute/0038-rules.sh
@@ -1,12 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo "make: error: don't know how to make no-file" > $tmp2
scc make no-file > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+make: error: don't know how to make no-file
+EOF
DIR diff --git a/tests/make/execute/0039-rules.sh b/tests/make/execute/0039-rules.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 file?' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1 $tmp2 file?' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
tmp2=tmp2.$$
DIR diff --git a/tests/make/execute/0040-makefile.sh b/tests/make/execute/0040-makefile.sh
@@ -1,19 +1,17 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 makefile' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1 makefile' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
cat > makefile <<EOF
hello:
@echo Hello World!, makefile!
EOF
-cat > $tmp2 <<EOF
-Hello World!, makefile!
-EOF
-
scc make > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!, makefile!
+EOF
DIR diff --git a/tests/make/execute/0041-comment.sh b/tests/make/execute/0041-comment.sh
@@ -1,16 +1,16 @@
#!/bin/sh
-trap 'rm $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-echo Hello World! > $tmp2
-
-scc make -f - <<'EOF' > $tmp1
+scc make -f - <<'EOF' > $tmp1 2>&1
# full line comment
all:
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0042-comment.sh b/tests/make/execute/0042-comment.sh
@@ -1,16 +1,16 @@
#!/bin/sh
-trap 'rm $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-echo Hello World! > $tmp2
-
-scc make -f - <<'EOF' > $tmp1
+scc make -f - <<'EOF' > $tmp1 2>&1
# blank line
all:
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0043-comment.sh b/tests/make/execute/0043-comment.sh
@@ -1,16 +1,16 @@
#!/bin/sh
-trap 'rm $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-echo Hello World! > $tmp2
-
-scc make -f - <<'EOF' > $tmp1
+scc make -f - <<'EOF' > $tmp1 2>&1
all:
@echo Hello World!
# blank line
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0044-macro.sh b/tests/make/execute/0044-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
scc make -f - <<'EOF' > $tmp1 2>&1
# Generic rules
@@ -19,4 +17,6 @@ all:
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0045-comment.sh b/tests/make/execute/0045-comment.sh
@@ -1,13 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM QUIT
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1 ' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-make: error: don't know how to make target1
-EOF
scc make -f - target1 <<EOF > $tmp1 2>&1
#esto es un comentario \
@@ -15,4 +11,6 @@ target1: ; echo hello
target2: ; echo bye
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+make: error: don't know how to make target1
+EOF
DIR diff --git a/tests/make/execute/0046-makefile.sh b/tests/make/execute/0046-makefile.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Bye world! > $tmp2
scc make -f test.mk -f - hello <<EOF > $tmp1 2>&1
hello:
@echo Bye world!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Bye world!
+EOF
DIR diff --git a/tests/make/execute/0047-include.sh b/tests/make/execute/0047-include.sh
@@ -1,14 +1,14 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
scc make -f- hello <<EOF > $tmp1 2>&1
include test.mk
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0048-include.sh b/tests/make/execute/0048-include.sh
@@ -1,21 +1,21 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 $tmp3' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1 $tmp2' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
tmp2=tmp2.$$
-tmp3=tmp3.$$
-touch $tmp3
-
-echo Hello World! > $tmp2
+touch $tmp2
scc make -f- hello <<EOF > $tmp1 2>&1
FILE = test.mk
-F = $tmp3
+F = $tmp2
include \$(FILE)
include \$(F)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0049-rule.sh b/tests/make/execute/0049-rule.sh
@@ -1,14 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-Hello World!
-Bye World!
-EOF
scc make -f- <<EOF > $tmp1 2>&1
hello:
@@ -16,4 +11,7 @@ hello:
echo Bye World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+Bye World!
+EOF
DIR diff --git a/tests/make/execute/0050-rule.sh b/tests/make/execute/0050-rule.sh
@@ -1,13 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-Hello World! Bye World!
-EOF
scc make -f- <<EOF > $tmp1 2>&1
hello:
@@ -15,4 +11,6 @@ hello:
Bye World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World! Bye World!
+EOF
DIR diff --git a/tests/make/execute/0051-rule.sh b/tests/make/execute/0051-rule.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
(set -e
scc make -f- <<'EOF'
@@ -18,4 +16,6 @@ all:
EOF
echo fail) > $tmp1 2> /dev/null
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0052-rule.sh b/tests/make/execute/0052-rule.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-Hello World!
-bye
-fail
-EOF
(set -e
scc make -f- <<'EOF'
@@ -22,4 +16,8 @@ all:
EOF
echo fail) > $tmp1 2> /dev/null
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+bye
+fail
+EOF
DIR diff --git a/tests/make/execute/0053-rule.sh b/tests/make/execute/0053-rule.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-Hello World!
-bye
-fail
-EOF
(set -e
scc make -f- <<'EOF'
@@ -24,4 +18,8 @@ all:
EOF
echo fail) > $tmp1 2> /dev/null
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+bye
+fail
+EOF
DIR diff --git a/tests/make/execute/0054-rule.sh b/tests/make/execute/0054-rule.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-Hello World!
-bye
-fail
-EOF
(set -e
scc make -f- <<'EOF'
@@ -24,4 +18,8 @@ all:
EOF
echo fail) > $tmp1 2> /dev/null
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+bye
+fail
+EOF
DIR diff --git a/tests/make/execute/0055-rule.sh b/tests/make/execute/0055-rule.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-Hello World!
-bye
-fail
-EOF
(set -e
scc make -if- <<'EOF'
@@ -22,4 +16,8 @@ all:
EOF
echo fail) > $tmp1 2> /dev/null
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+bye
+fail
+EOF
DIR diff --git a/tests/make/execute/0056-rule.sh b/tests/make/execute/0056-rule.sh
@@ -1,13 +1,13 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
echo 'all: ; @echo Hello World!' |
scc make -f- > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0057-default.sh b/tests/make/execute/0057-default.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<'EOF'
-make: error: <stdin>:3: DEFAULT rule with prerequisites
-EOF
scc make -f- <<EOF > $tmp1 2>&1
.DEFAULT: all
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<'EOF'
+make: error: <stdin>:3: DEFAULT rule with prerequisites
+EOF
DIR diff --git a/tests/make/execute/0058-default.sh b/tests/make/execute/0058-default.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
scc make -f- no-target <<EOF > $tmp1 2>&1
.DEFAULT:
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0059-macro.sh b/tests/make/execute/0059-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo 'hola .' > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
VAR = hola # comment
@@ -14,4 +12,6 @@ all:
@echo "$(VAR)".
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+hola .
+EOF
DIR diff --git a/tests/make/execute/0060-macro.sh b/tests/make/execute/0060-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo 'hola .' > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
VAR = hola # comment
@@ -13,4 +11,6 @@ all:
@echo "$(VAR)".
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+hola .
+EOF
DIR diff --git a/tests/make/execute/0061-macro.sh b/tests/make/execute/0061-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo hello-hello > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
VAR = hello
@@ -13,4 +11,6 @@ all:
@echo ${VAR}-$(VAR)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+hello-hello
+EOF
DIR diff --git a/tests/make/execute/0062-macro.sh b/tests/make/execute/0062-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World!> $tmp2
scc make -f- all <<'EOF' > $tmp1 2>&1
TARGET = all
@@ -14,4 +12,6 @@ $(TARGET):
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0063-macro.sh b/tests/make/execute/0063-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World!> $tmp2
scc make -f- all <<'EOF' > $tmp1 2>&1
TARGET = print
@@ -16,4 +14,6 @@ print:
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0064-macro.sh b/tests/make/execute/0064-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World!> $tmp2
scc make -f- all <<'EOF' > $tmp1 2>&1
VAR = guy
@@ -15,4 +13,6 @@ all:
VAR = World
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0065-macro.sh b/tests/make/execute/0065-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World!> $tmp2
scc make -f- all <<'EOF' > $tmp1 2>&1
VAR = VAR2
@@ -16,4 +14,6 @@ all:
@echo Hello $(VAR2)!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0066-macro.sh b/tests/make/execute/0066-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World!> $tmp2
scc make -f- all <<'EOF' > $tmp1 2>&1
VAR2 = one
@@ -18,4 +16,6 @@ all:
VAR2 = World
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0067-macro.sh b/tests/make/execute/0067-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
F = World
@@ -15,4 +13,6 @@ all:
@echo $G $(F)!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0068-macro.sh b/tests/make/execute/0068-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo file1.o file2.o > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
SRC = file1.c file2.c
@@ -14,4 +12,6 @@ all:
@echo $(SRC:.c=.o)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+file1.o file2.o
+EOF
DIR diff --git a/tests/make/execute/0069-macro.sh b/tests/make/execute/0069-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
VAR1 = one
@@ -18,4 +16,6 @@ VAR1 = World
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0070-macro.sh b/tests/make/execute/0070-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo Hello World! > $tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
VAR1 = one
@@ -20,4 +18,6 @@ VAR1 = two
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0071-macro.sh b/tests/make/execute/0071-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo CC=pcc > $tmp2
CC=dcc MAKEFLAGS='-S CC=gcc' scc make -f- CC=pcc <<'EOF' > $tmp1 2>&1
CC=tcc
@@ -14,4 +12,6 @@ all:
@echo CC=$(CC)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+CC=pcc
+EOF
DIR diff --git a/tests/make/execute/0072-macro.sh b/tests/make/execute/0072-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo CC=gcc > $tmp2
CC=dcc MAKEFLAGS='-S CC=gcc' scc make -f- <<'EOF' > $tmp1 2>&1
CC=tcc
@@ -14,4 +12,6 @@ all:
@echo CC=$(CC)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+CC=gcc
+EOF
DIR diff --git a/tests/make/execute/0073-macro.sh b/tests/make/execute/0073-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM
+trap 'rm -f $tmp1 $tmp2' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo CC=tcc > $tmp2
CC=dcc scc make -f- <<'EOF' > $tmp1 2>&1
CC=tcc
@@ -14,4 +12,6 @@ all:
@echo CC=$(CC)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+CC=tcc
+EOF
DIR diff --git a/tests/make/execute/0074-macro.sh b/tests/make/execute/0074-macro.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo CC=dcc > $tmp2
CC=dcc scc make -f- <<'EOF' > $tmp1 2>&1
all:
@echo CC=$(CC)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+CC=dcc
+EOF
DIR diff --git a/tests/make/execute/0075-macro.sh b/tests/make/execute/0075-macro.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo CC=dcc > $tmp2
CC=dcc scc make -ef- <<'EOF' > $tmp1 2>&1
all:
@echo CC=$(CC)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+CC=dcc
+EOF
DIR diff --git a/tests/make/execute/0076-macro.sh b/tests/make/execute/0076-macro.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo CC=pcc > $tmp2
CC=dcc MAKEFLAGS='-S CC=gcc' scc make -ef- CC=pcc <<'EOF' > $tmp1 2>&1
CC=tcc
@@ -14,4 +12,6 @@ all:
@echo CC=$(CC)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+CC=pcc
+EOF
DIR diff --git a/tests/make/execute/0077-macro.sh b/tests/make/execute/0077-macro.sh
@@ -1,12 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-echo SHELL=/bin/sh > $tmp2
-SHELL=foo scc make -f- <<'EOF'
+SHELL=foo scc make -f- <<'EOF' > $tmp1 2>&1
all:
@echo $(SHELL)
EOF
+
+diff $tmp1 - <<EOF
+/bin/sh
+EOF
DIR diff --git a/tests/make/execute/0078-macro.sh b/tests/make/execute/0078-macro.sh
@@ -1,12 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-echo SHELL=/bin/sh > $tmp2
-SHELL=foo scc make -f- SHELL=/bin/sh <<'EOF'
+SHELL=foo scc make -f- SHELL=/bin/sh <<'EOF' > $tmp1 2>&1
all:
@echo $$SHELL
EOF
+
+diff $tmp1 - <<EOF
+foo
+EOF
DIR diff --git a/tests/make/execute/0079-macro.sh b/tests/make/execute/0079-macro.sh
@@ -1,14 +1,17 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-echo SHELL=/bin/sh > $tmp2
-SHELL=foo scc make -f- <<'EOF'
+SHELL=foo scc make -f- <<'EOF' > $tmp1 2>&1
SHELL = /bin/sh
all:
@echo $$SHELL
EOF
+
+diff $tmp1 - <<EOF
+foo
+EOF
DIR diff --git a/tests/make/execute/0080-rule.sh b/tests/make/execute/0080-rule.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-trap 'rm -f $tmp f.c f.o f' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp f.c f.o f' EXIT
+trap 'exit 1' HUP INT TERM
tmp=tmp.$$
DIR diff --git a/tests/make/execute/0081-rule.sh b/tests/make/execute/0081-rule.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-trap 'rm -f f.c f.o f' EXIT INT QUIT TERM HUP
+trap 'rm -f f.c f.o f' EXIT
+trap 'exit 1' HUP INT TERM
echo hello > f.c
DIR diff --git a/tests/make/execute/0082-rule.sh b/tests/make/execute/0082-rule.sh
@@ -1,16 +1,12 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 f.c f.o f' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1 f.c f.o f' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
echo hello > f.c
-cat > $tmp2 <<EOF
-make: error: don't know how to make f
-EOF
-
scc make -sf- <<'EOF' > $tmp1 2>&1
.SUFFIXES:
@@ -21,4 +17,6 @@ scc make -sf- <<'EOF' > $tmp1 2>&1
all: f
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+make: error: don't know how to make f
+EOF
DIR diff --git a/tests/make/execute/0083-rule.sh b/tests/make/execute/0083-rule.sh
@@ -1,12 +1,11 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 f.c f.o' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 f.c f.o' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
echo dude > f.c
-echo hello > $tmp2
(scc make -f- <<'EOF'
f.o:
@@ -16,4 +15,6 @@ all: f.o
EOF
cat f.o) > $tmp1 2>&1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+hello
+EOF
DIR diff --git a/tests/make/execute/0084-rule.sh b/tests/make/execute/0084-rule.sh
@@ -1,11 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 f f1 f2 f3' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 tmp2 f f?' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo f3 > $tmp2
touch -t 200711121015 f1 f2
touch -t 200711121016 f
@@ -16,4 +14,6 @@ f: f1 f2 f3
@echo $?
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+f3
+EOF
DIR diff --git a/tests/make/execute/0085-rule.sh b/tests/make/execute/0085-rule.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 t1.c t?.o t2' EXIT INT TERM HUP QUIT
+trap 'rm -f $tmp1 t1.c t?.o t2' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-t1
-t2
-t2
-EOF
echo Hello > t1.c
@@ -27,4 +21,8 @@ t2:
@echo $* > $@
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+t1
+t2
+t2
+EOF
DIR diff --git a/tests/make/execute/0086-rule.sh b/tests/make/execute/0086-rule.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 t? t' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 t? t' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp2 <<EOF
-touch t
-touch t1
-touch t2
-EOF
scc make -f- <<'EOF' > $tmp1 2>&1
all: t1 t2
@@ -19,4 +13,8 @@ t1 t2 t:
touch $@
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+touch t
+touch t1
+touch t2
+EOF
DIR diff --git a/tests/make/execute/0087-rule.sh b/tests/make/execute/0087-rule.sh
@@ -1,15 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-echo '#error line' >$tmp2
scc make -f- <<'EOF' > $tmp1 2>&1
all:
@echo '#error line'
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<'EOF'
+#error line
+EOF
DIR diff --git a/tests/make/execute/0088-comment.sh b/tests/make/execute/0088-comment.sh
@@ -1,14 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-Hello
-World!
-EOF
scc make -f- <<'EOF' > $tmp1 2>&1
all:
@@ -17,4 +12,7 @@ all:
@echo World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello
+World!
+EOF
DIR diff --git a/tests/make/execute/0089-comment.sh b/tests/make/execute/0089-comment.sh
@@ -1,13 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'rm -f $tmp1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-Hello World!
-EOF
scc make -f- <<'EOF' > $tmp1 2>&1
VAR = Hello World! # This is a comment
@@ -15,4 +11,6 @@ all:
@echo '$(VAR)'
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0090-comment.sh b/tests/make/execute/0090-comment.sh
@@ -1,17 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-Hello World!
-EOF
scc make -f- <<'EOF' > $tmp1 2>&1
all: # This is a comment
@echo Hello World!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0091-expansion.sh b/tests/make/execute/0091-expansion.sh
@@ -1,14 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-But before!
-Hello World!
-EOF
scc make -f- <<'EOF' > $tmp1 2>&1
STARGET = all
@@ -20,4 +15,7 @@ ball:
@echo But before!
EOF
-diff -u $tmp1 $tmp2
+diff -u $tmp1 - <<EOF
+But before!
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0092-expansion.sh b/tests/make/execute/0092-expansion.sh
@@ -1,14 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp2 <<EOF
-yeah!
-done
-EOF
scc make -f- <<'EOF' > $tmp1 2>&1
VAR =\
@@ -27,4 +22,7 @@ f.$O:
@echo yeah!
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+yeah!
+done
+EOF
DIR diff --git a/tests/make/execute/0093-inference.sh b/tests/make/execute/0093-inference.sh
@@ -1,24 +1,22 @@
#!/bin/sh
-trap 'rm -f f.? $tmp1 $tmp2 $tmp3 f.?' EXIT INT TERM QUIT HUP
+trap 'rm -f f.? $tmp1 $tmp2 f.?' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
tmp2=tmp2.$$
-tmp3=tmp3.$$
-cat >$tmp1<<EOF
-c99 -O -c f.c
-EOF
-
-cat >$tmp2 <<'EOF'
+cat >$tmp1 <<'EOF'
f.o: f.h
all: f.o
EOF
(touch f.c f.h
-scc make -f $tmp2
+scc make -f $tmp1
touch f.c
-scc make -f $tmp2) > $tmp3
+scc make -f $tmp1) > $tmp2
-diff $tmp1 $tmp3
+diff $tmp2 - <<EOF
+c99 -O -c f.c
+EOF
DIR diff --git a/tests/make/execute/0094-expansion.sh b/tests/make/execute/0094-expansion.sh
@@ -1,23 +1,11 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-file1.o file2.o
-all
-alp
-all.o
-file1.c file2.c
-file1 file2
-file1.e file2.e
-file1.c file2.c
-all
-EOF
-
-scc make -f- <<'EOF' > $tmp2 2>&1
+scc make -f- <<'EOF' > $tmp1 2>&1
O = o
SRC = file1.c file2.c
OBJ = $(SRC:.c=.$O)
@@ -55,4 +43,15 @@ all:
@echo ${SRC}
@echo ${@:=}
EOF
-diff $tmp1 $tmp2
+
+diff $tmp1 - <<EOF
+file1.o file2.o
+all
+alp
+all.o
+file1.c file2.c
+file1 file2
+file1.e file2.e
+file1.c file2.c
+all
+EOF
DIR diff --git a/tests/make/execute/0095-include.sh b/tests/make/execute/0095-include.sh
@@ -1,16 +1,15 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-Hello World!
-EOF
-
-scc make -f- MK=test.mk hello <<'EOF' > $tmp2 2>&1
+scc make -f- MK=test.mk hello <<'EOF' > $tmp1 2>&1
MK = fail.mk
include $(MK)
EOF
-diff $tmp1 $tmp2
+
+diff $tmp1 - <<EOF
+Hello World!
+EOF
DIR diff --git a/tests/make/execute/0096-escape.sh b/tests/make/execute/0096-escape.sh
@@ -1,20 +1,17 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-MACRO=hello
-EOF
-
-
-scc make -f- <<'EOF' > $tmp2 2>&1
+scc make -f- <<'EOF' > $tmp1 2>&1
MACRO = $$(echo hello)
all:
@echo MACRO=$(MACRO)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+MACRO=hello
+EOF
DIR diff --git a/tests/make/execute/0097-rule.sh b/tests/make/execute/0097-rule.sh
@@ -1,16 +1,11 @@
#!/bin/sh
-trap 'rm -f f1.? $tmp1 $tmp2' EXIT INT TERM HUP
+trap 'rm -f f1.? $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-touch f1.c
-touch f1.o
-EOF
-
-scc make -f- <<'EOF' > $tmp2 2>&1
+scc make -f- <<'EOF' > $tmp1 2>&1
all: f1.o
f1.o: f1.c
@@ -20,4 +15,7 @@ f1.c:
touch $@
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+touch f1.c
+touch f1.o
+EOF
DIR diff --git a/tests/make/execute/0098-signal.sh b/tests/make/execute/0098-signal.sh
@@ -2,12 +2,15 @@
cleanup()
{
+ r=$?
rm -f test.txt
kill -KILL $pid 2>/dev/null
if test $1 -ne 0
then
kill -KILL $$
fi
+ trap - EXIT
+ exit $?
}
rm -f file.txt
DIR diff --git a/tests/make/execute/0103-env.sh b/tests/make/execute/0103-env.sh
@@ -2,19 +2,17 @@
export EFLAGS=World
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-Hello World
-EOF
-
-scc make -f - <<'EOF' > $tmp2 2>&1
+scc make -f - <<'EOF' > $tmp1 2>&1
FLAGS=Hello $(EFLAGS)
all:
@echo $(FLAGS)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World
+EOF
DIR diff --git a/tests/make/execute/0104-env.sh b/tests/make/execute/0104-env.sh
@@ -2,19 +2,17 @@
export CFLAGS=World
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-Hello World
-EOF
-
-scc make -f - <<'EOF' > $tmp2 2>&1
+scc make -f - <<'EOF' > $tmp1 2>&1
FLAGS=Hello $(CFLAGS)
all:
@echo Hello $(CFLAGS)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+Hello World
+EOF
DIR diff --git a/tests/make/execute/0105-include.sh b/tests/make/execute/0105-include.sh
@@ -1,15 +1,11 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-cat > $tmp1 <<EOF
-/usr/local/include
-EOF
-
-scc make -f - <<'EOF' > $tmp2 2>&1
+scc make -f - <<'EOF' > $tmp1 2>&1
prefix = /usr/local
includedir = ${prefix}/include
@@ -17,4 +13,6 @@ all:
@echo $(includedir)
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+/usr/local/include
+EOF
DIR diff --git a/tests/make/execute/0106-inference.sh b/tests/make/execute/0106-inference.sh
@@ -1,21 +1,19 @@
#!/bin/sh
-trap 'rm -f f.? $tmp1 $tmp2 $tmp3 f.?' EXIT INT TERM QUIT HUP
+trap 'rm -f f.? $tmp1 f.?' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp1<<EOF
-c99 -O -c f.c
-EOF
touch -d '1970-01-01 00:00:01' f.c
touch -d '1970-01-01 00:00:02' f.o
touch -d '1970-01-01 00:00:03' f.h
-scc make -f - <<'EOF' > $tmp2 2>&1
+scc make -f - <<'EOF' > $tmp1 2>&1
f.o: f.h
all: f.o
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+c99 -O -c f.c
+EOF
DIR diff --git a/tests/make/execute/0107-inference.sh b/tests/make/execute/0107-inference.sh
@@ -1,13 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2 f f.?' EXIT INT TERM QUIT HUP
+trap 'rm -f $tmp1 f f.?' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat >$tmp1 <<EOF
-c99 -O -o f f.c
-EOF
cat >f.c <<'EOF'
int
@@ -21,11 +17,13 @@ touch -d '1970-01-01 00:00:01' f.h
touch -d '1970-01-01 00:00:03' f
touch -d '1970-01-01 00:00:04' f.c
-scc make -f- <<'EOF' > $tmp2 2>&1
+scc make -f- <<'EOF' > $tmp1 2>&1
f: f.h
f.h:
touch $@
EOF
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+c99 -O -o f f.c
+EOF
DIR diff --git a/tests/make/execute/0108-lastopt.sh b/tests/make/execute/0108-lastopt.sh
@@ -1,15 +1,9 @@
#!/bin/sh
-trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT TERM HUP
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
tmp1=tmp1.$$
-tmp2=tmp2.$$
-
-cat > $tmp1 <<EOF
-hyphen-target
-MYVAR is -42
-MYVAR is myval
-EOF
(scc make -f- -- -42 <<'EOF'
-42:
@@ -25,6 +19,10 @@ scc make -f- -- MYVAR=myval -42 <<'EOF'
-42:
@echo MYVAR is $(MYVAR)
EOF
-) > $tmp2
+) > $tmp1
-diff $tmp1 $tmp2
+diff $tmp1 - <<EOF
+hyphen-target
+MYVAR is -42
+MYVAR is myval
+EOF
DIR diff --git a/tests/make/execute/chktest.sh b/tests/make/execute/chktest.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-ulimit -c 0
rm -f test.log
unset CFLAGS
DIR diff --git a/tests/nm/execute/0001-z80.sh b/tests/nm/execute/0001-z80.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 t .text
@@ -29,5 +30,3 @@ cat <<! > $tmp2
0000000000000012 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0002-z80-u.sh b/tests/nm/execute/0002-z80-u.sh
@@ -2,14 +2,13 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -u z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0003-z80-g.sh b/tests/nm/execute/0003-z80-g.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -g z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000001 B averylongbss
0000000000000001 D averylongdata
0000000000000001 T averylongtext
@@ -23,5 +24,3 @@ cat <<! > $tmp2
0000000000000012 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0004-z80-v.sh b/tests/nm/execute/0004-z80-v.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -v z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
U text6
0000000000000000 b .bss
0000000000000000 d .data
@@ -29,5 +30,3 @@ cat <<! > $tmp2
0000000000000012 C data5
0000000000000012 C text5
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0005-z80-A.sh b/tests/nm/execute/0005-z80-A.sh
@@ -2,9 +2,10 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f f.out f.a $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f f.out f.a $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
rm -f f.a
scc-ar -qv f.a z80.out
@@ -12,7 +13,7 @@ cp z80.out f.out
scc-ar -qv f.a f.out
scc nm -A f.a z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
f.a[z80.out]: 0000000000000000 b .bss
f.a[z80.out]: 0000000000000000 d .data
f.a[z80.out]: 0000000000000000 t .text
@@ -71,5 +72,3 @@ z80.out: 000000000000000a C text4
z80.out: 0000000000000012 C text5
z80.out: U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0006-z80-o.sh b/tests/nm/execute/0006-z80-o.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -t o z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 t .text
@@ -29,5 +30,3 @@ cat <<! > $tmp2
0000000000000022 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0007-z80-d.sh b/tests/nm/execute/0007-z80-d.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -t d z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 t .text
@@ -29,5 +30,3 @@ cat <<! > $tmp2
0000000000000018 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0008-z80-x.sh b/tests/nm/execute/0008-z80-x.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -t x z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 t .text
@@ -29,5 +30,3 @@ cat <<! > $tmp2
0000000000000012 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0009-z80-P-o.sh b/tests/nm/execute/0009-z80-P-o.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -P -t o z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
.bss b 0000000000000000 0
.data d 0000000000000000 0
.text t 0000000000000000 0
@@ -29,5 +30,3 @@ text4 C 0000000000000012 12
text5 C 0000000000000022 22
text6 U
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0010-z80-P-d.sh b/tests/nm/execute/0010-z80-P-d.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -P -t x z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
.bss b 0000000000000000 0
.data d 0000000000000000 0
.text t 0000000000000000 0
@@ -29,5 +30,3 @@ text4 C 000000000000000a a
text5 C 0000000000000012 12
text6 U
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0011-z80-P-x.sh b/tests/nm/execute/0011-z80-P-x.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -P -t x z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
.bss b 0000000000000000 0
.data d 0000000000000000 0
.text t 0000000000000000 0
@@ -29,5 +30,3 @@ text4 C 000000000000000a a
text5 C 0000000000000012 12
text6 U
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0012-z80-f.sh b/tests/nm/execute/0012-z80-f.sh
@@ -2,13 +2,13 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+tmp1=tmp1.$$
scc nm -f z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 N .file
@@ -30,5 +30,3 @@ cat <<! > $tmp2
0000000000000012 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/0013-z80-a.sh b/tests/nm/execute/0013-z80-a.sh
@@ -2,13 +2,14 @@
set -e
-tmp1=`mktemp`
-tmp2=`mktemp`
-trap "rm -f $tmp1 $tmp2; exit" 0 2 3
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc nm -a z80.out > $tmp1
-cat <<! > $tmp2
+diff $tmp1 - <<!
0000000000000000 b .bss
0000000000000000 d .data
0000000000000000 N .file
@@ -30,5 +31,3 @@ cat <<! > $tmp2
0000000000000012 C text5
U text6
!
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/nm/execute/chktest.sh b/tests/nm/execute/chktest.sh
@@ -1,12 +1,10 @@
#!/bin/sh
-trap "rm -f a.out; exit" 0 2 3 15
-ulimit -c 0
rm -f test.log
for i in *-*.sh
do
printf "Test: %s\n\n" $i >> test.log
- ./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
- echo "$i"
+ (./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
+ echo "$i") | tee -a test.log
done
DIR diff --git a/tests/size/execute/0001-z80.sh b/tests/size/execute/0001-z80.sh
@@ -1,16 +1,15 @@
#!/bin/sh
set -e
-trap 'rm -f $tmp1 $tmp2' EXIT HUP INT QUIT TERM
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc size z80.out >$tmp1
-cat > $tmp2 <<EOF
+diff $tmp1 - <<EOF
text data bss dec hex filename
5 3 3 11 b z80.out
EOF
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/size/execute/0002-z80-t.sh b/tests/size/execute/0002-z80-t.sh
@@ -1,18 +1,17 @@
#!/bin/sh
set -e
-trap 'rm -f $tmp1 $tmp2' EXIT HUP INT QUIT TERM
-tmp1=`mktemp`
-tmp2=`mktemp`
+trap 'rm -f $tmp1' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
scc size -t z80.out z80.out>$tmp1
-cat > $tmp2 <<EOF
+diff $tmp1 - <<EOF
text data bss dec hex filename
5 3 3 11 b z80.out
5 3 3 11 b z80.out
10 6 6 22 16 (TOTALS)
EOF
-
-diff $tmp1 $tmp2
DIR diff --git a/tests/size/execute/chktest.sh b/tests/size/execute/chktest.sh
@@ -1,12 +1,10 @@
#!/bin/sh
-trap "rm -f a.out; exit" 0 2 3 15
-ulimit -c 0
rm -f test.log
for i in *-*.sh
do
printf "Test: %s\n\n" $i >> test.log
- ./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
- echo "$i"
+ (./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
+ echo "$i") | tee -a test.log
done
DIR diff --git a/tests/strip/execute/0001-z80.sh b/tests/strip/execute/0001-z80.sh
@@ -1,18 +1,17 @@
#!/bin/sh
set -e
-trap 'rm -f $tmp1 $tmp2 $tmp3' EXIT HUP INT QUIT TERM
-tmp1=tmpfile1
-tmp2=tmpfile2
-tmp3=tmpfile3
+trap 'rm -f $tmp1 $tmp2' EXIT
+trap 'exit 1' HUP INT TERM
+
+tmp1=tmp1.$$
+tmp2=tmp2.$$
cp z80.out $tmp1
scc strip $tmp1 > $tmp2
scc nm $tmp1 >> $tmp2 2>&1 || true
-cat > $tmp3 <<EOF
+diff $tmp2 - <<EOF
nm: $tmp1: no symbols
EOF
-
-diff $tmp2 $tmp3
DIR diff --git a/tests/strip/execute/chktest.sh b/tests/strip/execute/chktest.sh
@@ -1,12 +1,10 @@
#!/bin/sh
-trap "rm -f a.out; exit" 0 2 3 15
-ulimit -c 0
rm -f test.log
for i in *-*.sh
do
printf "Test: %s\n\n" $i >> test.log
- ./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
- echo "$i"
+ (./$i >> test.log 2>&1 && printf '[PASS]\t' || printf '[FAIL]\t'
+ echo "$i") | tee -a test.log
done