scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 560a156341e5bb352194a85c3258406a079697b7
parent d6e81805c12bf44489eacd53d112c0382f1bc52b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri,  1 Jul 2022 22:24:46 +0200

tests: Show a summary at the top level

It is really hard to follow the test execution when they
come from different directories. This summary makes easier
to locate the suites that are failing.

Diffstat:
MMakefile | 1-
Mtests/Makefile | 11+++++++----
Mtests/ar/execute/Makefile | 14+++++++++-----
Mtests/ar/execute/chktest.sh | 4++--
Mtests/as/execute/Makefile | 8++++++--
Mtests/cc/error/Makefile | 8++++++--
Mtests/cc/error/chktest.sh | 4++--
Mtests/cc/error/scc-tests.lst | 6+++---
Mtests/cc/execute/Makefile | 8++++++--
Mtests/cc/execute/chktest.sh | 4++--
Mtests/ld/execute/Makefile | 19++++++++++++-------
Mtests/libc/execute/Makefile | 8++++++--
Mtests/libc/execute/chktest.sh | 7+++----
Mtests/nm/execute/Makefile | 18++++++++++++------
Mtests/size/execute/Makefile | 20+++++++++++++-------
Mtests/strip/execute/Makefile | 18++++++++++++------
16 files changed, 101 insertions(+), 57 deletions(-)

diff --git a/Makefile b/Makefile @@ -98,7 +98,6 @@ toolchain: src libc: src/libc libcrt: src/libcrt -tests: all src: include/scc/scc src: dirs diff --git a/tests/Makefile b/tests/Makefile @@ -10,12 +10,15 @@ DIRS =\ libc/execute\ cc/execute cc/error\ -all clean: - for i in $(DIRS);\ +PROJECTDIR = .. +include $(PROJECTDIR)/scripts/rules.mk + +all: + @for i in $(DIRS);\ do \ cd $$i;\ - $(MAKE) $@;\ + $(MAKE) tests;\ cd -;\ - done + done | grep -e PASS -e FAIL -e SKIP;\ dep: diff --git a/tests/ar/execute/Makefile b/tests/ar/execute/Makefile @@ -2,13 +2,17 @@ ROOT=../../.. -all: tests - -tests: master.a +all: master.a @TZ=UTC PATH=$(ROOT)/bin:$$PATH ./chktest.sh -master.a: - ./mkmaster.sh +master.a: mkmaster.sh + @./mkmaster.sh + +tests: + @$(MAKE) |\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]'; printf '\tar/execute\n' clean: rm -f *.a test.log diff --git a/tests/ar/execute/chktest.sh b/tests/ar/execute/chktest.sh @@ -8,6 +8,6 @@ rm -rf file* 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 diff --git a/tests/as/execute/Makefile b/tests/as/execute/Makefile @@ -2,10 +2,14 @@ ROOT=../../../ -all: tests +all: + @PATH=$(ROOT)/libexec/scc/:$(ROOT)/bin:$$PATH ./chktest.sh tests: - @PATH=$(ROOT)/libexec/scc/:$(ROOT)/bin:$$PATH ./chktest.sh + @$(MAKE) |\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]'; printf '\tas/execute\n' clean: rm -f test.log diff --git a/tests/cc/error/Makefile b/tests/cc/error/Makefile @@ -4,10 +4,14 @@ ROOT=../../.. SCCPREFIX=$(ROOT) CC=$(ROOT)/bin/scc -all: tests +all: + @CC=$(CC) ./chktest.sh scc-tests.lst tests: - CC=$(CC) ./chktest.sh scc-tests.lst + @$(MAKE) |\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]'; printf '\tcc/error\n' clean: rm -f *.as *.o *.ir *.qbe *core test.log diff --git a/tests/cc/error/chktest.sh b/tests/cc/error/chktest.sh @@ -15,7 +15,7 @@ do (SCCPREFIX=$SCCPREFIX $CC $CFLAGS -w -c $i) 2> $err (echo "/^PATTERN/+;/^\./-w $chk" | ed -s $i) >/dev/null 2>&1 - diff -c $chk $err >> test.log && printf '[PASS]' || printf '[FAIL]' - printf "\t%s\t%s\n" $i $state + (diff -c $chk $err >> test.log && printf '[PASS]' || printf '[FAIL]' + printf "\t%s\t%s\n" $i $state) | tee -a test.log rm -f *.o done < $file diff --git a/tests/cc/error/scc-tests.lst b/tests/cc/error/scc-tests.lst @@ -1,7 +1,7 @@ 0001-sanity.c 0002-missinginclude.c 0003-junkinclude.c -0004-macroredef.c +0004-macroredef.c [TODO] 0005-fmacro.c 0006-endif.c 0007-unmatchedcppif.c [TODO] @@ -10,13 +10,13 @@ 0010-extraelif.c [TODO] 0011-extraelse.c [TODO] 0012-ifnoexpr.c [TODO] -0013-macro.c +0013-macro.c [TODO] 0014-macro.c 0015-macro.c [TODO] 0016-arrayinitsize.c [TODO] 0017-duplicatefunc.c 0018-voidparam.c [TODO] -0019-kr_names.c +0019-kr_names.c [TODO] 0020-storage.c [TODO] 0021-void.c [TODO] 0022-cpp-if.c [TODO] diff --git a/tests/cc/execute/Makefile b/tests/cc/execute/Makefile @@ -4,10 +4,14 @@ ROOT=../../.. SCCPREFIX=$(ROOT) CC=$(ROOT)/bin/scc -all: tests +all: + @CC=$(CC) ./chktest.sh scc-tests.lst tests: - @CC=$(CC) ./chktest.sh scc-tests.lst + @$(MAKE) |\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]'; printf '\tcc/execute\n' clean: rm -f a.out *.s *.s *.as *.o *.ir *.qbe *core* test.log tests.h tmp_*.c diff --git a/tests/cc/execute/chktest.sh b/tests/cc/execute/chktest.sh @@ -18,7 +18,7 @@ do state=${state:-""} rm -f a.out - (SCCPREFIX=$SCCPREFIX $CC -Isysinclude $CFLAGS "$i" && ./a.out) >>test.log 2>&1 && + ((SCCPREFIX=$SCCPREFIX $CC -Isysinclude $CFLAGS "$i" && ./a.out) >>test.log 2>&1 && printf '[PASS]' || printf '[FAIL]' - printf '\t%s\t%s\n' $i $state + printf '\t%s\t%s\n' $i $state) | tee -a test.log done < $file diff --git a/tests/ld/execute/Makefile b/tests/ld/execute/Makefile @@ -7,14 +7,19 @@ SZ = ../../../bin/scc-size OBJS = f1.o f2.o OBJLIB = f3.o -all: - @if $(AS) /dev/null 2>/dev/null;\ - then\ - $(MAKE) test;\ - fi - +all: a.out -tests: a.out +tests: + @if $(AS) 2>/dev/null;\ + then\ + $(MAKE);\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]';\ + else\ + printf '[SKIP]';\ + fi;\ + printf '\tld/execute\n' a.out: $(OBJS) f.a $(LD) $(OBJS) f.a diff --git a/tests/libc/execute/Makefile b/tests/libc/execute/Makefile @@ -5,10 +5,14 @@ CC = gcc-scc .c: $(CC) $(CFLAGS) -o $@ $< -all: tests +all: + CC=$(CC) ./chktest.sh libc-tests.lst tests: - @CC=$(CC) ./chktest.sh libc-tests.lst + @$(MAKE) |\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]'; printf '\tlibc/execute\n' clean: rm -f *.o *core test.log `awk '{print $$1}' libc-tests.lst` diff --git a/tests/libc/execute/chktest.sh b/tests/libc/execute/chktest.sh @@ -3,14 +3,13 @@ file=${1?' empty input file'} tmp1=`mktemp` tmp2=`mktemp` -trap "rm -f *.o $tmp1 $tmp2" EXIT INT QUIT TERM +#trap "rm -f *.o $tmp1 $tmp2" EXIT INT QUIT TERM ulimit -c 0 rm -f test.log while read i state do - state=${state:-"\t"} - rm -f *.o $tmp1 $tmp2 + rm -f *.o $i $tmp1 $tmp2 (echo $i $CC $CFLAGS -o $i $i.c @@ -19,5 +18,5 @@ do diff -u $tmp1 $tmp2) >> test.log 2>&1 && printf '[PASS]' || printf '[FAIL]' - printf "$state\t%s\n" $i + printf '\t%s\t%s\n' $i $state done < $file diff --git a/tests/nm/execute/Makefile b/tests/nm/execute/Makefile @@ -5,14 +5,20 @@ ROOT=../../.. OUT = z80.out AS = z80-unknown-coff-as -all: +all: $(OUT) + @PATH=$(ROOT)/bin:$$PATH:. chktest.sh + +tests: @if $(AS) 2>/dev/null;\ then\ - $(MAKE) tests;\ - fi - -tests: $(OUT) - @PATH=$(ROOT)/bin:$$PATH:. chktest.sh + $(MAKE);\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]';\ + else\ + printf '[SKIP]';\ + fi;\ + printf '\tnm/execute\n' z80.out: master.s $(AS) -o $@ master.s diff --git a/tests/size/execute/Makefile b/tests/size/execute/Makefile @@ -5,14 +5,20 @@ ROOT=../../.. AS = z80-unknown-coff-as OUT = z80.out -all: - @if $(AS) /dev/null 2>/dev/null;\ - then\ - $(MAKE) tests;\ - fi +all: $(OUT) + @PATH=$(ROOT)/bin:$$PATH:. chktest.sh -tests: $(OUT) - @PATH=$(ROOT)/bin:$$PATH:. chktest.sh;\ +tests: + @if $(AS) 2>/dev/null;\ + then\ + $(MAKE);\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]';\ + else\ + printf '[SKIP]';\ + fi;\ + printf '\tsize/execute\n' z80.out: master.s z80-unknown-coff-as -o $@ master.s diff --git a/tests/strip/execute/Makefile b/tests/strip/execute/Makefile @@ -5,14 +5,20 @@ ROOT=../../.. OUT = z80.out AS = z80-unknown-coff-as -all: +all: $(OUT) + @PATH=$(ROOT)/bin:$$PATH:. chktest.sh + +tests: @if $(AS) 2>/dev/null;\ then\ - $(MAKE) tests;\ - fi - -tests: $(OUT) - @PATH=$(ROOT)/bin:$$PATH:. chktest.sh + $(MAKE);\ + grep -v TODO |\ + grep FAIL >/dev/null &&\ + printf '[FAIL]' || printf '[PASS]';\ + else\ + printf '[SKIP]';\ + fi;\ + printf '\tstrip/execute\n' z80.out: master.s $(AS) -o $@ master.s