3 # truss / pdfork regression test.
4 # Test scenario by: Ryan Stone rstone@, slightly mangled by pho@
6 # Interruptable hang seen:
8 # UID PID PPID CPU PRI NI VSZ RSS MWCHAN STAT TT TIME COMMAND
9 # 1001 992 991 0 27 0 4168 1908 - TX+ 0 0:00.00 /tmp/pdfork -p
12 cat > /tmp/pdfork.c <<EOF
13 #include <sys/types.h>
14 #include <sys/procdesc.h>
15 #include <sys/resource.h>
25 main(int argc, char **argv)
30 if (argc > 1 && strcmp(argv[1], "-p") == 0) {
40 err(1, "fork() failed");
43 if (argc > 1 && strcmp(argv[1], "-p") != 0) {
44 int error = wait4(pid, &status, WEXITED, NULL);
46 err(1, "wait4 failed");
52 cc -o /tmp/pdfork -Wall -Wextra -O2 /tmp/pdfork.c || exit 1
54 timeout 20s truss -f /tmp/pdfork 2> /dev/null; s1=$?
55 timeout 20s truss -f /tmp/pdfork -p 2> /dev/null; s2=$?
57 rm -f /tmp/pdfork /tmp/pdfork.c