test: Build initial scaffold tests without libc.

* scaffold/argv.c (strcmp): New function; support building without
libc.
* build-aux/build-cc.sh: Build initial scaffold tests without libc.
* build-aux/build-cc32.sh: Likewise.
* build-aux/build-mes.sh: Likewise.
* build-aux/check-mescc.sh: Likewise.
* scaffold/read.data: Rename from `mesmes'.
* scaffold/read.c: Rename from `m.c'; update.
This commit is contained in:
Jan Nieuwenhuizen 2018-08-15 17:47:03 +02:00
parent 25047c7606
commit 7a849284dc
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
7 changed files with 37 additions and 17 deletions

View file

@ -59,9 +59,10 @@ ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libtcc1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+gnu ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libg ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc64-mes.sh lib/libg
sh ${srcdest}build-aux/cc64-mes.sh scaffold/main LIBC= sh ${srcdest}build-aux/cc64-mes.sh scaffold/main
sh ${srcdest}build-aux/cc64-mes.sh scaffold/hello LIBC=c-mini sh ${srcdest}build-aux/cc64-mes.sh scaffold/hello
sh ${srcdest}build-aux/cc64-mes.sh scaffold/argv LIBC=c-mini sh ${srcdest}build-aux/cc64-mes.sh scaffold/argv
sh ${srcdest}build-aux/cc64-mes.sh scaffold/read
sh ${srcdest}build-aux/cc64-mes.sh scaffold/malloc sh ${srcdest}build-aux/cc64-mes.sh scaffold/malloc
sh ${srcdest}build-aux/cc64-mes.sh scaffold/micro-mes sh ${srcdest}build-aux/cc64-mes.sh scaffold/micro-mes
sh ${srcdest}build-aux/cc64-mes.sh scaffold/tiny-mes sh ${srcdest}build-aux/cc64-mes.sh scaffold/tiny-mes

View file

@ -57,9 +57,10 @@ ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libtcc1
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc+gnu ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libc+gnu
ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libg ARCHDIR=1 NOLINK=1 sh ${srcdest}build-aux/cc32-mes.sh lib/libg
sh ${srcdest}build-aux/cc32-mes.sh scaffold/main LIBC= sh ${srcdest}build-aux/cc32-mes.sh scaffold/main
sh ${srcdest}build-aux/cc32-mes.sh scaffold/hello LIBC=c-mini sh ${srcdest}build-aux/cc32-mes.sh scaffold/hello
sh ${srcdest}build-aux/cc32-mes.sh scaffold/argv LIBC=c-mini sh ${srcdest}build-aux/cc32-mes.sh scaffold/argv
sh ${srcdest}build-aux/cc32-mes.sh scaffold/read
sh ${srcdest}build-aux/cc32-mes.sh scaffold/malloc sh ${srcdest}build-aux/cc32-mes.sh scaffold/malloc
sh ${srcdest}build-aux/cc32-mes.sh scaffold/micro-mes sh ${srcdest}build-aux/cc32-mes.sh scaffold/micro-mes
sh ${srcdest}build-aux/cc32-mes.sh scaffold/tiny-mes sh ${srcdest}build-aux/cc32-mes.sh scaffold/tiny-mes

View file

@ -116,8 +116,7 @@ fi
MES_ARENA=100000000 MES_ARENA=100000000
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/x86-mes/crt1 ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/linux/x86-mes/crt1
ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc-mini ARCHDIR=1 NOLINK=1 bash ${srcdest}build-aux/cc-mes.sh lib/libc-mini
MES_LIBS='-l c-mini' PREPROCESS= bash ${srcdest}build-aux/cc-mes.sh lib/x86-mes/exit-42
PREPROCESS= bash ${srcdest}build-aux/cc-mes.sh lib/x86-mes/exit-42
trace "TEST lib/x86-mes/exit-42.mes-out" echo lib/x86-mes/exit-42.mes-out trace "TEST lib/x86-mes/exit-42.mes-out" echo lib/x86-mes/exit-42.mes-out
{ set +e; lib/x86-mes/exit-42.mes-out; r=$?; set -e; } { set +e; lib/x86-mes/exit-42.mes-out; r=$?; set -e; }
@ -147,9 +146,14 @@ trace "SNARF.mes vector.c" ./pre-inst-env bash ${srcdest}build-aux/mes-snarf.sc
echo MES_ARENA=$MES_ARENA echo MES_ARENA=$MES_ARENA
bash ${srcdest}build-aux/cc-mes.sh scaffold/main bash ${srcdest}build-aux/cc-mes.sh scaffold/main
bash ${srcdest}build-aux/cc-mes.sh scaffold/main MES_LIBS='-l none' bash ${srcdest}build-aux/cc-mes.sh scaffold/main
bash ${srcdest}build-aux/cc-mes.sh scaffold/hello
bash ${srcdest}build-aux/cc-mes.sh scaffold/argv trace "TEST scaffold/main.mes-out" echo scaffold/main.mes-out
{ set +e; scaffold/main.mes-out; r=$?; set -e; }
[ $r != 42 ] && echo " => $r" && exit 1
MES_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-mes.sh scaffold/hello
MES_LIBS='-l c-mini' bash ${srcdest}build-aux/cc-mes.sh scaffold/argv
bash ${srcdest}build-aux/cc-mes.sh scaffold/malloc bash ${srcdest}build-aux/cc-mes.sh scaffold/malloc
##sh ${srcdest}build-aux/cc-mes.sh scaffold/micro-mes ##sh ${srcdest}build-aux/cc-mes.sh scaffold/micro-mes
##sh ${srcdest}build-aux/cc-mes.sh scaffold/tiny-mes ##sh ${srcdest}build-aux/cc-mes.sh scaffold/tiny-mes

View file

@ -154,7 +154,10 @@ fail=0
total=0 total=0
mkdir -p scaffold/tests mkdir -p scaffold/tests
for t in $tests; do for t in $tests; do
if [ -z "${t/[012][0-9]-*/}" ]; then if [ -z "${t/[01][0-9]-*/}" ]; then
LIBC=
MES_LIBS="-l none"
elif [ -z "${t/[2][0-9]-*/}" ]; then
LIBC=c-mini LIBC=c-mini
MES_LIBS="-l c-mini" MES_LIBS="-l c-mini"
elif [ -z "${t/[78][0-9a-z]-*/}" ]; then elif [ -z "${t/[78][0-9a-z]-*/}" ]; then

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -21,6 +21,17 @@
#include <libmes.h> #include <libmes.h>
#include <string.h> #include <string.h>
int
strcmp (char const* a, char const* b)
{
while (*a && *b && *a == *b)
{
a++;
b++;
}
return *a - *b;
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {

View file

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*- /* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software * GNU Mes --- Maxwell Equations of Software
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> * Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* *
* This file is part of GNU Mes. * This file is part of GNU Mes.
* *
@ -25,12 +25,12 @@
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
g_stdin = open ("scaffold/mesmes", 0); g_stdin = open ("scaffold/read.data", 0);
int c = getchar (); int c = getchar ();
if (c != 'm') return c; if (c != 'm')
return 1;
while (c != EOF) { while (c != EOF) {
putchar (c); putchar (c);
c = getchar (); c = getchar ();
} }
return c;
} }