diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-24 20:22:12 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-10-24 20:22:12 +0200 |
commit | 7988979a722b4cdf287b2093956a76a3f19b9897 (patch) | |
tree | d35e251d0472ceca55a2eef61cff261c8ee68fab /test/args |
add uClibc-ng test directory
Diffstat (limited to 'test/args')
-rw-r--r-- | test/args/Makefile | 8 | ||||
-rw-r--r-- | test/args/Makefile.in | 9 | ||||
-rw-r--r-- | test/args/arg_test.c | 40 | ||||
-rw-r--r-- | test/args/arg_test.out.good | 13 | ||||
-rw-r--r-- | test/args/arg_test_glibc.out.good | 13 |
5 files changed, 83 insertions, 0 deletions
diff --git a/test/args/Makefile b/test/args/Makefile new file mode 100644 index 0000000..0ae3f01 --- /dev/null +++ b/test/args/Makefile @@ -0,0 +1,8 @@ +# uClibc args tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +top_builddir=../../ +top_srcdir=../../ +include ../Rules.mak +-include Makefile.in +include ../Test.mak diff --git a/test/args/Makefile.in b/test/args/Makefile.in new file mode 100644 index 0000000..f4edab4 --- /dev/null +++ b/test/args/Makefile.in @@ -0,0 +1,9 @@ +# uClibc args tests +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +OPTS_arg_test = a b c d e f g h +WRAPPER_arg_test = \ + env -i \ + ENVVAR=123 \ + SOMETHING=sldajfasdf \ + BLAHBLAH=" hi hi " diff --git a/test/args/arg_test.c b/test/args/arg_test.c new file mode 100644 index 0000000..86f3157 --- /dev/null +++ b/test/args/arg_test.c @@ -0,0 +1,40 @@ +/* vi: set sw=4 ts=4: */ +/* + * Test application for argc and argv handling + * Copyright (C) 2000-2006 by Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +int main(int argc, char **argv) +{ + int i=0; + char** index=__environ; + +#ifdef __powerpc__ + { + unsigned long sp; + sp = (unsigned long) __builtin_frame_address(0); + if(sp&0xf){ + printf("stack pointer is unaligned! (%08lx)\n", sp); + } + } +#endif + + printf("argc=%d\n", argc); + + for(i=0;i<argc;i++) { + printf("argv[%d]='%s'\n", i, argv[i]); + } + + i=0; + while(*index) { + printf("environ[%d]='%s'\n", i++, *index++); + } + + exit(0); +} diff --git a/test/args/arg_test.out.good b/test/args/arg_test.out.good new file mode 100644 index 0000000..937a803 --- /dev/null +++ b/test/args/arg_test.out.good @@ -0,0 +1,13 @@ +argc=9 +argv[0]='./arg_test' +argv[1]='a' +argv[2]='b' +argv[3]='c' +argv[4]='d' +argv[5]='e' +argv[6]='f' +argv[7]='g' +argv[8]='h' +environ[0]='ENVVAR=123' +environ[1]='SOMETHING=sldajfasdf' +environ[2]='BLAHBLAH= hi hi ' diff --git a/test/args/arg_test_glibc.out.good b/test/args/arg_test_glibc.out.good new file mode 100644 index 0000000..af0efcb --- /dev/null +++ b/test/args/arg_test_glibc.out.good @@ -0,0 +1,13 @@ +argc=9 +argv[0]='./arg_test_glibc' +argv[1]='a' +argv[2]='b' +argv[3]='c' +argv[4]='d' +argv[5]='e' +argv[6]='f' +argv[7]='g' +argv[8]='h' +environ[0]='ENVVAR=123' +environ[1]='SOMETHING=sldajfasdf' +environ[2]='BLAHBLAH= hi hi ' |