diff mbox

x86: realmode: report failures

Message ID 1402012828-30006-1-git-send-email-namit@cs.technion.ac.il (mailing list archive)
State New, archived
Headers show

Commit Message

Nadav Amit June 6, 2014, midnight UTC
The current realmode tests always report success when done, regardless to
whether any of the tests failed.  Although the log includes the individual test
results, this behavior complicates the life of the tester.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
 x86/realmode.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Bandan Das June 9, 2014, 9:43 p.m. UTC | #1
Nadav Amit <namit@cs.technion.ac.il> writes:

> The current realmode tests always report success when done, regardless to
> whether any of the tests failed.  Although the log includes the individual test
> results, this behavior complicates the life of the tester.

Please include kvm-unit-tests in the subject line for easier identifiability
where the patch belongs.

> Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
> ---
>  x86/realmode.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/x86/realmode.c b/x86/realmode.c
> index 6e74883..dc4a1d3 100644
> --- a/x86/realmode.c
> +++ b/x86/realmode.c
> @@ -103,6 +103,8 @@ static void print_serial_u32(u32 value)
>  	print_serial(p);
>  }
>  
> +static int failed;
> +
>  static void exit(int code)
>  {
>  	outb(code, 0xf4);
> @@ -222,6 +224,8 @@ static void report(const char *name, u16 regs_ignore, _Bool ok)
>      print_serial(ok ? "PASS: " : "FAIL: ");
>      print_serial(name);
>      print_serial("\n");
> +    if (!ok)
> +	failed = 1;
>  }

I was confused at first since there is also a common "report" function
in lib/report.c We should probably rename this function to something else,
eg- realmode_report() if the common function can't be reused here.
  
>  #define MK_INSN(name, str)				\
> @@ -1715,7 +1719,7 @@ void realmode_start(void)
>  	test_perf_memory_store();
>  	test_perf_memory_rmw();
>  
> -	exit(0);
> +	exit(failed);
>  }
>  
>  unsigned long long r_gdt[] = { 0, 0x9b000000ffff, 0x93000000ffff };
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/x86/realmode.c b/x86/realmode.c
index 6e74883..dc4a1d3 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -103,6 +103,8 @@  static void print_serial_u32(u32 value)
 	print_serial(p);
 }
 
+static int failed;
+
 static void exit(int code)
 {
 	outb(code, 0xf4);
@@ -222,6 +224,8 @@  static void report(const char *name, u16 regs_ignore, _Bool ok)
     print_serial(ok ? "PASS: " : "FAIL: ");
     print_serial(name);
     print_serial("\n");
+    if (!ok)
+	failed = 1;
 }
 
 #define MK_INSN(name, str)				\
@@ -1715,7 +1719,7 @@  void realmode_start(void)
 	test_perf_memory_store();
 	test_perf_memory_rmw();
 
-	exit(0);
+	exit(failed);
 }
 
 unsigned long long r_gdt[] = { 0, 0x9b000000ffff, 0x93000000ffff };