diff --git a/hacking b/hacking index cd087ce..9161f5f 160000 --- a/hacking +++ b/hacking @@ -1 +1 @@ -Subproject commit cd087cebd1af4186e4cd0abdb8c5afd0f32b4e1e +Subproject commit 9161f5fee16b7609d2421c2a465d03ec4e268c1b diff --git a/qa/check b/qa/check index 5d50203..65b0c14 100755 --- a/qa/check +++ b/qa/check @@ -9,17 +9,19 @@ if(~ $dir '') dir=/qa l = `{du -a /arch/$objtype/$dir|awk '{print $2}'|sort} failed = () -ce=.check +runner=.runner for(t in $l){ if(test -x $t) { - echo -n $t: - $t > /tmp/qa.log >[2=1] - st = $status - if(~ `{echo $st|field 3} PASS) { - if( test -x $t$ce ) { cp /tmp/qa.log /tmp/qa.previous.log } - rm /tmp/qa.log && echo PASS + if( test -x $t$runner ) { } + if not { + echo -n $t: + $t > /tmp/qa.log >[2=1] + st = $status + if(~ `{echo $st|field 3} PASS) { + rm /tmp/qa.log && echo PASS + } + if not { echo $st && cat /tmp/qa.log; exit $st} } - if not { echo $st && cat /tmp/qa.log; exit $st} } } diff --git a/qa/lib/newlib/hello.c b/qa/lib/newlib/000-hello.c similarity index 100% rename from qa/lib/newlib/hello.c rename to qa/lib/newlib/000-hello.c diff --git a/qa/lib/newlib/fork0.c b/qa/lib/newlib/010-fork.c similarity index 89% rename from qa/lib/newlib/fork0.c rename to qa/lib/newlib/010-fork.c index 518c4a7..060496b 100644 --- a/qa/lib/newlib/fork0.c +++ b/qa/lib/newlib/010-fork.c @@ -32,9 +32,9 @@ int main(int argc, char **argv) } wait(&status); if(status != 0){ - printf("parent: child exited with status %d\n", status); - return 2; - } + printf("parent: child exited with status %d\n", status); + return 2; + } } else { diff --git a/qa/lib/newlib/100-files.c b/qa/lib/newlib/100-files.c new file mode 100644 index 0000000..ad0f5e8 --- /dev/null +++ b/qa/lib/newlib/100-files.c @@ -0,0 +1,35 @@ +#include + +int +main(int argc, char** argv) { + FILE *fp; + int i; + char * output = "/tmp/io-test.txt"; + + if(argc == 2){ + output = argv[1]; + }else if(argc > 2){ + printf("usage: %s [output]", argv[0]); + return 100; + } + + fp = fopen(output, "w+"); + if(fp == NULL){ + printf("Can't open %s", output); + return 1; + } + i = fprintf(fp, "%s works.\n", "fprintf"); + if(i <= 0){ + fclose(fp); + printf("Can't write 'fprintf works.' to %s", output); + return 2; + } + i = fputs("fputs works.\n", fp); + if(i == EOF){ + fclose(fp); + printf("Can't write 'fputs works.' to %s", output); + return 3; + } + fclose(fp); + return 0; +} diff --git a/qa/lib/newlib/100-files.runner b/qa/lib/newlib/100-files.runner new file mode 100644 index 0000000..4fcd8ac --- /dev/null +++ b/qa/lib/newlib/100-files.runner @@ -0,0 +1,18 @@ +#!/cmd/rc +runner=$0 +test = `{echo $runner|sed 's/.runner//'} +test_output = /tmp/output-`{basename $test} + +if ( test -e $test_output) rm $test_output + +$test $test_output > /dev/null +if ( cat $test_output | grep 'fprintf works.' > /dev/null ) { + if ( cat $test_output | grep 'fputs works.' > /dev/null ) { + rm $test_output + echo PASS + exit PASS + } +} +cat $test_output +echo FAIL +exit FAIL diff --git a/qa/lib/newlib/build.json b/qa/lib/newlib/build.json index 3582b01..fe90b1d 100644 --- a/qa/lib/newlib/build.json +++ b/qa/lib/newlib/build.json @@ -3,9 +3,6 @@ "Include": [ "/arch/$ARCH/include/cflags.json" ], - "Projects": [ - "testsuite/" - ], "Cflags": [ "-fstack-check", "-fstack-protector-all", @@ -24,7 +21,7 @@ "Install": "/arch/$ARCH/qa/lib/newlib", "Post": [ "rm -f *.o", - "#cp *.rc $JEHANNE/arch/$ARCH/qa/lib/newlib/" + "cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/" ], "Pre": [ "rm -f *.tag.*" @@ -33,8 +30,14 @@ "libposix_customization.c" ], "SourceFilesCmd": [ - "hello.c", - "fork0.c" + "000-hello.c", + "010-fork.c", + "100-files.c" + ] + }, + "NewlibTestsuite": { + "Projects": [ + "testsuite/" ] } } diff --git a/qa/lib/newlib/testsuite/atexit.check b/qa/lib/newlib/testsuite/atexit.check deleted file mode 100755 index 9bd4573..0000000 --- a/qa/lib/newlib/testsuite/atexit.check +++ /dev/null @@ -1,12 +0,0 @@ -#!/cmd/rc - -if ( cat /tmp/qa.previous.log | grep a0cba > /dev/null ) { - rm /tmp/qa.previous.log - echo PASS - exit PASS -} -if not { - echo FAIL - cat /tmp/qa.previous.log - exit FAIL -} diff --git a/qa/lib/newlib/testsuite/atexit.runner b/qa/lib/newlib/testsuite/atexit.runner new file mode 100644 index 0000000..70e9c05 --- /dev/null +++ b/qa/lib/newlib/testsuite/atexit.runner @@ -0,0 +1,18 @@ +#!/cmd/rc +runner=$0 +test = `{echo $runner|sed 's/.runner//'} +test_output = /tmp/output-`{basename $test} + +if ( test -e $test_output) rm $test_output + +$test > $test_output +if ( cat $test_output | grep a0cba > /dev/null ) { + rm $test_output + echo PASS + exit PASS +} +if not { + cat $test_output + echo FAIL + exit FAIL +} diff --git a/qa/lib/newlib/testsuite/build.json b/qa/lib/newlib/testsuite/build.json index 1cc2a00..f811209 100644 --- a/qa/lib/newlib/testsuite/build.json +++ b/qa/lib/newlib/testsuite/build.json @@ -24,7 +24,7 @@ "Post": [ "mkdir -p $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite", "find -type f -perm /a+x -exec cp {} $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite/ \\;", - "cp *.check $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite/", + "cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite/", "git clean -xdf ." ], "Pre": [