qa: introduce runners and more tests for newlib
For each test, if a script exists with the same name of the test plus the .runner suffix, the runner is run instead of the test. As a first example qa/lib/newlib/testsuite/atexit is run by qa/lib/newlib/testsuite/atexit.runner. These .runner scripts allow more complex checks of the side effects generated by the test.
This commit is contained in:
2
hacking
2
hacking
Submodule hacking updated: cd087cebd1...9161f5fee1
18
qa/check
18
qa/check
@ -9,17 +9,19 @@ if(~ $dir '') dir=/qa
|
|||||||
l = `{du -a /arch/$objtype/$dir|awk '{print $2}'|sort}
|
l = `{du -a /arch/$objtype/$dir|awk '{print $2}'|sort}
|
||||||
|
|
||||||
failed = ()
|
failed = ()
|
||||||
ce=.check
|
runner=.runner
|
||||||
|
|
||||||
for(t in $l){
|
for(t in $l){
|
||||||
if(test -x $t) {
|
if(test -x $t) {
|
||||||
echo -n $t:
|
if( test -x $t$runner ) { }
|
||||||
$t > /tmp/qa.log >[2=1]
|
if not {
|
||||||
st = $status
|
echo -n $t:
|
||||||
if(~ `{echo $st|field 3} PASS) {
|
$t > /tmp/qa.log >[2=1]
|
||||||
if( test -x $t$ce ) { cp /tmp/qa.log /tmp/qa.previous.log }
|
st = $status
|
||||||
rm /tmp/qa.log && echo PASS
|
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}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
wait(&status);
|
wait(&status);
|
||||||
if(status != 0){
|
if(status != 0){
|
||||||
printf("parent: child exited with status %d\n", status);
|
printf("parent: child exited with status %d\n", status);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
35
qa/lib/newlib/100-files.c
Normal file
35
qa/lib/newlib/100-files.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
18
qa/lib/newlib/100-files.runner
Normal file
18
qa/lib/newlib/100-files.runner
Normal file
@ -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
|
@ -3,9 +3,6 @@
|
|||||||
"Include": [
|
"Include": [
|
||||||
"/arch/$ARCH/include/cflags.json"
|
"/arch/$ARCH/include/cflags.json"
|
||||||
],
|
],
|
||||||
"Projects": [
|
|
||||||
"testsuite/"
|
|
||||||
],
|
|
||||||
"Cflags": [
|
"Cflags": [
|
||||||
"-fstack-check",
|
"-fstack-check",
|
||||||
"-fstack-protector-all",
|
"-fstack-protector-all",
|
||||||
@ -24,7 +21,7 @@
|
|||||||
"Install": "/arch/$ARCH/qa/lib/newlib",
|
"Install": "/arch/$ARCH/qa/lib/newlib",
|
||||||
"Post": [
|
"Post": [
|
||||||
"rm -f *.o",
|
"rm -f *.o",
|
||||||
"#cp *.rc $JEHANNE/arch/$ARCH/qa/lib/newlib/"
|
"cp *.runner $JEHANNE/arch/$ARCH/qa/lib/newlib/"
|
||||||
],
|
],
|
||||||
"Pre": [
|
"Pre": [
|
||||||
"rm -f *.tag.*"
|
"rm -f *.tag.*"
|
||||||
@ -33,8 +30,14 @@
|
|||||||
"libposix_customization.c"
|
"libposix_customization.c"
|
||||||
],
|
],
|
||||||
"SourceFilesCmd": [
|
"SourceFilesCmd": [
|
||||||
"hello.c",
|
"000-hello.c",
|
||||||
"fork0.c"
|
"010-fork.c",
|
||||||
|
"100-files.c"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"NewlibTestsuite": {
|
||||||
|
"Projects": [
|
||||||
|
"testsuite/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
|
||||||
}
|
|
18
qa/lib/newlib/testsuite/atexit.runner
Normal file
18
qa/lib/newlib/testsuite/atexit.runner
Normal file
@ -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
|
||||||
|
}
|
@ -24,7 +24,7 @@
|
|||||||
"Post": [
|
"Post": [
|
||||||
"mkdir -p $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite",
|
"mkdir -p $JEHANNE/arch/$ARCH/qa/lib/newlib/testsuite",
|
||||||
"find -type f -perm /a+x -exec cp {} $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 ."
|
"git clean -xdf ."
|
||||||
],
|
],
|
||||||
"Pre": [
|
"Pre": [
|
||||||
|
Reference in New Issue
Block a user