diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-11-27 02:02:00 -0800 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-11-27 02:26:24 -0800 |
commit | 505e481877f559ec7a5dda6e4d1040036d165f6a (patch) | |
tree | d4ff1ded0ba7509f6defdd5c0572b9c502063e72 | |
parent | 98327a2a5444d4ce032777d92cbb72449ca15ffd (diff) |
ktest: better logging, minor cleanup
also disable test for ktest itself for now since it keeps timing out
Change-Id: I1b5908a92ee14a5b4f844aef9c4fc11382ae30a6
-rwxr-xr-x | catch_test_success.awk | 13 | ||||
-rwxr-xr-x | ktest | 6 | ||||
-rwxr-xr-x | rc.testwrapper | 31 | ||||
-rw-r--r-- | tests.testy | 2 | ||||
-rwxr-xr-x | tests/crash.ktest | 5 | ||||
-rwxr-xr-x | tests/failure.ktest | 5 | ||||
-rwxr-xr-x | tests/success.ktest | 5 | ||||
-rwxr-xr-x | tests/timeout.ktest | 3 | ||||
-rwxr-xr-x | vm-start | 3 |
9 files changed, 42 insertions, 31 deletions
diff --git a/catch_test_success.awk b/catch_test_success.awk new file mode 100755 index 0000000..4237ce2 --- /dev/null +++ b/catch_test_success.awk @@ -0,0 +1,13 @@ +#!/usr/bin/awk -f + +BEGIN { starttime = systime() } + +{ + printf("%.4d %s\n", systime() - starttime, $0); + fflush(); + if ($0 ~ /TEST SUCCESS/) { + exit 7 + } else if ($0 ~ /TEST FAILED/) { + exit 0 + } +} @@ -175,7 +175,7 @@ run_vm() --kernel="$KERNEL/vmlinuz" \ --cdrom="$iso" \ --fs "$OUTPUT_DIR" logfs \ - --append="rw quiet crashkernel=128M ktest.priority=$PRIORITY $_KERNEL_APPEND"\ + --append="rw crashkernel=128M ktest.priority=$PRIORITY $_KERNEL_APPEND"\ --memory="$_MEM" \ --cpus "$_CPUS" \ $KGDB $_SCRATCH $_INFINIBAND $_VMCLUSTER| @@ -185,9 +185,7 @@ run_vm() elif [[ $EXIT_ON_SUCCESS = 1 ]]; then sed -u -e '/TEST SUCCESS/ { p; Q7 }' else - timeout "$_TIMEOUT" \ - sed -u -e '/TEST SUCCESS/ { p; Q7 }' \ - -e '/TEST FAILED/ { p; Q0 }' + timeout "$_TIMEOUT" $KTESTDIR/catch_test_success.awk fi ret=$? diff --git a/rc.testwrapper b/rc.testwrapper index 584225e..7551c18 100755 --- a/rc.testwrapper +++ b/rc.testwrapper @@ -20,19 +20,6 @@ for i in `cat /proc/cmdline`; do esac done -NR_REBOOTS=$([ -e /NR_REBOOTS ] && cat /NR_REBOOTS || echo 0) - -EXPECTED_REBOOT=$([ -e /EXPECTED_REBOOT ] && cat /EXPECTED_REBOOT || echo 0) - -if [ "$NR_REBOOTS" != "$EXPECTED_REBOOT" ]; then - echo "UNEXPECTED REBOOT: got $NR_REBOOTS expected $EXPECTED_REBOOT" - echo "TEST FAILED" - exit 1 -fi - -echo "TEST REBOOT $NR_REBOOTS" -echo $((NR_REBOOTS + 1)) | dd of=/NR_REBOOTS oflag=direct - copy_to_host() { cat /sys/kernel/debug/tracing/trace >> $LOGDIR/trace.txt @@ -68,7 +55,7 @@ do_reboot() { copy_to_host - echo $((NR_REBOOTS + 1)) | dd of=/EXPECTED_REBOOT oflag=direct + echo $((NR_REBOOTS + 1)) | dd of=/EXPECTED_REBOOT oflag=direct 2> /dev/null echo b > /proc/sysrq-trigger } @@ -138,11 +125,27 @@ config-timeout() return 0 } +NR_REBOOTS=$([ -e /NR_REBOOTS ] && cat /NR_REBOOTS || echo 0) + +EXPECTED_REBOOT=$([ -e /EXPECTED_REBOOT ] && cat /EXPECTED_REBOOT || echo 0) + +if [ "$NR_REBOOTS" != "$EXPECTED_REBOOT" ]; then + echo "UNEXPECTED REBOOT: got $NR_REBOOTS expected $EXPECTED_REBOOT" + echo "TEST FAILED" + exit 1 +fi + +echo "Test starting: NR_REBOOTS $NR_REBOOTS" +echo $((NR_REBOOTS + 1)) | dd of=/NR_REBOOTS oflag=direct 2> /dev/null + set +e (set -e; . rc.test; main) ret=$? +echo "Test finished with ret $ret" +echo "Copying output to host" + # XXX: check dmesg for warnings, oopses, slab corruption, etc. before signaling # success diff --git a/tests.testy b/tests.testy index 9510025..7d68883 100644 --- a/tests.testy +++ b/tests.testy @@ -1,4 +1,4 @@ -0 . tests/ktest +#0 . tests/ktest #0 . tests/blkdev.ktest #0 . ../appliance-clustest/tests/dcpd.actest diff --git a/tests/crash.ktest b/tests/crash.ktest index 74f0817..5ab31a2 100755 --- a/tests/crash.ktest +++ b/tests/crash.ktest @@ -1,8 +1,7 @@ #!/bin/bash -require-lib test-libs.sh - -config-timeout 20 +config-mem 512M +config-timeout 120 main() { diff --git a/tests/failure.ktest b/tests/failure.ktest index 72716e5..08d9536 100755 --- a/tests/failure.ktest +++ b/tests/failure.ktest @@ -1,8 +1,7 @@ #!/bin/bash -require-lib test-libs.sh - -config-timeout 30 +config-mem 512M +config-timeout 60 main() { diff --git a/tests/success.ktest b/tests/success.ktest index 2f51772..9f3f238 100755 --- a/tests/success.ktest +++ b/tests/success.ktest @@ -1,8 +1,7 @@ #!/bin/bash -require-lib test-libs.sh - -config-timeout 30 +config-mem 512M +config-timeout 60 main() { diff --git a/tests/timeout.ktest b/tests/timeout.ktest index 6ad81a7..16bd68e 100755 --- a/tests/timeout.ktest +++ b/tests/timeout.ktest @@ -1,7 +1,6 @@ #!/bin/bash -require-lib test-libs.sh - +config-mem 512M config-timeout 10 main() @@ -371,7 +371,8 @@ class VM(object): raise RuntimeError("mkfs.ext4 failed on '"+name+"'") # build qemu command and start - cmd = ["qemu-system-x86_64"] + cmd = ["stdbuf", "-oL", + "qemu-system-x86_64"] cmd.extend(["-machine", "accel=kvm"]) cmd.extend(["-pidfile", os.path.join(self.tmpdir,"pid",)]) cmd.extend(["-m", opts.mem]) |