kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests
@ 2019-12-11  9:42 Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 1/4] scripts: Fix premature_failure() check with newer versions of QEMU Thomas Huth
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Thomas Huth @ 2019-12-11  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, kvm; +Cc: Drew Jones

QEMU recently changed the error message that it prints out when a
kernel could not be loaded, so we have to adjust our script in
kvm-unit-tests accordingly.
Once this is fixed, add two missing tests (setjmp and cmpxchg8b) to
the unittests.cfg and CI pipelines.

Thomas Huth (4):
  scripts: Fix premature_failure() check with newer versions of QEMU
  x86: Fix coding style in setjmp.c
  x86: Add the setjmp test to the CI
  x86: Add the cmpxchg8b test to the CI

 .gitlab-ci.yml       |  4 ++--
 .travis.yml          |  6 +++---
 scripts/runtime.bash |  2 +-
 x86/setjmp.c         | 22 ++++++++++------------
 x86/unittests.cfg    |  7 +++++++
 5 files changed, 23 insertions(+), 18 deletions(-)

-- 
2.18.1


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

* [kvm-unit-tests PATCH 1/4] scripts: Fix premature_failure() check with newer versions of QEMU
  2019-12-11  9:42 [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Thomas Huth
@ 2019-12-11  9:42 ` Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 2/4] x86: Fix coding style in setjmp.c Thomas Huth
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2019-12-11  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, kvm; +Cc: Drew Jones

QEMU recently changed its output if it could not open a kernel file
from "could not load kernel ..." to "could not open kernel ...", see
QEMU commit 350f5233d755 ("hw/i386/pc: avoid an assignment in if
condition in x86_load_linux()"). Thus we have to adapt our script
that looks for this string accordingly.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 scripts/runtime.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index fbad0bd..eb60890 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -18,7 +18,7 @@ premature_failure()
     local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
 
     echo "$log" | grep "_NO_FILE_4Uhere_" |
-        grep -q -e "could not load kernel" -e "error loading" &&
+        grep -q -e "could not \(load\|open\) kernel" -e "error loading" &&
         return 1
 
     RUNTIME_log_stderr <<< "$log"
-- 
2.18.1


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

* [kvm-unit-tests PATCH 2/4] x86: Fix coding style in setjmp.c
  2019-12-11  9:42 [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 1/4] scripts: Fix premature_failure() check with newer versions of QEMU Thomas Huth
@ 2019-12-11  9:42 ` Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 3/4] x86: Add the setjmp test to the CI Thomas Huth
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2019-12-11  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, kvm; +Cc: Drew Jones

No functional change, just use tabs for indentation.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 x86/setjmp.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/x86/setjmp.c b/x86/setjmp.c
index 1874944..1a848b4 100644
--- a/x86/setjmp.c
+++ b/x86/setjmp.c
@@ -9,18 +9,18 @@ static const int expected[] = {
 
 int main(void)
 {
-    volatile int index = 0;
-    jmp_buf j;
-    int i;
+	volatile int index = 0;
+	jmp_buf j;
+	int i;
 
-    i = setjmp(j);
-    if (expected[index] != i) {
-	    printf("FAIL: actual %d / expected %d\n", i, expected[index]);
-	    return -1;
-    }
-    index++;
-    if (i + 1 < NUM_LONGJMPS)
-	    longjmp(j, i + 1);
+	i = setjmp(j);
+	if (expected[index] != i) {
+		printf("FAIL: actual %d / expected %d\n", i, expected[index]);
+		return -1;
+	}
+	index++;
+	if (i + 1 < NUM_LONGJMPS)
+		longjmp(j, i + 1);
 
-    return 0;
+	return 0;
 }
-- 
2.18.1


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

* [kvm-unit-tests PATCH 3/4] x86: Add the setjmp test to the CI
  2019-12-11  9:42 [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 1/4] scripts: Fix premature_failure() check with newer versions of QEMU Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 2/4] x86: Fix coding style in setjmp.c Thomas Huth
@ 2019-12-11  9:42 ` Thomas Huth
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 4/4] x86: Add the cmpxchg8b " Thomas Huth
  2020-01-08 12:16 ` [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Paolo Bonzini
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2019-12-11  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, kvm; +Cc: Drew Jones

Use a proper report() in the test instead of printf(), and add
it to the unittests.cfg and the CI yaml files.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .gitlab-ci.yml    | 4 ++--
 .travis.yml       | 4 ++--
 x86/setjmp.c      | 8 +++-----
 x86/unittests.cfg | 3 +++
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fbf3328..ea1aeaf 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -67,7 +67,7 @@ build-x86_64:
      ioapic-split ioapic smptest smptest3 vmexit_cpuid vmexit_mov_from_cr8
      vmexit_mov_to_cr8 vmexit_inl_pmtimer  vmexit_ipi vmexit_ipi_halt
      vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed
-     eventinj msr port80 syscall tsc rmap_chain umip intel_iommu
+     eventinj msr port80 setjmp syscall tsc rmap_chain umip intel_iommu
      | tee results.txt
  - if grep -q FAIL results.txt ; then exit 1 ; fi
 
@@ -77,6 +77,6 @@ build-i386:
  - ./configure --arch=i386
  - make -j2
  - ACCEL=tcg ./run_tests.sh
-     eventinj port80 sieve tsc taskswitch taskswitch2 umip
+     eventinj port80 setjmp sieve tsc taskswitch taskswitch2 umip
      | tee results.txt
  - if grep -q FAIL results.txt ; then exit 1 ; fi
diff --git a/.travis.yml b/.travis.yml
index 75bcf08..53f8d7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,7 @@ matrix:
       - BUILD_DIR="."
       - TESTS="access asyncpf debug emulator ept hypercall hyperv_stimer
                hyperv_synic idt_test intel_iommu ioapic ioapic-split
-               kvmclock_test msr pcid rdpru realmode rmap_chain s3 umip"
+               kvmclock_test msr pcid rdpru realmode rmap_chain s3 setjmp umip"
       - ACCEL="kvm"
 
     - addons:
@@ -45,7 +45,7 @@ matrix:
       - BUILD_DIR="i386-builddir"
       - TESTS="tsx-ctrl umip vmexit_cpuid vmexit_ipi vmexit_ipi_halt
                vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ple_round_robin
-               vmexit_tscdeadline vmexit_tscdeadline_immed vmexit_vmcall"
+               vmexit_tscdeadline vmexit_tscdeadline_immed vmexit_vmcall setjmp"
       - ACCEL="kvm"
 
     - addons:
diff --git a/x86/setjmp.c b/x86/setjmp.c
index 1a848b4..cc411cd 100644
--- a/x86/setjmp.c
+++ b/x86/setjmp.c
@@ -14,13 +14,11 @@ int main(void)
 	int i;
 
 	i = setjmp(j);
-	if (expected[index] != i) {
-		printf("FAIL: actual %d / expected %d\n", i, expected[index]);
-		return -1;
-	}
+	report(expected[index] == i, "actual %d == expected %d",
+	       i, expected[index]);
 	index++;
 	if (i + 1 < NUM_LONGJMPS)
 		longjmp(j, i + 1);
 
-	return 0;
+	return report_summary();
 }
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index e99b086..acdde10 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -171,6 +171,9 @@ file = realmode.flat
 [s3]
 file = s3.flat
 
+[setjmp]
+file = setjmp.flat
+
 [sieve]
 file = sieve.flat
 timeout = 180
-- 
2.18.1


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

* [kvm-unit-tests PATCH 4/4] x86: Add the cmpxchg8b test to the CI
  2019-12-11  9:42 [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Thomas Huth
                   ` (2 preceding siblings ...)
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 3/4] x86: Add the setjmp test to the CI Thomas Huth
@ 2019-12-11  9:42 ` Thomas Huth
  2020-01-08 12:16 ` [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Paolo Bonzini
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2019-12-11  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, kvm; +Cc: Drew Jones

Add an entry for this test to the unittests.cfg file and
enable it in the CI pipelines.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 .gitlab-ci.yml    | 2 +-
 .travis.yml       | 2 +-
 x86/unittests.cfg | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ea1aeaf..67f7d80 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -77,6 +77,6 @@ build-i386:
  - ./configure --arch=i386
  - make -j2
  - ACCEL=tcg ./run_tests.sh
-     eventinj port80 setjmp sieve tsc taskswitch taskswitch2 umip
+     cmpxchg8b eventinj port80 setjmp sieve tsc taskswitch taskswitch2 umip
      | tee results.txt
  - if grep -q FAIL results.txt ; then exit 1 ; fi
diff --git a/.travis.yml b/.travis.yml
index 53f8d7d..091d071 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -43,7 +43,7 @@ matrix:
       env:
       - CONFIG="--arch=i386"
       - BUILD_DIR="i386-builddir"
-      - TESTS="tsx-ctrl umip vmexit_cpuid vmexit_ipi vmexit_ipi_halt
+      - TESTS="cmpxchg8b tsx-ctrl umip vmexit_cpuid vmexit_ipi vmexit_ipi_halt
                vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ple_round_robin
                vmexit_tscdeadline vmexit_tscdeadline_immed vmexit_vmcall setjmp"
       - ACCEL="kvm"
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index acdde10..51e4ba5 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -49,6 +49,10 @@ smp = 4
 extra_params = -cpu qemu64
 arch = x86_64
 
+[cmpxchg8b]
+file = cmpxchg8b.flat
+arch = i386
+
 [smptest]
 file = smptest.flat
 smp = 2
-- 
2.18.1


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

* Re: [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests
  2019-12-11  9:42 [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Thomas Huth
                   ` (3 preceding siblings ...)
  2019-12-11  9:42 ` [kvm-unit-tests PATCH 4/4] x86: Add the cmpxchg8b " Thomas Huth
@ 2020-01-08 12:16 ` Paolo Bonzini
  4 siblings, 0 replies; 6+ messages in thread
From: Paolo Bonzini @ 2020-01-08 12:16 UTC (permalink / raw)
  To: Thomas Huth, kvm; +Cc: Drew Jones

On 11/12/19 10:42, Thomas Huth wrote:
> QEMU recently changed the error message that it prints out when a
> kernel could not be loaded, so we have to adjust our script in
> kvm-unit-tests accordingly.
> Once this is fixed, add two missing tests (setjmp and cmpxchg8b) to
> the unittests.cfg and CI pipelines.
> 
> Thomas Huth (4):
>   scripts: Fix premature_failure() check with newer versions of QEMU
>   x86: Fix coding style in setjmp.c
>   x86: Add the setjmp test to the CI
>   x86: Add the cmpxchg8b test to the CI
> 
>  .gitlab-ci.yml       |  4 ++--
>  .travis.yml          |  6 +++---
>  scripts/runtime.bash |  2 +-
>  x86/setjmp.c         | 22 ++++++++++------------
>  x86/unittests.cfg    |  7 +++++++
>  5 files changed, 23 insertions(+), 18 deletions(-)
> 

Applied, thanks.

Paolo


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

end of thread, other threads:[~2020-01-08 12:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  9:42 [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Thomas Huth
2019-12-11  9:42 ` [kvm-unit-tests PATCH 1/4] scripts: Fix premature_failure() check with newer versions of QEMU Thomas Huth
2019-12-11  9:42 ` [kvm-unit-tests PATCH 2/4] x86: Fix coding style in setjmp.c Thomas Huth
2019-12-11  9:42 ` [kvm-unit-tests PATCH 3/4] x86: Add the setjmp test to the CI Thomas Huth
2019-12-11  9:42 ` [kvm-unit-tests PATCH 4/4] x86: Add the cmpxchg8b " Thomas Huth
2020-01-08 12:16 ` [kvm-unit-tests PATCH 0/4] Improvements for the x86 tests Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).