From 43618523cdee62f4a26c121e565ee6fdc9038738 Mon Sep 17 00:00:00 2001 From: Ciro Santilli Date: Tue, 22 Jan 2019 00:00:00 +0000 Subject: [PATCH] readme: document magic failure string --- README.adoc | 19 ++++++++++++++++++- rootfs_overlay/test_fail.sh | 3 +-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index bf4ab5d..e4b9f8d 100644 --- a/README.adoc +++ b/README.adoc @@ -10911,7 +10911,7 @@ Automatically run non-interactive baremetal tests: Source: link:test-baremetal[] -Since there is no standardized exit status concept that works across all emulators, we detect if tests failed by parsing logs for the string output by our fail function: `common_assert_fail()`. +We detect if tests failed by parsing logs for the <>. We also skip tests that cannot work on certain conditions based on their basenames, e.g.: @@ -11993,6 +11993,23 @@ Then proceed to do the following tests: * `/count.sh` and `break __x64_sys_write` * `insmod /timer.ko` and `break lkmc_timer_callback` +==== Magic failure string + +Since there is no standardized exit status concept that works across all emulators for full system, we just parse the terminal output for a magic failure string to check if tests failed. + +If a full system simulation outputs a line containing only exactly the magic string: + +.... +lkmc_test_fail +.... + +to the terminal, then our run scripts detect that and exit with status `1`. + +This magic output string is notably used by: + +* the `common_assert_fail()` function, which is used by <> +* link:rootfs_overlay/test_fail.sh[], which is used by the link:test-userland[] + === Bisection When updating the Linux kernel, QEMU and gem5, things sometimes break. diff --git a/rootfs_overlay/test_fail.sh b/rootfs_overlay/test_fail.sh index 9a4c3c1..682d36b 100755 --- a/rootfs_overlay/test_fail.sh +++ b/rootfs_overlay/test_fail.sh @@ -1,4 +1,3 @@ #!/bin/sh -# Print the magic fail string that our scripts detect -# as a simulation failure. +# https://github.com/cirosantilli/linux-kernel-module-cheat#magic-failure-string echo lkmc_test_fail