mescc: Mes C Library: Start test suite.
TODO: move strict libc tests from scaffold/test/* here. * lib/tests/stdlib/getenv.c: New file. * lib/tests/stdlib/malloc.c: Move from scaffold. * build-aux/bootstrap.sh.in: Built them. * build-aux/build-mes.sh: Likewise.
This commit is contained in:
parent
a9bf3bfb12
commit
a3d87214ea
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -65,7 +65,6 @@
|
||||||
/scaffold/argv
|
/scaffold/argv
|
||||||
/scaffold/hello
|
/scaffold/hello
|
||||||
/scaffold/main
|
/scaffold/main
|
||||||
/scaffold/malloc
|
|
||||||
/scaffold/micro-mes
|
/scaffold/micro-mes
|
||||||
/scaffold/tiny-mes
|
/scaffold/tiny-mes
|
||||||
/scaffold/mini-mes
|
/scaffold/mini-mes
|
||||||
|
|
|
@ -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 -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 scaffold/malloc.x86-mes-o scaffold/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/malloc.x86-mes-o lib/tests/stdlib/malloc.c
|
||||||
|
|
||||||
@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-malloc scaffold/malloc.x86-mes-o -l 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 scaffold/micro-mes.x86-mes-o scaffold/micro-mes.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
|
||||||
|
|
||||||
|
|
|
@ -69,10 +69,16 @@ compile scaffold/hello
|
||||||
compile scaffold/argv
|
compile scaffold/argv
|
||||||
(libc="-l c-mini" link scaffold/argv)
|
(libc="-l c-mini" link scaffold/argv)
|
||||||
|
|
||||||
[ "$mes_p" ] && compile scaffold/malloc
|
[ "$mes_p" ] && compile lib/tests/stdlib/malloc
|
||||||
[ "$mes_p" ] && link scaffold/malloc
|
[ "$mes_p" ] && link lib/tests/stdlib/malloc
|
||||||
|
|
||||||
|
[ "$mes_p" ] && compile lib/tests/stdlib/getenv
|
||||||
|
[ "$mes_p" ] && link lib/tests/stdlib/getenv
|
||||||
|
|
||||||
|
|
||||||
[ "$mes_p" ] && compile scaffold/micro-mes
|
[ "$mes_p" ] && compile scaffold/micro-mes
|
||||||
[ "$mes_p" ] && link scaffold/micro-mes
|
[ "$mes_p" ] && link scaffold/micro-mes
|
||||||
|
|
||||||
[ "$mes_p" ] && compile scaffold/tiny-mes
|
[ "$mes_p" ] && compile scaffold/tiny-mes
|
||||||
[ "$mes_p" ] && link scaffold/tiny-mes
|
[ "$mes_p" ] && link scaffold/tiny-mes
|
||||||
#[ "$mes_p" ] && compile scaffold/mini-mes
|
#[ "$mes_p" ] && compile scaffold/mini-mes
|
||||||
|
|
38
lib/tests/stdlib/getenv.c
Normal file
38
lib/tests/stdlib/getenv.c
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
|
* Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
*
|
||||||
|
* This file is part of GNU Mes.
|
||||||
|
*
|
||||||
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* GNU Mes is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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[])
|
||||||
|
{
|
||||||
|
eputs ("test:getenv\n");
|
||||||
|
if (getenv ("SHELL") == 0)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
57
lib/tests/stdlib/malloc.c
Normal file
57
lib/tests/stdlib/malloc.c
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
|
* Copyright © 2016,2017 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
*
|
||||||
|
* This file is part of GNU Mes.
|
||||||
|
*
|
||||||
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* GNU Mes is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if POSIX
|
||||||
|
#error "POSIX not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <libmes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int size = 5000;
|
||||||
|
oputs ("m!\n");
|
||||||
|
//int *p = 0;
|
||||||
|
char *p = 0;
|
||||||
|
p = malloc (size);
|
||||||
|
size = 5000;
|
||||||
|
oputs ("p=");
|
||||||
|
oputs (itoa (p));
|
||||||
|
oputs ("\n");
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < size; i=i+1)
|
||||||
|
{
|
||||||
|
oputs ("set ");
|
||||||
|
oputs (itoa (i));
|
||||||
|
oputs ("\n");
|
||||||
|
p[i] = i;
|
||||||
|
}
|
||||||
|
for (i = 0; i < size; i=i+1)
|
||||||
|
{
|
||||||
|
oputs (itoa (i));
|
||||||
|
oputs (": ");
|
||||||
|
oputs (itoa (p[i]));
|
||||||
|
oputs ("\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue