commit 676d846b1588b139ee9192f9e5d5a90f74fa5ec5
parent 663c99ffd0f9f02049d200e33414cab1bebb8156
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 25 Jan 2024 16:26:41 +0100
tests/make: Make less fragile the checks
Some of the checks had specific strings used in some
shells that may be different between systems.
Diffstat:
10 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/tests/make/execute/0006-iflag.sh b/tests/make/execute/0006-iflag.sh
@@ -7,10 +7,11 @@ tmp2=tmp2.$$
cat <<EOF > $tmp2
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
-i
EOF
-scc-make -if test.mk error print-makeflags > $tmp1 2>&1
+scc-make -if test.mk error print-makeflags 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0007-iflag.sh b/tests/make/execute/0007-iflag.sh
@@ -7,10 +7,11 @@ tmp2=tmp2.$$
cat <<EOF > $tmp2
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
-i
EOF
-MAKEFLAGS=-i scc-make -f test.mk error print-makeflags > $tmp1 2>&1
+MAKEFLAGS=-i scc-make -f test.mk error print-makeflags 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0008-ignore.sh b/tests/make/execute/0008-ignore.sh
@@ -7,10 +7,11 @@ tmp2=tmp2.$$
cat <<EOF > $tmp2
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
Hello World!
EOF
-scc-make -f test.mk ignored-error hello > $tmp1 2>&1
+scc-make -f test.mk ignored-error hello 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1 2>&1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0009-ignore.sh b/tests/make/execute/0009-ignore.sh
@@ -7,11 +7,12 @@ tmp2=tmp2.$$
cat <<EOF > $tmp2
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
make: error: don't know how to make hello
EOF
-scc-make -f - error hello > $tmp1 2>&1 <<EOF
+(scc-make -f - error hello 2>&1 |
+sed 's/sh:.*: *no-/sh: no-/' > $tmp1) <<EOF
.IGNORE:
error:
diff --git a/tests/make/execute/0010-kflag.sh b/tests/make/execute/0010-kflag.sh
@@ -8,7 +8,7 @@ tmp2=tmp2.$$
cat <<EOF > $tmp2
-k
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
make: warning: target error: error 32512
Hello World!
make: warning: target follow not remade because of errors
@@ -16,6 +16,7 @@ EOF
(set -e
scc-make -kf test.mk print-makeflags follow
- echo fail) > $tmp1 2>&1
+ echo fail) 2>&1 |
+sed 's/:.*: *no-/: no-/' > $tmp1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0011-kflag.sh b/tests/make/execute/0011-kflag.sh
@@ -8,7 +8,7 @@ tmp2=tmp2.$$
cat <<EOF > $tmp2
-k
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
make: warning: target error: error 32512
Hello World!
make: warning: target follow not remade because of errors
@@ -16,6 +16,7 @@ EOF
(set -e
MAKEFLAGS=-k scc-make -f test.mk print-makeflags follow
- echo fail) >> $tmp1 2>&1
+ echo fail) 2>&1 |
+sed 's/:.*: *no-/: no-/' > $tmp1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0015-pflag.sh b/tests/make/execute/0015-pflag.sh
@@ -7,8 +7,7 @@ tmp2=tmp2.$$
unset MAKEFLAGS
-cat > $tmp2 <<'EOF'
-
+(cat > $tmp2) <<'EOF'
FC = fort77
YFLAGS =
MAKE = scc-make
@@ -67,7 +66,6 @@ FFLAGS = -O 1
.SUFFIXES: .o .c .y .l .a .sh .f
all:
- @echo $(MAKEFLAGS)
.sh:
cp $< $@
@@ -75,9 +73,8 @@ all:
EOF
-scc-make -pf - > $tmp1 2>&1 <<'EOF'
+(scc-make -pf - > $tmp1 2>&1) <<'EOF'
all:
- @echo $(MAKEFLAGS)
EOF
-diff $tmp1 $tmp2
+diff -u $tmp1 $tmp2
diff --git a/tests/make/execute/0022-Sflag.sh b/tests/make/execute/0022-Sflag.sh
@@ -8,10 +8,11 @@ tmp2=tmp2.$$
cat > $tmp2 <<EOF
-k -S
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
make: error: target error: error 32512
EOF
-MAKEFLAGS=-k scc-make -Sf test.mk print-makeflags follow >$tmp1 2>&1
+MAKEFLAGS=-k scc-make -Sf test.mk print-makeflags follow 2>&1 |
+sed 's/:.*: no-/: no-/' > $tmp1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0023-Sflag.sh b/tests/make/execute/0023-Sflag.sh
@@ -8,12 +8,13 @@ tmp2=tmp2.$$
cat > $tmp2 <<EOF
-S -k
no-valid-program
-sh: 1: no-valid-program: not found
+sh: no-valid-program: not found
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 >$tmp1 2>&1
+MAKEFLAGS=-S scc-make -kf test.mk print-makeflags follow 2>&1 |
+sed 's/:.*: *no-/: no-/' > $tmp1
diff $tmp1 $tmp2
diff --git a/tests/make/execute/0084-rule.sh b/tests/make/execute/0084-rule.sh
@@ -8,10 +8,10 @@ tmp2=tmp2.$$
echo f3 > $tmp2
touch -t 200711121015 f1 f2
-touch -t 200711121016 f
-touch -t 200711121017 f3
+touch -t 200711121016 f
+touch -t 200711121017 f3
-scc-make -f- <<'EOF' > $tmp1 2>&1
+(scc-make -f- > $tmp1 2>&1) <<EOF
f: f1 f2 f3
@echo $?
EOF