commit daefa81af2a1a14c155ac4173a28ecd4afad6e88
parent 9cb6a9d4b325d1de94f02d7f02ddd5a2c7c0f70c
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 16 Jan 2024 22:37:24 +0100
tests: Add basic skeleton for make/execute
Diffstat:
5 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
@@ -9,6 +9,7 @@ DIRS =\
strip/execute\
libc/execute\
cc/execute cc/error\
+ make/execute\
PROJECTDIR = ..
include $(PROJECTDIR)/scripts/rules.mk
diff --git a/tests/make/execute/0001-rule.sh b/tests/make/execute/0001-rule.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
+tmp1=tmp1.$$
+tmp2=tmp2.$$
+
+scc-make hello > $tmp1 2>&1
+echo Hello World! > $tmp2
+
+diff $tmp1 $tmp2
diff --git a/tests/make/execute/Makefile b/tests/make/execute/Makefile
@@ -0,0 +1,17 @@
+.POSIX:
+
+ROOT=../../..
+
+all:
+ @PATH=$(ROOT)/bin:$$PATH ./chktest.sh
+
+tests:
+ @$(MAKE) |\
+ grep -v TODO |\
+ grep FAIL >/dev/null &&\
+ printf '[FAIL]' || printf '[PASS]'; printf '\tmake/execute\n'
+
+hello:
+ @echo Hello World!
+
+clean:
diff --git a/tests/make/execute/chktest.sh b/tests/make/execute/chktest.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+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") | tee -a test.log
+done
diff --git a/tests/make/execute/test.log b/tests/make/execute/test.log
@@ -0,0 +1,3 @@
+Test: 0001-rule.sh
+
+[PASS] 0001-rule.sh