add strace test cases and test result

This commit is contained in:
Tomoki Shirasawa
2017-11-25 17:37:10 +09:00
parent 5cc738d6bd
commit 3b6056fb1a
7 changed files with 174 additions and 1 deletions

60
test/strace/strace/test2.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/sh
if [ ! -f test2 ]; then
gcc -o test2 test2.c
fi
rm -f check.log
$MCEXEC strace -e trace=process -f -o check.log ./test2
awk 'BEGIN{st=0;ng=0; ok=0; print "*** test2 start"}
/execve/{
st++
if ($0 ~/ = 0$/) {
print "test2-" st " execve OK"
ok++
}
else {
print "test2-" st " execve NG"
ng++
}
}
/clone/{
st++
if ($0 ~/ = [1-9][0-9]*$/) {
print "test2-" st " fork OK"
ok++
}
else {
print "test2-" st " fork NG"
ng++
}
}
/wait4/{
st++
if ($0 ~/ = [1-9][0-9]*$/) {
print "test2-" st " wait OK"
ok++
}
else {
print "test2-" st " wait NG"
ng++
}
}
/SIGCHLD {/{
st++
print "test2-" st " SIGCHLD OK"
ok++
sigchld = 1
}
END {
if (sigchld != 1) {
st++
print "test2-" st " SIGCHLD NG"
ng++
}
printf("*** test2 end ok=%d ng=%d\n", ok, ng)
exit(ng)
}' check.log
rm -f check.log test2