tests/ipc_sem: detect broken kernels

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.
This commit is contained in:
Mike Frysinger 2015-02-27 01:39:25 -05:00 committed by Dmitry V. Levin
parent 856b7596b8
commit 4ed340bae6
2 changed files with 17 additions and 6 deletions

View File

@ -44,6 +44,6 @@ done:
return rc;
fail:
rc = 1;
rc = errno == EFAULT ? 99 : 1;
goto done;
}

View File

@ -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"