All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests 0/3] few framework cleanups
@ 2016-12-19 16:23 Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 1/3] Makefile: distclean should remove build-head Andrew Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andrew Jones @ 2016-12-19 16:23 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar, lvivier, thuth

clean build-head, remove extra empty lines, move summary's
empty line

Andrew Jones (3):
  Makefile: distclean should remove build-head
  report already adds a newline
  report: move blank line to better side of SUMMARY

 scripts/runtime.bash | 1 +
 Makefile             | 3 ++-
 lib/report.c         | 2 +-
 arm/spinlock-test.c  | 2 +-
 x86/asyncpf.c        | 8 ++++----
 x86/svm.c            | 4 ++--
 x86/vmx_tests.c      | 2 +-
 7 files changed, 12 insertions(+), 10 deletions(-)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH kvm-unit-tests 1/3] Makefile: distclean should remove build-head
  2016-12-19 16:23 [PATCH kvm-unit-tests 0/3] few framework cleanups Andrew Jones
@ 2016-12-19 16:23 ` Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 2/3] report already adds a newline Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY Andrew Jones
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Jones @ 2016-12-19 16:23 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar, lvivier, thuth

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5201472d146f..a32333b0928e 100644
--- a/Makefile
+++ b/Makefile
@@ -94,7 +94,8 @@ libfdt_clean:
 	$(LIBFDT_objdir)/.*.d
 
 distclean: clean libfdt_clean
-	$(RM) lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.*
+	$(RM) lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.* \
+	      build-head
 	$(RM) -r tests
 
 cscope: cscope_dirs = lib lib/libfdt lib/linux $(TEST_DIR) $(ARCH_LIBDIRS) lib/asm-generic
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH kvm-unit-tests 2/3] report already adds a newline
  2016-12-19 16:23 [PATCH kvm-unit-tests 0/3] few framework cleanups Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 1/3] Makefile: distclean should remove build-head Andrew Jones
@ 2016-12-19 16:23 ` Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY Andrew Jones
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Jones @ 2016-12-19 16:23 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar, lvivier, thuth

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 arm/spinlock-test.c | 2 +-
 x86/asyncpf.c       | 8 ++++----
 x86/svm.c           | 4 ++--
 x86/vmx_tests.c     | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arm/spinlock-test.c b/arm/spinlock-test.c
index 6009ba087e4b..7676a1523db5 100644
--- a/arm/spinlock-test.c
+++ b/arm/spinlock-test.c
@@ -58,7 +58,7 @@ static void test_spinlock(void)
 
 		lock_ops.unlock(&global_lock);
 	}
-	report("CPU%d: Done - Errors: %d\n", errors == 0, cpu, errors);
+	report("CPU%d: Done - Errors: %d", errors == 0, cpu, errors);
 
 	cpumask_set_cpu(cpu, &smp_test_complete);
 	if (cpu != 0)
diff --git a/x86/asyncpf.c b/x86/asyncpf.c
index a6051ab03eed..e29e07c556f3 100644
--- a/x86/asyncpf.c
+++ b/x86/asyncpf.c
@@ -52,13 +52,13 @@ static void pf_isr(struct ex_regs *r)
 
 	switch (reason) {
 		case 0:
-			report("unexpected #PF at %p\n", false, read_cr2());
+			report("unexpected #PF at %p", false, read_cr2());
 			break;
 		case KVM_PV_REASON_PAGE_NOT_PRESENT:
 			phys = virt_to_phys_cr3(virt);
 			install_pte(phys_to_virt(read_cr3()), 1, virt, phys, 0);
 			write_cr3(read_cr3());
-			report("Got not present #PF token %x virt addr %p phys addr %p\n",
+			report("Got not present #PF token %x virt addr %p phys addr %p",
 					true, read_cr2(), virt, phys);
 			while(phys) {
 				safe_halt(); /* enables irq */
@@ -66,7 +66,7 @@ static void pf_isr(struct ex_regs *r)
 			}
 			break;
 		case KVM_PV_REASON_PAGE_READY:
-			report("Got present #PF token %x\n", true, read_cr2());
+			report("Got present #PF token %x", true, read_cr2());
 			if ((uint32_t)read_cr2() == ~0)
 				break;
 			install_pte(phys_to_virt(read_cr3()), 1, virt, phys | PT_PRESENT_MASK | PT_WRITABLE_MASK, 0);
@@ -74,7 +74,7 @@ static void pf_isr(struct ex_regs *r)
 			phys = 0;
 			break;
 		default:
-			report("unexpected async pf reason %d\n", false, reason);
+			report("unexpected async pf reason %d", false, reason);
 			break;
 	}
 }
diff --git a/x86/svm.c b/x86/svm.c
index cef0f568d611..25ac0ce4a645 100644
--- a/x86/svm.c
+++ b/x86/svm.c
@@ -603,7 +603,7 @@ static void test_ioio(struct test *test)
     return;
 
 fail:
-    report("stage %d\n", false, get_test_stage(test));
+    report("stage %d", false, get_test_stage(test));
     test->scratch = -1;
 }
 
@@ -678,7 +678,7 @@ static void sel_cr0_bug_test(struct test *test)
      * are not in guest-mode anymore so we can't trigger an intercept.
      * Trigger a tripple-fault for now.
      */
-    report("sel_cr0 test. Can not recover from this - exiting\n", false);
+    report("sel_cr0 test. Can not recover from this - exiting", false);
     exit(report_summary());
 }
 
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 5fd95706c418..911bb618d55c 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -1098,7 +1098,7 @@ static int ept_exit_handler()
 						(unsigned long)data_page2,
 						EPT_RA | EPT_WA | EPT_EA);
 			} else
-				report("EPT basic framework - write\n", 0);
+				report("EPT basic framework - write", 0);
 			break;
 		case 1:
 			install_ept(pml4, (unsigned long)data_page1,
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY
  2016-12-19 16:23 [PATCH kvm-unit-tests 0/3] few framework cleanups Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 1/3] Makefile: distclean should remove build-head Andrew Jones
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 2/3] report already adds a newline Andrew Jones
@ 2016-12-19 16:23 ` Andrew Jones
  2016-12-22 10:53   ` Andrew Jones
  2 siblings, 1 reply; 6+ messages in thread
From: Andrew Jones @ 2016-12-19 16:23 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar, lvivier, thuth

Currently test.log gets output of the form

 test1-command-line
 test1-output

 SUMMARY:
 test2-command-line
 test2-output

 SUMMARY:
 test3-command-line
 ...

Having a blank line before SUMMARY, and not after, it makes it
tough to group lines by eye. Change it to

 test1-command-line
 test1-output
 SUMMARY:

 test2-command-line
 test2-output
 SUMMARY:

 test3-command-line
 ...

The empty line is moved from report_summary to runtime in order
to remove it altogether when running tests individually or as a
standalone.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 scripts/runtime.bash | 1 +
 lib/report.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 11a40a92183a..9c1bc3b3b3fe 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -108,6 +108,7 @@ function run()
     summary=$(eval $cmdline 2> >(RUNTIME_log_stderr) \
                              > >(tee >(RUNTIME_log_stdout $kernel) | extract_summary))
     ret=$?
+    [ "$STANDALONE" != "yes" ] && echo > >(RUNTIME_log_stdout $kernel)
 
     if [ $ret -eq 0 ]; then
         echo "`PASS` $1 $summary"
diff --git a/lib/report.c b/lib/report.c
index fc0ef494f412..e24e81382f9e 100644
--- a/lib/report.c
+++ b/lib/report.c
@@ -109,7 +109,7 @@ int report_summary(void)
 {
 	spin_lock(&lock);
 
-	printf("\nSUMMARY: %d tests", tests);
+	printf("SUMMARY: %d tests", tests);
 	if (failures)
 		printf(", %d unexpected failures", failures);
 	if (xfailures)
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY
  2016-12-19 16:23 ` [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY Andrew Jones
@ 2016-12-22 10:53   ` Andrew Jones
  2016-12-22 11:13     ` Paolo Bonzini
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Jones @ 2016-12-22 10:53 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar, lvivier, thuth

On Mon, Dec 19, 2016 at 05:23:05PM +0100, Andrew Jones wrote:
> Currently test.log gets output of the form
> 
>  test1-command-line
>  test1-output
> 
>  SUMMARY:
>  test2-command-line
>  test2-output
> 
>  SUMMARY:
>  test3-command-line
>  ...
> 
> Having a blank line before SUMMARY, and not after, it makes it
> tough to group lines by eye. Change it to
> 
>  test1-command-line
>  test1-output
>  SUMMARY:
> 
>  test2-command-line
>  test2-output
>  SUMMARY:
> 
>  test3-command-line
>  ...
> 
> The empty line is moved from report_summary to runtime in order
> to remove it altogether when running tests individually or as a
> standalone.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  scripts/runtime.bash | 1 +
>  lib/report.c         | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 11a40a92183a..9c1bc3b3b3fe 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -108,6 +108,7 @@ function run()
>      summary=$(eval $cmdline 2> >(RUNTIME_log_stderr) \
>                               > >(tee >(RUNTIME_log_stdout $kernel) | extract_summary))
>      ret=$?
> +    [ "$STANDALONE" != "yes" ] && echo > >(RUNTIME_log_stdout $kernel)

Hmm, even though this works, because of how we define RUNTIME_log_stdout
(eventually using '>> test.log'), I should have used '>>' here as well
for correctness.

Paolo,

Assuming we want to merge this patch, will you fix it up on commit? Or
should I send a v2?

Thanks,
drew

>  
>      if [ $ret -eq 0 ]; then
>          echo "`PASS` $1 $summary"
> diff --git a/lib/report.c b/lib/report.c
> index fc0ef494f412..e24e81382f9e 100644
> --- a/lib/report.c
> +++ b/lib/report.c
> @@ -109,7 +109,7 @@ int report_summary(void)
>  {
>  	spin_lock(&lock);
>  
> -	printf("\nSUMMARY: %d tests", tests);
> +	printf("SUMMARY: %d tests", tests);
>  	if (failures)
>  		printf(", %d unexpected failures", failures);
>  	if (xfailures)
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY
  2016-12-22 10:53   ` Andrew Jones
@ 2016-12-22 11:13     ` Paolo Bonzini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2016-12-22 11:13 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: rkrcmar, lvivier, thuth



On 22/12/2016 11:53, Andrew Jones wrote:
>>      summary=$(eval $cmdline 2> >(RUNTIME_log_stderr) \
>>                               > >(tee >(RUNTIME_log_stdout $kernel) | extract_summary))
>>      ret=$?
>> +    [ "$STANDALONE" != "yes" ] && echo > >(RUNTIME_log_stdout $kernel)
> Hmm, even though this works, because of how we define RUNTIME_log_stdout
> (eventually using '>> test.log'), I should have used '>>' here as well
> for correctness.

I think it's okay, you're effectively writing to a pipe and the pipe is
opened by this echo invocation.  If you do a strace you can see that
it's basically

	echo | RUNTIME_log_stdout

Here:

    pipe([3, 4])          = 0
    fcntl(63, F_GETFD)    = -1 EBADF (Bad file descriptor)
    dup2(4, 63)           = 63
    close(4)              = 0

Thanks,

Paolo

> Paolo,
> 
> Assuming we want to merge this patch, will you fix it up on commit? Or
> should I send a v2?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-12-22 11:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-19 16:23 [PATCH kvm-unit-tests 0/3] few framework cleanups Andrew Jones
2016-12-19 16:23 ` [PATCH kvm-unit-tests 1/3] Makefile: distclean should remove build-head Andrew Jones
2016-12-19 16:23 ` [PATCH kvm-unit-tests 2/3] report already adds a newline Andrew Jones
2016-12-19 16:23 ` [PATCH kvm-unit-tests 3/3] report: move blank line to better side of SUMMARY Andrew Jones
2016-12-22 10:53   ` Andrew Jones
2016-12-22 11:13     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.