test: Enable argv test, run tests with arguments.

* build-aux/check-mescc.sh (TESTS): Enable 54-argv.c
(XFAIL_TESTS): Remove it.
* build-aux/test-c.sh: Invoke test with options.
* lib/tests/scaffold/54-argc.c: Update.
This commit is contained in:
Jan Nieuwenhuizen 2019-03-13 18:49:36 +01:00
parent 5d079c1866
commit 0535eeda50
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
4 changed files with 13 additions and 9 deletions

View File

@ -107,6 +107,7 @@ lib/tests/string/50-strcpy.c
lib/tests/string/50-strncmp.c
lib/tests/scaffold/51-pointer-sub.c
lib/tests/scaffold/54-argc.c
lib/tests/scaffold/54-argv.c
lib/tests/scaffold/55-char-array.c
lib/tests/scaffold/60-math.c
lib/tests/scaffold/61-array.c
@ -210,7 +211,6 @@ lib/tests/scaffold/a1-global-no-clobber.c
"
XFAIL_TESTS="
lib/tests/scaffold/54-argv.c
lib/tests/stdio/90-sprintf.c
lib/tests/stdio/90-sprintf.c
"

View File

@ -59,8 +59,7 @@ $CC -c $CPPFLAGS $CFLAGS -o "$o".o "$t"
$CC $CFLAGS $LDFLAGS -L . -o "$o" $crt1 "$o".o $LIBS
set +e
#timeout 2 "$o" -s --long file0 file1 > "$o".1 2> "$o".2
timeout 2 "$o" > "$o".1 2> "$o".2
timeout 2 "$o" -s --long file0 file1 > "$o".1 2> "$o".2
r=$?
set -e
if [ -f "$b".exit ]; then

View File

@ -29,7 +29,7 @@ main (int argc, char *argv[])
oputs ("argc=");
oputs (itoa (argc));
oputs ("\n");
if (argc != 1)
if (argc != 5)
return 1;
return 0;

View File

@ -1,6 +1,6 @@
/* -*-comment-start: "//";comment-end:""-*-
* GNU Mes --- Maxwell Equations of Software
* Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* This file is part of GNU Mes.
*
@ -27,20 +27,25 @@ int
main (int argc, char *argv[])
{
oputs ("\n");
oputs ("t: argv[0] == \"lib/test/scaffold....\"\n");
oputs ("t: argv[0] == \"lib/tests/scaffold....\"\n");
oputs ("argv0=");
oputs (argv[0]);
oputs ("\n");
if (strncmp (argv[0], "lib/test/scaffold", 5))
if (strcmp (argv[0], "lib/tests/scaffold/54-argv"))
return 1;
oputs ("t: *argv\"\n");
oputs (*argv);
oputs ("\n");
oputs ("t: if (argc > 1 && !strcmp (argv[1], \"--help\")\n");
if (argc > 1 && !strcmp (argv[1], "--help"))
if (argc != 5)
return 2;
if (strcmp (argv[1], "-s"))
return 3;
if (strcmp (argv[2], "--long"))
return 4;
return 0;
}