From 34808130386c668f1f2fcf0dae8fb56681b44fa7 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 24 Feb 2019 17:51:53 +0100 Subject: [PATCH] mescc: Mes C Library: Populate with function tests from scaffold. * .gitignore: Update. * build-aux/bootstrap.sh.in: Update. * build-aux/build-mes.sh: Update. * build-aux/check-mescc.sh: Update. * lib/tests/assert/50-assert.c: Move from scaffold/tests/50-assert.c. * lib/tests/dirent/90-readdir.c: Move from scaffold/tests/99-readdir.c. * lib/tests/dirent/readdir.dir: Move from scaffold/tests/readdir.dir. * lib/tests/io/90-stat.c: Move from scaffold/tests/92-stat.c. * lib/tests/mes/30-oputs.c: Move from scaffold/tests/31-oputs.c. * lib/tests/mes/50-itoa.c: Move from scaffold/tests/51-itoa.c. * lib/tests/posix/90-unsetenv.c: Move from scaffold/tests/94-unsetenv.c. * lib/tests/setjmp/80-setjmp.c: Move from scaffold/tests/80-setjmp.c. * lib/tests/signal/90-signal.c: Move from scaffold/tests/95-signal.c. * lib/tests/stdio/70-printf-hello.c: Move from scaffold/tests/70-printf-hello.c. * lib/tests/stdio/70-printf-simple.c: Move from scaffold/tests/70-printf-simple.c. * lib/tests/stdio/70-printf.c: Move from scaffold/tests/70-printf.c. * lib/tests/stdio/80-sscanf.c: Move from scaffold/tests/87-sscanf.c. * lib/tests/stdio/90-fopen-append.c: Move from scaffold/tests/98-fopen.c. * lib/tests/stdio/90-fopen.c: Move from scaffold/tests/97-fopen.c. * lib/tests/stdio/90-fread-fwrite.c: Move from scaffold/tests/93-fread-fwrite.c. * lib/tests/stdio/90-fseek.c: Move from scaffold/tests/91-fseek.c. * lib/tests/stdlib/50-getenv.c: Move from lib/tests/stdlib/getenv.c. * lib/tests/stdlib/50-malloc.c: Move from lib/tests/stdlib/malloc.c. * lib/tests/stdlib/70-strtoull.c: Move from scaffold/tests/7j-strtoull.c. * lib/tests/stdlib/80-qsort-dupes.c: Move from scaffold/tests/81-qsort-dupes.c. * lib/tests/stdlib/80-qsort.c: Move from scaffold/tests/81-qsort.c. * lib/tests/stdlib/90-strtol.c: Move from scaffold/tests/96-strto.c. * lib/tests/string/30-strlen.c: Move from scaffold/tests/30-strlen.c. * lib/tests/string/50-strcmp.c: Move from scaffold/tests/51-strcmp.c. * lib/tests/string/50-strcpy.c: Move from scaffold/tests/53-strcpy.c. * lib/tests/string/50-strncmp.c: Move from scaffold/tests/51-strncmp.c. * lib/tests/string/70-strchr.c: Move from scaffold/tests/70-strchr.c. * lib/tests/string/80-strncpy.c: Move from scaffold/tests/86-strncpy.c. * lib/tests/string/80-strrchr.c: Move from scaffold/tests/88-strrchr.c. * lib/tests/string/90-snprintf.c: Move from scaffold/tests/9a-snprintf.c. * lib/tests/string/90-strpbrk.c: Move from scaffold/tests/90-strpbrk.c. * lib/tests/string/90-strspn.c: Move from scaffold/tests/90-strspn.c. --- .gitignore | 12 +- build-aux/bootstrap.sh.in | 4 +- build-aux/build-mes.sh | 8 +- build-aux/check-mescc.sh | 399 +++++++++--------- build-aux/test-cc.sh | 8 +- lib/libc.c | 8 +- lib/{stdlib => posix}/getenv.c | 0 lib/{stdlib => posix}/setenv.c | 0 .../tests => lib/tests/assert}/50-assert.c | 0 .../tests/dirent/90-readdir.c | 6 +- .../tests/dirent}/readdir.dir/dir/.keep | 0 .../tests/dirent}/readdir.dir/file | 0 .../tests/dirent}/readdir.dir/link | 0 .../tests/92-stat.c => lib/tests/io/90-stat.c | 0 .../31-oputs.c => lib/tests/mes/30-oputs.c | 0 .../51-itoa.c => lib/tests/mes/50-itoa.c | 0 .../{stdlib/getenv.c => posix/50-getenv.c} | 7 - .../tests/posix/90-unsetenv.c | 0 .../tests => lib/tests/setjmp}/80-setjmp.c | 0 .../tests/signal/90-signal.c | 0 .../tests/stdio}/70-printf-hello.c | 0 .../tests/stdio}/70-printf-simple.c | 0 .../tests => lib/tests/stdio}/70-printf.c | 0 .../tests/stdio/80-sscanf.c | 0 .../tests/stdio/90-fopen-append.c | 0 .../97-fopen.c => lib/tests/stdio/90-fopen.c | 0 .../tests/stdio/90-fread-fwrite.c | 0 .../91-fseek.c => lib/tests/stdio/90-fseek.c | 0 lib/tests/stdlib/{malloc.c => 50-malloc.c} | 0 .../tests/stdlib/70-strtoull.c | 0 .../tests/stdlib/80-qsort-dupes.c | 0 .../81-qsort.c => lib/tests/stdlib/80-qsort.c | 0 .../tests/stdlib/90-strtol.c | 0 .../tests => lib/tests/string}/30-strlen.c | 0 .../tests/string/50-strcmp.c | 0 .../tests/string/50-strcpy.c | 0 .../tests/string/50-strncmp.c | 0 .../tests => lib/tests/string}/70-strchr.c | 0 .../tests/string/80-strncpy.c | 0 .../tests/string/80-strrchr.c | 0 .../tests/string/90-snprintf.c | 0 .../tests => lib/tests/string}/90-strpbrk.c | 0 .../tests => lib/tests/string}/90-strspn.c | 0 43 files changed, 228 insertions(+), 224 deletions(-) rename lib/{stdlib => posix}/getenv.c (100%) rename lib/{stdlib => posix}/setenv.c (100%) rename {scaffold/tests => lib/tests/assert}/50-assert.c (100%) rename scaffold/tests/99-readdir.c => lib/tests/dirent/90-readdir.c (93%) rename {scaffold/tests => lib/tests/dirent}/readdir.dir/dir/.keep (100%) rename {scaffold/tests => lib/tests/dirent}/readdir.dir/file (100%) rename {scaffold/tests => lib/tests/dirent}/readdir.dir/link (100%) rename scaffold/tests/92-stat.c => lib/tests/io/90-stat.c (100%) rename scaffold/tests/31-oputs.c => lib/tests/mes/30-oputs.c (100%) rename scaffold/tests/51-itoa.c => lib/tests/mes/50-itoa.c (100%) rename lib/tests/{stdlib/getenv.c => posix/50-getenv.c} (84%) rename scaffold/tests/94-unsetenv.c => lib/tests/posix/90-unsetenv.c (100%) rename {scaffold/tests => lib/tests/setjmp}/80-setjmp.c (100%) rename scaffold/tests/95-signal.c => lib/tests/signal/90-signal.c (100%) rename {scaffold/tests => lib/tests/stdio}/70-printf-hello.c (100%) rename {scaffold/tests => lib/tests/stdio}/70-printf-simple.c (100%) rename {scaffold/tests => lib/tests/stdio}/70-printf.c (100%) rename scaffold/tests/87-sscanf.c => lib/tests/stdio/80-sscanf.c (100%) rename scaffold/tests/98-fopen.c => lib/tests/stdio/90-fopen-append.c (100%) rename scaffold/tests/97-fopen.c => lib/tests/stdio/90-fopen.c (100%) rename scaffold/tests/93-fread-fwrite.c => lib/tests/stdio/90-fread-fwrite.c (100%) rename scaffold/tests/91-fseek.c => lib/tests/stdio/90-fseek.c (100%) rename lib/tests/stdlib/{malloc.c => 50-malloc.c} (100%) rename scaffold/tests/7j-strtoull.c => lib/tests/stdlib/70-strtoull.c (100%) rename scaffold/tests/81-qsort-dupes.c => lib/tests/stdlib/80-qsort-dupes.c (100%) rename scaffold/tests/81-qsort.c => lib/tests/stdlib/80-qsort.c (100%) rename scaffold/tests/96-strto.c => lib/tests/stdlib/90-strtol.c (100%) rename {scaffold/tests => lib/tests/string}/30-strlen.c (100%) rename scaffold/tests/51-strcmp.c => lib/tests/string/50-strcmp.c (100%) rename scaffold/tests/53-strcpy.c => lib/tests/string/50-strcpy.c (100%) rename scaffold/tests/51-strncmp.c => lib/tests/string/50-strncmp.c (100%) rename {scaffold/tests => lib/tests/string}/70-strchr.c (100%) rename scaffold/tests/86-strncpy.c => lib/tests/string/80-strncpy.c (100%) rename scaffold/tests/88-strrchr.c => lib/tests/string/80-strrchr.c (100%) rename scaffold/tests/9a-snprintf.c => lib/tests/string/90-snprintf.c (100%) rename {scaffold/tests => lib/tests/string}/90-strpbrk.c (100%) rename {scaffold/tests => lib/tests/string}/90-strspn.c (100%) diff --git a/.gitignore b/.gitignore index 85704447..90cb9dca 100644 --- a/.gitignore +++ b/.gitignore @@ -62,6 +62,12 @@ /lib/x86-mes/0exit-42 /lib/x86-mes/exit-42 +/lib/tests/*/[0-9a][0-9a-z]-* +/lib/tests/*/x86-mes-* +!/lib/tests/*/*.c +!/lib/tests/*/*.exit +!/lib/tests/*/*.stdout + /scaffold/argv /scaffold/hello /scaffold/main @@ -73,7 +79,11 @@ /scaffold/x86_64-mes-* /scaffold/tests/x86-mes-* -/scaffold/tests/[0-9a][0-9a-z]-[^.]* +/scaffold/tests/[0-9a][0-9a-z]-* +/scaffold/tests/t.* +!/scaffold/tests/*.c +!/scaffold/tests/*.exit +!/scaffold/tests/*.stdout /src/mes.mes.symbols.h /src/gc.mes.h diff --git a/build-aux/bootstrap.sh.in b/build-aux/bootstrap.sh.in index e87ec4c5..1559299f 100644 --- a/build-aux/bootstrap.sh.in +++ b/build-aux/bootstrap.sh.in @@ -51,9 +51,9 @@ mv lib/libc+gnu.x86-mes-o lib/x86-mes/libc+gnu.o @GUILE@ -e main -L module scripts/mescc.scm -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/x86-mes-argv scaffold/argv.x86-mes-o -l c-mini -@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/tests/stdlib/malloc.x86-mes-o lib/tests/stdlib/malloc.c +@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/tests/stdlib/50-malloc.x86-mes-o lib/tests/stdlib/50-malloc.c -@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/tests/stdlib/getenv.x86-mes-o lib/tests/stdlib/getenv.c +@GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o lib/tests/posix/50-getenv.x86-mes-o lib/tests/posix/50-getenv.c @GUILE@ -e main -L module scripts/mescc.scm -c -D 'VERSION="@VERSION@"' -D 'MODULEDIR="@moduledir@"' -D 'PREFIX="@prefix@"' -I . -I lib -I include -v -g -L lib/linux/x86-mes -L lib/linux -L lib/x86-mes -L lib -L @MES_SEED@ -o scaffold/micro-mes.x86-mes-o scaffold/micro-mes.c diff --git a/build-aux/build-mes.sh b/build-aux/build-mes.sh index c0b2857b..5254bfcc 100755 --- a/build-aux/build-mes.sh +++ b/build-aux/build-mes.sh @@ -69,11 +69,11 @@ compile scaffold/hello compile scaffold/argv (libc="-l c-mini" link scaffold/argv) -[ "$mes_p" ] && compile lib/tests/stdlib/malloc -[ "$mes_p" ] && link lib/tests/stdlib/malloc +[ "$mes_p" ] && compile lib/tests/stdlib/50-malloc +[ "$mes_p" ] && link lib/tests/stdlib/50-malloc -[ "$mes_p" ] && compile lib/tests/stdlib/getenv -[ "$mes_p" ] && link lib/tests/stdlib/getenv +[ "$mes_p" ] && compile lib/tests/posix/50-getenv +[ "$mes_p" ] && link lib/tests/posix/50-getenv [ "$mes_p" ] && compile scaffold/micro-mes diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index f1b821fd..3504eb16 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -26,206 +26,207 @@ set -e test_sh=${test_sh-${srcdest}build-aux/test.sh} tests=" -t -00-exit-0 -01-return-0 -02-return-1 -03-call -04-call-0 -05-call-1 -06-call-!1 -06-!call-1 -06-call-2 -06-call-string -06-call-variable -06-return-void -07-include -08-assign -08-assign-negative -08-assign-global -10-if-0 -11-if-1 -12-if-== -13-if-!= -14-if-goto -15-if-!f -16-if-t -17-compare-char -17-compare-ge -17-compare-gt -17-compare-le -17-compare-lt -17-compare-unsigned-ge -17-compare-unsigned-gt -17-compare-unsigned-le -17-compare-unsigned-lt -17-compare-unsigned-char-le -17-compare-unsigned-short-le -17-compare-unsigned-long-le -17-compare-and -17-compare-or -17-compare-and-or -17-compare-assign -17-compare-call -18-assign-shadow -20-while -21-char[]-simple -21-char[] -22-while-char[] -23-global-pointer-init-null -23-global-pointer-init -23-global-pointer-ref -23-global-pointer-pointer-ref -23-pointer-sub -23-pointer -30-strlen -31-oputs -32-call-wrap -32-compare -33-and-or -34-pre-post -35-compare-char -36-compare-arithmetic -37-compare-assign -38-compare-call-2 -38-compare-call-3 -38-compare-call -40-if-else -41-? -42-goto-label -43-for-do-while -44-switch -44-switch-fallthrough -44-switch-body-fallthrough -45-void-call -46-function-static -47-function-expression -48-global-static -50-assert -51-pointer-sub -51-itoa -51-strcmp -51-strncmp -53-strcpy -54-argc -54-argv -55-char-array -60-math -61-array -62-array -63-struct -63-struct-pointer -63-struct-local -63-struct-function -63-struct-assign -63-struct-array -63-struct-array-assign -63-struct-array-compare -63-struct-cell -64-make-cell -65-read -66-local-char-array -70-strchr -70-stdarg -70-printf-hello -70-printf-simple -70-printf -71-struct-array -72-typedef-struct-def -73-union-hello -73-union -74-multi-line-string -75-struct-union -76-pointer-arithmetic-pp -76-pointer-arithmetic -77-pointer-assign -78-union-struct -79-int-array-simple -79-int-array -7a-struct-char-array -7b-struct-int-array-hello -7b-struct-int-array-pointer -7b-struct-int-array -7c-dynarray -7d-cast-char -7e-struct-array-access -7f-struct-pointer-arithmetic -7g-struct-byte-word-field -7h-struct-assign -7i-struct-struct-simple -7i-struct-struct -7j-strtoull -7k-empty-for -7k-for-each-elem-simple -7k-for-each-elem -7l-struct-any-size-array-simple -7l-struct-any-size-array -7m-struct-char-array-assign -7n-struct-struct-array -7o-struct-pre-post-simple -7o-struct-pre-post -7p-struct-cast -7q-bit-field-simple -7q-bit-field -7r-sign-extend -7s-struct-short -7s-unsigned-compare -7t-function-destruct -7u-double -7u-long-long -7u-?-expression -7u-call-? -7u-inc-byte-word -7u-struct-func -7u-struct-size10 -7u-vstack -80-setjmp -81-qsort -81-qsort-dupes -82-define -83-heterogenoous-init -84-struct-field-list -85-sizeof -86-strncpy -87-sscanf -88-strrchr -90-strspn -90-strpbrk -91-fseek -92-stat -93-fread-fwrite -94-unsetenv -95-signal -96-strto -97-fopen -98-fopen -99-readdir -9a-snprintf -a0-call-trunc-char -a0-call-trunc-short -a0-call-trunc-int -a0-math-divide-signed-negative -a1-global-no-align -a1-global-no-clobber +scaffold/tests/t +scaffold/tests/00-exit-0 +scaffold/tests/01-return-0 +scaffold/tests/02-return-1 +scaffold/tests/03-call +scaffold/tests/04-call-0 +scaffold/tests/05-call-1 +scaffold/tests/06-call-!1 +scaffold/tests/06-!call-1 +scaffold/tests/06-call-2 +scaffold/tests/06-call-string +scaffold/tests/06-call-variable +scaffold/tests/06-return-void +scaffold/tests/07-include +scaffold/tests/08-assign +scaffold/tests/08-assign-negative +scaffold/tests/08-assign-global +scaffold/tests/10-if-0 +scaffold/tests/11-if-1 +scaffold/tests/12-if-== +scaffold/tests/13-if-!= +scaffold/tests/14-if-goto +scaffold/tests/15-if-!f +scaffold/tests/16-if-t +scaffold/tests/17-compare-char +scaffold/tests/17-compare-ge +scaffold/tests/17-compare-gt +scaffold/tests/17-compare-le +scaffold/tests/17-compare-lt +scaffold/tests/17-compare-unsigned-ge +scaffold/tests/17-compare-unsigned-gt +scaffold/tests/17-compare-unsigned-le +scaffold/tests/17-compare-unsigned-lt +scaffold/tests/17-compare-unsigned-char-le +scaffold/tests/17-compare-unsigned-short-le +scaffold/tests/17-compare-unsigned-long-le +scaffold/tests/17-compare-and +scaffold/tests/17-compare-or +scaffold/tests/17-compare-and-or +scaffold/tests/17-compare-assign +scaffold/tests/17-compare-call +scaffold/tests/18-assign-shadow +scaffold/tests/20-while +scaffold/tests/21-char[]-simple +scaffold/tests/21-char[] +scaffold/tests/22-while-char[] +scaffold/tests/23-global-pointer-init-null +scaffold/tests/23-global-pointer-init +scaffold/tests/23-global-pointer-ref +scaffold/tests/23-global-pointer-pointer-ref +scaffold/tests/23-pointer-sub +scaffold/tests/23-pointer +lib/tests/mes/30-oputs +lib/tests/string/30-strlen +scaffold/tests/32-call-wrap +scaffold/tests/32-compare +scaffold/tests/33-and-or +scaffold/tests/34-pre-post +scaffold/tests/35-compare-char +scaffold/tests/36-compare-arithmetic +scaffold/tests/37-compare-assign +scaffold/tests/38-compare-call-2 +scaffold/tests/38-compare-call-3 +scaffold/tests/38-compare-call +scaffold/tests/40-if-else +scaffold/tests/41-? +scaffold/tests/42-goto-label +scaffold/tests/43-for-do-while +scaffold/tests/44-switch +scaffold/tests/44-switch-fallthrough +scaffold/tests/44-switch-body-fallthrough +scaffold/tests/45-void-call +scaffold/tests/46-function-static +scaffold/tests/47-function-expression +scaffold/tests/48-global-static +lib/tests/assert/50-assert +lib/tests/mes/50-itoa +lib/tests/posix/50-getenv +lib/tests/string/50-strcmp +lib/tests/string/50-strcpy +lib/tests/string/50-strncmp +scaffold/tests/51-pointer-sub +scaffold/tests/54-argc +scaffold/tests/54-argv +scaffold/tests/55-char-array +scaffold/tests/60-math +scaffold/tests/61-array +scaffold/tests/62-array +scaffold/tests/63-struct +scaffold/tests/63-struct-pointer +scaffold/tests/63-struct-local +scaffold/tests/63-struct-function +scaffold/tests/63-struct-assign +scaffold/tests/63-struct-array +scaffold/tests/63-struct-array-assign +scaffold/tests/63-struct-array-compare +scaffold/tests/63-struct-cell +scaffold/tests/64-make-cell +scaffold/tests/65-read +scaffold/tests/66-local-char-array +scaffold/tests/70-stdarg +lib/tests/stdio/70-printf-hello +lib/tests/stdio/70-printf-simple +lib/tests/stdio/70-printf +lib/tests/stdlib/70-strtoull +lib/tests/string/70-strchr +scaffold/tests/71-struct-array +scaffold/tests/72-typedef-struct-def +scaffold/tests/73-union-hello +scaffold/tests/73-union +scaffold/tests/74-multi-line-string +scaffold/tests/75-struct-union +scaffold/tests/76-pointer-arithmetic-pp +scaffold/tests/76-pointer-arithmetic +scaffold/tests/77-pointer-assign +scaffold/tests/78-union-struct +scaffold/tests/79-int-array-simple +scaffold/tests/79-int-array +scaffold/tests/7a-struct-char-array +scaffold/tests/7b-struct-int-array-hello +scaffold/tests/7b-struct-int-array-pointer +scaffold/tests/7b-struct-int-array +scaffold/tests/7c-dynarray +scaffold/tests/7d-cast-char +scaffold/tests/7e-struct-array-access +scaffold/tests/7f-struct-pointer-arithmetic +scaffold/tests/7g-struct-byte-word-field +scaffold/tests/7h-struct-assign +scaffold/tests/7i-struct-struct-simple +scaffold/tests/7i-struct-struct +scaffold/tests/7k-empty-for +scaffold/tests/7k-for-each-elem-simple +scaffold/tests/7k-for-each-elem +scaffold/tests/7l-struct-any-size-array-simple +scaffold/tests/7l-struct-any-size-array +scaffold/tests/7m-struct-char-array-assign +scaffold/tests/7n-struct-struct-array +scaffold/tests/7o-struct-pre-post-simple +scaffold/tests/7o-struct-pre-post +scaffold/tests/7p-struct-cast +scaffold/tests/7q-bit-field-simple +scaffold/tests/7q-bit-field +scaffold/tests/7r-sign-extend +scaffold/tests/7s-struct-short +scaffold/tests/7s-unsigned-compare +scaffold/tests/7t-function-destruct +scaffold/tests/7u-double +scaffold/tests/7u-long-long +scaffold/tests/7u-?-expression +scaffold/tests/7u-call-? +scaffold/tests/7u-inc-byte-word +scaffold/tests/7u-struct-func +scaffold/tests/7u-struct-size10 +scaffold/tests/7u-vstack +lib/tests/setjmp/80-setjmp +lib/tests/stdio/80-sscanf +lib/tests/stdlib/80-qsort +lib/tests/stdlib/80-qsort-dupes +lib/tests/string/80-strncpy +lib/tests/string/80-strrchr +scaffold/tests/82-define +scaffold/tests/83-heterogenoous-init +scaffold/tests/84-struct-field-list +scaffold/tests/85-sizeof +lib/tests/dirent/90-readdir +lib/tests/io/90-stat +lib/tests/posix/90-unsetenv +lib/tests/signal/90-signal +lib/tests/stdio/90-fopen +lib/tests/stdio/90-fopen-append +lib/tests/stdio/90-fread-fwrite +lib/tests/stdio/90-fseek +lib/tests/stdlib/90-strtol +lib/tests/string/90-snprintf +lib/tests/string/90-strpbrk +lib/tests/string/90-strspn +scaffold/tests/a0-call-trunc-char +scaffold/tests/a0-call-trunc-short +scaffold/tests/a0-call-trunc-int +scaffold/tests/a0-math-divide-signed-negative +scaffold/tests/a1-global-no-align +scaffold/tests/a1-global-no-clobber " broken="$broken -17-compare-unsigned-char-le -17-compare-unsigned-short-le -66-local-char-array -a0-call-trunc-int -a0-math-divide-signed-negative +scaffold/tests/17-compare-unsigned-char-le +scaffold/tests/17-compare-unsigned-short-le +scaffold/tests/66-local-char-array +scaffold/tests/a0-call-trunc-int +scaffold/tests/a0-math-divide-signed-negative " if [ "$mes_arch" = "x86_64-gcc" ]; then broken="$broken -21-char[] -41-? -70-printf-stdarg -70-printf-simple -70-printf -80-setjmp -a1-global-no-align +scaffold/tests/21-char[] +scaffold/tests/41-? +scaffold/tests/stdio/70-printf-stdarg +scaffold/tests/stdio/70-printf-simple +scaffold/tests/stdio/70-printf +lib/tests/setjmp/80-setjmp +scaffold/tests/a1-global-no-align " fi @@ -234,20 +235,20 @@ expect=$(echo $broken | wc -w) pass=0 fail=0 total=0 -mkdir -p scaffold/tests for t in $tests; do - if [ -z "${t/[012][0-9]-*/}" ]; then + b=$(basename "$t") + if [ -z "${b/[012][0-9]-*/}" ]; then libc= - elif [ -z "${t/[34][0-9]-*/}" ]; then + elif [ -z "${b/[34][0-9]-*/}" ]; then libc='-l c-mini' - elif [ -z "${t/[78][0-9a-z]-*/}" ]; then + elif [ -z "${b/[78][0-9a-z]-*/}" ]; then libc='-l c+tcc' - elif [ -z "${t/9[0-9a-z]-*/}" ]; then + elif [ -z "${b/9[0-9a-z]-*/}" ]; then libc='-l c+gnu' else libc='-l c' fi - sh $test_sh "scaffold/tests/$t" &> scaffold/tests/"$t".log + sh $test_sh "$t" &> "$t".log r=$? total=$((total+1)) if [ $r = 0 ]; then diff --git a/build-aux/test-cc.sh b/build-aux/test-cc.sh index 99231b1f..ffc5bc5b 100755 --- a/build-aux/test-cc.sh +++ b/build-aux/test-cc.sh @@ -38,12 +38,12 @@ link "$t" r=0 [ -f "$t".exit ] && r=$(cat "$t".exit) set +e -$(dirname "$o")/${program_prefix}$(basename "$o") $ARGS > "$o".${program_prefix}stdout +$(dirname "$o")/${program_prefix}$(basename "$o") $ARGS > "$o".${program_prefix}1 2> "$o".${program_prefix}2 m=$? -cat "$o".${program_prefix}stdout +cat "$o".${program_prefix}1 set -e [ $m = $r ] -if [ -f "$t".expect ]; then - $DIFF -ub "$t".expect "$o".${program_prefix}stdout +if [ -f "$t".stdout ]; then + $DIFF -ub "$t".stdout "$o".${program_prefix}1 fi diff --git a/lib/libc.c b/lib/libc.c index 996f01f9..0d0c99ad 100644 --- a/lib/libc.c +++ b/lib/libc.c @@ -60,9 +60,9 @@ __mes_debug () #if !___GNU__ -#include -#include #include +#include +#include #endif #include @@ -82,9 +82,9 @@ __mes_debug () #include #include -#include -#include +#include #include +#include #include #include diff --git a/lib/stdlib/getenv.c b/lib/posix/getenv.c similarity index 100% rename from lib/stdlib/getenv.c rename to lib/posix/getenv.c diff --git a/lib/stdlib/setenv.c b/lib/posix/setenv.c similarity index 100% rename from lib/stdlib/setenv.c rename to lib/posix/setenv.c diff --git a/scaffold/tests/50-assert.c b/lib/tests/assert/50-assert.c similarity index 100% rename from scaffold/tests/50-assert.c rename to lib/tests/assert/50-assert.c diff --git a/scaffold/tests/99-readdir.c b/lib/tests/dirent/90-readdir.c similarity index 93% rename from scaffold/tests/99-readdir.c rename to lib/tests/dirent/90-readdir.c index b974e75a..5b4043be 100644 --- a/scaffold/tests/99-readdir.c +++ b/lib/tests/dirent/90-readdir.c @@ -34,20 +34,20 @@ qsort_strcmp (void const* a, void const* b) int main () { - DIR *d = opendir ("scaffold/tests/readdir-fu"); + DIR *d = opendir ("lib/tests/dirent/readdir-fu"); if (d) return 1; if (errno != ENOENT) return 2; - d = opendir ("scaffold/tests/99-readdir.c"); + d = opendir ("lib/tests/dirent/90-readdir.c"); if (d) return 3; if (errno != ENOTDIR) return 4; errno = 0; - d = opendir ("scaffold/tests/readdir.dir"); + d = opendir ("lib/tests/dirent/readdir.dir"); if (!d) return 5; diff --git a/scaffold/tests/readdir.dir/dir/.keep b/lib/tests/dirent/readdir.dir/dir/.keep similarity index 100% rename from scaffold/tests/readdir.dir/dir/.keep rename to lib/tests/dirent/readdir.dir/dir/.keep diff --git a/scaffold/tests/readdir.dir/file b/lib/tests/dirent/readdir.dir/file similarity index 100% rename from scaffold/tests/readdir.dir/file rename to lib/tests/dirent/readdir.dir/file diff --git a/scaffold/tests/readdir.dir/link b/lib/tests/dirent/readdir.dir/link similarity index 100% rename from scaffold/tests/readdir.dir/link rename to lib/tests/dirent/readdir.dir/link diff --git a/scaffold/tests/92-stat.c b/lib/tests/io/90-stat.c similarity index 100% rename from scaffold/tests/92-stat.c rename to lib/tests/io/90-stat.c diff --git a/scaffold/tests/31-oputs.c b/lib/tests/mes/30-oputs.c similarity index 100% rename from scaffold/tests/31-oputs.c rename to lib/tests/mes/30-oputs.c diff --git a/scaffold/tests/51-itoa.c b/lib/tests/mes/50-itoa.c similarity index 100% rename from scaffold/tests/51-itoa.c rename to lib/tests/mes/50-itoa.c diff --git a/lib/tests/stdlib/getenv.c b/lib/tests/posix/50-getenv.c similarity index 84% rename from lib/tests/stdlib/getenv.c rename to lib/tests/posix/50-getenv.c index 40130793..f58b7fdd 100644 --- a/lib/tests/stdlib/getenv.c +++ b/lib/tests/posix/50-getenv.c @@ -19,14 +19,7 @@ */ #include "libmes.h" -#include "string.h" #include "stdlib.h" -#define strlen xstrlen -#define strncmp xstrncmp -#define getenv xgetenv -#include "lib/string/strlen.c" -#include "lib/string/strncmp.c" -#include "lib/stdlib/getenv.c" int main (int argc, char const *argv[]) diff --git a/scaffold/tests/94-unsetenv.c b/lib/tests/posix/90-unsetenv.c similarity index 100% rename from scaffold/tests/94-unsetenv.c rename to lib/tests/posix/90-unsetenv.c diff --git a/scaffold/tests/80-setjmp.c b/lib/tests/setjmp/80-setjmp.c similarity index 100% rename from scaffold/tests/80-setjmp.c rename to lib/tests/setjmp/80-setjmp.c diff --git a/scaffold/tests/95-signal.c b/lib/tests/signal/90-signal.c similarity index 100% rename from scaffold/tests/95-signal.c rename to lib/tests/signal/90-signal.c diff --git a/scaffold/tests/70-printf-hello.c b/lib/tests/stdio/70-printf-hello.c similarity index 100% rename from scaffold/tests/70-printf-hello.c rename to lib/tests/stdio/70-printf-hello.c diff --git a/scaffold/tests/70-printf-simple.c b/lib/tests/stdio/70-printf-simple.c similarity index 100% rename from scaffold/tests/70-printf-simple.c rename to lib/tests/stdio/70-printf-simple.c diff --git a/scaffold/tests/70-printf.c b/lib/tests/stdio/70-printf.c similarity index 100% rename from scaffold/tests/70-printf.c rename to lib/tests/stdio/70-printf.c diff --git a/scaffold/tests/87-sscanf.c b/lib/tests/stdio/80-sscanf.c similarity index 100% rename from scaffold/tests/87-sscanf.c rename to lib/tests/stdio/80-sscanf.c diff --git a/scaffold/tests/98-fopen.c b/lib/tests/stdio/90-fopen-append.c similarity index 100% rename from scaffold/tests/98-fopen.c rename to lib/tests/stdio/90-fopen-append.c diff --git a/scaffold/tests/97-fopen.c b/lib/tests/stdio/90-fopen.c similarity index 100% rename from scaffold/tests/97-fopen.c rename to lib/tests/stdio/90-fopen.c diff --git a/scaffold/tests/93-fread-fwrite.c b/lib/tests/stdio/90-fread-fwrite.c similarity index 100% rename from scaffold/tests/93-fread-fwrite.c rename to lib/tests/stdio/90-fread-fwrite.c diff --git a/scaffold/tests/91-fseek.c b/lib/tests/stdio/90-fseek.c similarity index 100% rename from scaffold/tests/91-fseek.c rename to lib/tests/stdio/90-fseek.c diff --git a/lib/tests/stdlib/malloc.c b/lib/tests/stdlib/50-malloc.c similarity index 100% rename from lib/tests/stdlib/malloc.c rename to lib/tests/stdlib/50-malloc.c diff --git a/scaffold/tests/7j-strtoull.c b/lib/tests/stdlib/70-strtoull.c similarity index 100% rename from scaffold/tests/7j-strtoull.c rename to lib/tests/stdlib/70-strtoull.c diff --git a/scaffold/tests/81-qsort-dupes.c b/lib/tests/stdlib/80-qsort-dupes.c similarity index 100% rename from scaffold/tests/81-qsort-dupes.c rename to lib/tests/stdlib/80-qsort-dupes.c diff --git a/scaffold/tests/81-qsort.c b/lib/tests/stdlib/80-qsort.c similarity index 100% rename from scaffold/tests/81-qsort.c rename to lib/tests/stdlib/80-qsort.c diff --git a/scaffold/tests/96-strto.c b/lib/tests/stdlib/90-strtol.c similarity index 100% rename from scaffold/tests/96-strto.c rename to lib/tests/stdlib/90-strtol.c diff --git a/scaffold/tests/30-strlen.c b/lib/tests/string/30-strlen.c similarity index 100% rename from scaffold/tests/30-strlen.c rename to lib/tests/string/30-strlen.c diff --git a/scaffold/tests/51-strcmp.c b/lib/tests/string/50-strcmp.c similarity index 100% rename from scaffold/tests/51-strcmp.c rename to lib/tests/string/50-strcmp.c diff --git a/scaffold/tests/53-strcpy.c b/lib/tests/string/50-strcpy.c similarity index 100% rename from scaffold/tests/53-strcpy.c rename to lib/tests/string/50-strcpy.c diff --git a/scaffold/tests/51-strncmp.c b/lib/tests/string/50-strncmp.c similarity index 100% rename from scaffold/tests/51-strncmp.c rename to lib/tests/string/50-strncmp.c diff --git a/scaffold/tests/70-strchr.c b/lib/tests/string/70-strchr.c similarity index 100% rename from scaffold/tests/70-strchr.c rename to lib/tests/string/70-strchr.c diff --git a/scaffold/tests/86-strncpy.c b/lib/tests/string/80-strncpy.c similarity index 100% rename from scaffold/tests/86-strncpy.c rename to lib/tests/string/80-strncpy.c diff --git a/scaffold/tests/88-strrchr.c b/lib/tests/string/80-strrchr.c similarity index 100% rename from scaffold/tests/88-strrchr.c rename to lib/tests/string/80-strrchr.c diff --git a/scaffold/tests/9a-snprintf.c b/lib/tests/string/90-snprintf.c similarity index 100% rename from scaffold/tests/9a-snprintf.c rename to lib/tests/string/90-snprintf.c diff --git a/scaffold/tests/90-strpbrk.c b/lib/tests/string/90-strpbrk.c similarity index 100% rename from scaffold/tests/90-strpbrk.c rename to lib/tests/string/90-strpbrk.c diff --git a/scaffold/tests/90-strspn.c b/lib/tests/string/90-strspn.c similarity index 100% rename from scaffold/tests/90-strspn.c rename to lib/tests/string/90-strspn.c