summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2015-04-22 11:38:24 +0200
committerMichael Brown2015-04-22 11:38:24 +0200
commita70089b46e16c55a69726fe63bbfe32b4a18a1bd (patch)
tree2350bee9cd548184cfc35068032460670f7676b6
parent[smp] Allow CONSERVATIVE_SMP to be overridden by "smp" command-line option (diff)
downloadmemtest86-a70089b46e16c55a69726fe63bbfe32b4a18a1bd.tar.gz
memtest86-a70089b46e16c55a69726fe63bbfe32b4a18a1bd.tar.xz
memtest86-a70089b46e16c55a69726fe63bbfe32b4a18a1bd.zip
[cmdline] Add "onefail" command-line parameter
The semantics of "onepass" (as implemented upstream) are such that memtest86+ will never exit if tests fail; the failures are simply left on screen for the user to observe while the tests continue to run. This makes sense in the upstream build of memtest86+, where "exit" means "reboot". However, when running memtest86+ as a PXE NBP it would be more useful to return to the caller after a failure (with the appropriate exit status). Add a command-line parameter "onefail" which will trigger an immediate exit in the event of a failure. Users of the PXE NBP version of memtest86+ in an automated environment can then invoke memtest86+ with both "onepass" and "onefail" options; for example: #!ipxe chain memtest.0 onepass onefail && goto mem_good || goto mem_bad Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/main.c b/main.c
index 59b9654..555db4b 100644
--- a/main.c
+++ b/main.c
@@ -73,6 +73,7 @@ volatile short cpu_mode;
char cpu_mask[MAX_CPUS];
long bin_mask=0xffffffff;
short onepass;
+static short onefail;
volatile short btflag = 0;
volatile int test;
short restart_flag;
@@ -330,6 +331,11 @@ static void parse_command_line(void)
cp += 7;
onepass++;
}
+ /* Exit immediately on failure */
+ if (!strncmp(cp, "onefail", 7)) {
+ cp += 7;
+ onefail++;
+ }
/* Setup a list of tests to run */
if (!strncmp(cp, "tstlist=", 8)) {
cp += 8;
@@ -782,6 +788,12 @@ void test_start(void)
} //????
btrace(my_cpu_num, __LINE__, "Next_CPU ",1,cpu_sel,test);
+ /* If onefail is enabled and we have seen any errors then
+ * exit the test */
+ if (onefail && v->ecount) {
+ v->exit++;
+ }
+
/* If this was the last test then we finished a pass */
if (pass_flag)
{