diff options
author | Ruediger Meier | 2016-03-22 10:06:22 +0100 |
---|---|---|
committer | Ruediger Meier | 2016-03-24 08:14:34 +0100 |
commit | 33bed90a7fd5567d15e6319fef9e2f3c69673f76 (patch) | |
tree | d797229f18123ef5366618a4967ed728e917289e /tests/ts/misc | |
parent | setarch: add "exec" message to --verbose (diff) | |
download | kernel-qcow2-util-linux-33bed90a7fd5567d15e6319fef9e2f3c69673f76.tar.gz kernel-qcow2-util-linux-33bed90a7fd5567d15e6319fef9e2f3c69673f76.tar.xz kernel-qcow2-util-linux-33bed90a7fd5567d15e6319fef9e2f3c69673f76.zip |
tests: improve setarch tests, regarding --uname-2.6 issues
Add some more tests:
* error handling "unknown arch" and "unknown command"
* "noop" test with host arch and no other options
* all options except --uname-2.6
* --uname-2.6 whithout any other options but handle fatal
glibc error "kernel too old" (with debug output)
* add a "real" --uname-2.6 test which validates uname(1)
output
Note the "kernel too old" cases are systems where glibc was
configured to support only kernels > 3.0. On some archs
(e.g. x86) --uname-2.6 still works with such glibc because
2.6.39 had all needed features on board (e.g. vdso).
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=806911
Some people reported segfaults (after execvp) but I can only
reproduce it on arm* and aarch64 qemu-user-space builds. We
don't need to fix our tests for such broken systems where
also many other tests fail currently.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/misc')
-rwxr-xr-x | tests/ts/misc/setarch | 74 |
1 files changed, 66 insertions, 8 deletions
diff --git a/tests/ts/misc/setarch b/tests/ts/misc/setarch index 9b0e92eee..c8050e52a 100755 --- a/tests/ts/misc/setarch +++ b/tests/ts/misc/setarch @@ -21,13 +21,71 @@ ts_init "$*" ts_check_test_command "$TS_CMD_SETARCH" ARCH=$(uname -m) -case $ARCH in - # setarch --uname-2.6 fails on platforms without VDS - *sparc* ) - ts_skip "unsupported arch" - ;; -esac - -$TS_CMD_SETARCH $(uname -m) -vRFZLXBIST3 --uname-2.6 echo "success" >$TS_OUTPUT 2>&1 + +ts_init_subtest options +echo "###### unknown arch" >>$TS_OUTPUT +$TS_CMD_SETARCH qubit -v echo "success" >>$TS_OUTPUT 2>&1 +echo "exit: $?" >>$TS_OUTPUT + +echo "###### unknown command" >>$TS_OUTPUT +$TS_CMD_SETARCH $ARCH -v /das/gibs/nicht >>$TS_OUTPUT 2>&1 +echo "exit: $?" >>$TS_OUTPUT + +echo "###### noop uname -a" >>$TS_OUTPUT +uname_a=$(uname -srm) +$TS_CMD_SETARCH $ARCH -v uname -srm >>$TS_OUTPUT 2>&1 +sed -i "$ s@${uname_a}@uname -a unchanged@" $TS_OUTPUT + +echo "###### almost all options" >>$TS_OUTPUT +$TS_CMD_SETARCH $ARCH -vRFZLXBIST3 echo "success" >>$TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest uname26 +finmsg="" # for debugging 2.6 issues + +echo "###### --uname-2.6 echo" >>$TS_OUTPUT +$TS_CMD_SETARCH $ARCH -v --uname-2.6 echo "2.6 worked" >>$TS_OUTPUT 2>&1 +if [ $? -eq 0 ]; then + expected='^2.6 worked$' +else + # this may happen after execvp + expected="^FATAL: kernel too old$" + finmsg+=" echo" +fi +sed -i "$ s/$expected/2.6 works or kernel too old/" $TS_OUTPUT + +echo "###### --uname-2.6 true, non-verbose" >>$TS_OUTPUT +$TS_CMD_SETARCH $ARCH --uname-2.6 true >>$TS_OUTPUT 2>&1 +if [ $? -eq 0 ]; then + echo "2.6 works or kernel too old" >> $TS_OUTPUT +else + # this may happen after execvp + expected="^FATAL: kernel too old$" + sed -i "$ s/$expected/2.6 works or kernel too old/" $TS_OUTPUT + finmsg+=" true" +fi + +if [ -n "$finmsg" ]; then + finmsg=$(echo unsupported --uname-2.6: $finmsg) +else + uname26_seems_supported=yes +fi +ts_finalize_subtest "$finmsg" + + +# conditional subtest +if [ "$uname26_seems_supported" = "yes" ]; then +ts_init_subtest uname26-version + tmp=$($TS_CMD_SETARCH $ARCH --uname-2.6 uname -r) + if echo "$tmp" | grep -q "^2\.6\."; then + echo "kernel version changed to 2.6" >> $TS_OUTPUT + else + echo "uname26 failed" >> $TS_OUTPUT + echo "original kernel: $(uname -r)" >> $TS_OUTPUT + echo "uname26 kernel: $tmp" >> $TS_OUTPUT + fi +ts_finalize_subtest +fi # conditional subtest ts_finalize |