]> granicus.if.org Git - strace/commitdiff
tests/ipc_sem: detect broken kernels
authorMike Frysinger <vapier@gentoo.org>
Fri, 27 Feb 2015 06:39:25 +0000 (01:39 -0500)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 28 Feb 2015 12:10:39 +0000 (12:10 +0000)
When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
logic wrongly returns errors.  Detect that and throw an error.

* tests/ipc_sem.c: Return 99 when errno is EFAULT.
* tests/ipc_sem.test: Save output to $OUT and show it when failing.
Handle exit status 99 to throw an ERROR.

tests/ipc_sem.c
tests/ipc_sem.test

index 115221b98894a8762d5e617d54afb4168b354b0d..3f2fbe7b52bba0f1f33741908e219700a544f6e1 100644 (file)
@@ -44,6 +44,6 @@ done:
        return rc;
 
 fail:
-       rc = 1;
+       rc = errno == EFAULT ? 99 : 1;
        goto done;
 }
index df9a9bb85f66855d9728e59fe87e334089cd72d7..f448b66e6c8257a96be9936cb84177a06c04936d 100755 (executable)
@@ -8,15 +8,26 @@ check_prog grep
 
 OUT="$LOG.out"
 
-./ipc_sem > /dev/null || {
-       if [ $? -eq 77 ]; then
+./ipc_sem > "$OUT" || {
+       case $? in
+       77)
+               rm -f "$OUT"
                framework_skip_ 'ipc semget/semctl syscalls do not behave as expected'
-       else
+               ;;
+       99)
+               cat "$OUT"
+               rm -f "$OUT"
+               framework_failure_ 'broken kernel detected'
+               ;;
+       *)
+               cat "$OUT"
+               rm -f "$OUT"
                fail_ 'ipc_sem failed'
-       fi
+               ;;
+       esac
 }
 
-args="-eipc ./ipc_sem $f"
+args='-eipc ./ipc_sem'
 $STRACE -o "$LOG" $args > "$OUT" &&
 LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
        cat "$OUT" "$LOG"