shithub: scc

Download patch

ref: a799fd84aabd2df4789da1fe498e2f7ced1aa141
parent: cfa8ebf26de75bc6c13ba4a872e1c9e4f12de3c4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sun Jan 19 07:00:01 EST 2020

tests-libc: Create tests-amd64 and tests-i386

Having custom modifications for every contributor was
creating problems. This patch fixed the problems adding
different targets for amd64 and for i386. By default
both are tested.

--- /dev/null
+++ b/tests/libc/execute/.gitignore
@@ -1,0 +1,38 @@
+0001-abort
+0002-assert
+0003-assert
+0004-abort
+0005-ctype
+0006-limits
+0007-signal
+0008-longjmp
+0009-stdarg
+0010-stddef
+0011-strcat
+0012-strchr
+0013-strcmp
+0014-strcoll
+0015-strcpy
+0016-strcspn
+0017-strerror
+0018-strlen
+0019-strncat
+0020-strncmp
+0021-strncpy
+0022-strnlen
+0023-strpbrk
+0024-strrchr
+0025-strspn
+0026-strstr
+0027-strtok
+0028-strxfrm
+0029-memchr
+0030-memcpy
+0031-memmove
+0032-memset
+0033-memcmp
+0034-errno
+0035-setlocale
+0036-localeconv
+0037-malloc
+test.log
--- a/tests/libc/execute/Makefile
+++ b/tests/libc/execute/Makefile
@@ -7,10 +7,13 @@
 .c:
 	$(CC) $(CFLAGS) -o $@ $<
 
-all: tests
+all: tests-i386 tests-amd64
 
-tests:
-	@SCCPREFIX=$(ROOT) ./chktest.sh libc-tests.lst
+tests-i386:
+	@SCCPREFIX=$(ROOT) CFLAGS='-a i386' ./chktest.sh libc-tests.lst
+
+tests-amd64:
+	@SCCPREFIX=$(ROOT) CFLAGS='-a amd64' ./chktest.sh libc-tests.lst
 
 clean:
 	rm -f *.o *core test.log `awk '{print $$1}' libc-tests.lst`
--- a/tests/libc/execute/chktest.sh
+++ b/tests/libc/execute/chktest.sh
@@ -3,8 +3,7 @@
 file=${1?' empty input file'}
 tmp1=`mktemp`
 tmp2=`mktemp`
-bins=`awk '{print $1}' libc-tests.lst`
-trap "rm -f *.o $bins $tmp1 $tmp2; exit" 0 1 2 3 15
+trap "rm -f *.o  $tmp1 $tmp2" EXIT INT QUIT TERM
 ulimit -c 0
 rm -f test.log
 
@@ -16,8 +15,9 @@
 	(echo $i
 	 ./cc.sh $CFLAGS -o $i $i.c
 	 echo '/^output:$/+;/^end:$/-'w $tmp1 | ed -s $i.c
-	 ./$i > $tmp2
+	 ./$i > $tmp2 2>> test.log
 	 diff -u $tmp1 $tmp2) >> test.log 2>&1 &&
+
 	printf '[PASS]' || printf '[FAIL]'
 	printf "$state\t%s\n" $i
 done < $file
--- a/tests/libc/execute/libc-tests.lst
+++ b/tests/libc/execute/libc-tests.lst
@@ -34,5 +34,4 @@
 0034-errno
 0035-setlocale
 0036-localeconv
-0037-time
-0038-malloc [TODO]
+0037-malloc [TODO]