summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-01 00:09:25 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-01 00:09:25 +0000
commitffbec081e48741e831f578bfa180705c3202f75f (patch)
tree9678605d35149f4552c04eab47eb192bdd1b48ce
parent6eb01343b46aab40475112f05aeaff1a367223df (diff)
make the test silent/non-interactive and only abort if it actually fails
-rw-r--r--test/args/Makefile10
-rw-r--r--test/args/arg_test.c8
-rw-r--r--test/args/arg_test.out.good13
3 files changed, 25 insertions, 6 deletions
diff --git a/test/args/Makefile b/test/args/Makefile
index a4bcfc588..8c466df9c 100644
--- a/test/args/Makefile
+++ b/test/args/Makefile
@@ -29,8 +29,14 @@ arg_test: arg_test.c Makefile $(TESTDIR)/Rules.mak
$(CC) $(CFLAGS) -c $< -o $@.o
$(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS)
$(STRIPTOOL) -x -R .note -R .comment $@
- ./$@ a b c d e f g h
+ env -i \
+ ENVVAR=123 \
+ SOMETHING=sldajfasdf \
+ BLAHBLAH=" hi hi " \
+ ./$@ a b c d e f g h \
+ > arg_test.out
+ diff -u arg_test.out.good arg_test.out
-@ echo " "
clean:
- $(RM) *.[oa] *~ core $(TARGETS)
+ $(RM) *.[oa] *~ core $(TARGETS) *.out
diff --git a/test/args/arg_test.c b/test/args/arg_test.c
index b99f760c0..acc4465d9 100644
--- a/test/args/arg_test.c
+++ b/test/args/arg_test.c
@@ -36,20 +36,20 @@ int main(int argc, char **argv)
unsigned long sp;
sp = (unsigned long) __builtin_frame_address(0);
if(sp&0xf){
- fprintf(stderr, "stack pointer is unaligned! (%08lx)\n", sp);
+ printf("stack pointer is unaligned! (%08lx)\n", sp);
}
}
#endif
- fprintf(stderr, "argc=%d\n", argc);
+ printf("argc=%d\n", argc);
for(i=0;i<argc;i++) {
- fprintf(stderr, "argv[%d]='%s'\n", i, argv[i]);
+ printf("argv[%d]='%s'\n", i, argv[i]);
}
i=0;
while(*index) {
- fprintf(stderr, "environ[%d]='%s'\n", i++, *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 000000000..937a80367
--- /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 '