Acceptance test x86_cpu_model_versions: fixes and minor improvements
cover Acceptance test x86_cpu_model_versions: fixes and minor improvements
This corrects some of the messages given on failures (aligning them to the test code), and splits a larger test into smaller and more manageable pieces.
Cleber Rosa (3):
Acceptance test x86_cpu_model_versions: shutdown VMs Acceptance test x86_cpu_model_versions: fix mismatches between test
and messages
Acceptance test x86_cpu_model_versions: split into smaller tests
tests/acceptance/x86_cpu_model_versions.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.0
PATCH 1/3 Acceptance test x86_cpu_model_versions: shutdown VMs
This shuts down the VMs that won't be used any longer during the remainder of the test.
It's debatable if the very last one should also be shutdown manually, and my opinion is that it shouldn't because that's taken care by the immediately following tearDown().
--- tests/acceptance/x86_cpu_model_versions.py | 7 +++++++ 1 file changed, 7 insertions(+)
tests/acceptance/x86_cpu_model_versions.py +7 -0
@@ -243,6 +243,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server should not have arch-capabilities') + vm.shutdown() vm = self.get_vm() vm.add_args('-S')
@@ -251,6 +252,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server should not have arch-capabilities') + vm.shutdown() # command line must override machine-type if CPU model is not versioned: vm = self.get_vm()
@@ -260,6 +262,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabilities should have arch-capabilities') + vm.shutdown() vm = self.get_vm() vm.add_args('-S')
@@ -268,6 +271,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabilities should not have arch-capabilities') + vm.shutdown() # versioned CPU model overrides machine-type: vm = self.get_vm()
@@ -277,6 +281,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server-v1 should not have arch-capabilities') + vm.shutdown() vm = self.get_vm() vm.add_args('-S')
@@ -285,6 +290,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server-v1 should have arch-capabilities') + vm.shutdown() # command line must override machine-type and versioned CPU model: vm = self.get_vm()
@@ -294,6 +300,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capabilities should have arch-capabilities') + vm.shutdown() vm = self.get_vm() vm.add_args('-S')
Signature · 1 line
2.21.0
PATCH 3/3 Acceptance test x86_cpu_model_versions: split into smaller tests
In reply to Cleber RosaThe justifications being automatic destruction of the vm instances when no longer needed and more compact test naming under a common class.
Besides those, a smaller test makes the one and only assertion rather obvious, which suggests that we could even get rid of the more verbose (and manual) error messages (to be decided).
Naming of the tests tries to follow the following pattern:
test_($cpu_version)_($no_arch_capabitilies_set_or_unset)_($machine_version)
The presence of each naming component is optional, depending on whether the test manually sets it or not.
--- tests/acceptance/x86_cpu_model_versions.py | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-)
tests/acceptance/x86_cpu_model_versions.py +15 -8
@@ -234,7 +234,14 @@ class X86CPUModelAliases(avocado_qemu.Test): self.validate_aliases(cpus) - def test_Cascadelake_arch_capabilities_result(self): + +class CascadelakeArchCapabilities(avocado_qemu.Test): + """ + Validation of Cascadelake arch-capabilities + + :avocado: tags=arch:x86_64 + """ + def test_4_1(self): # machine-type only: vm = self.get_vm() vm.add_args('-S')
@@ -243,8 +250,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server should not have arch-capabilities') - vm.shutdown() + def test_4_0(self): vm = self.get_vm() vm.add_args('-S') vm.set_machine('pc-i440fx-4.0')
@@ -252,8 +259,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server should not have arch-capabilities') - vm.shutdown() + def test_set_4_0(self): # command line must override machine-type if CPU model is not versioned: vm = self.get_vm() vm.add_args('-S')
@@ -262,8 +269,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabilities should have arch-capabilities') - vm.shutdown() + def test_unset_4_1(self): vm = self.get_vm() vm.add_args('-S') vm.set_machine('pc-i440fx-4.1')
@@ -271,8 +278,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabilities should not have arch-capabilities') - vm.shutdown() + def test_v1_4_0(self): # versioned CPU model overrides machine-type: vm = self.get_vm() vm.add_args('-S')
@@ -281,8 +288,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1 should not have arch-capabilities') - vm.shutdown() + def test_v2_4_0(self): vm = self.get_vm() vm.add_args('-S') vm.set_machine('pc-i440fx-4.0')
@@ -290,8 +297,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v2 should have arch-capabilities') - vm.shutdown() + def test_v1_set_4_0(self): # command line must override machine-type and versioned CPU model: vm = self.get_vm() vm.add_args('-S')
@@ -300,8 +307,8 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capabilities should have arch-capabilities') - vm.shutdown() + def test_v2_unset_4_1(self): vm = self.get_vm() vm.add_args('-S') vm.set_machine('pc-i440fx-4.1')
Signature · 1 line
2.21.0
PATCH 2/3 Acceptance test x86_cpu_model_versions: fix mismatches between test and messages
In reply to Cleber RosaThis fixes a few mismatches between the test and the error messages produced in case of failures.
--- tests/acceptance/x86_cpu_model_versions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/acceptance/x86_cpu_model_versions.py +3 -3
@@ -280,7 +280,7 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=on,check=off,enforce=off') vm.launch() self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), - 'pc-i440fx-4.1 + Cascadelake-Server-v1 should not have arch-capabilities') + 'pc-i440fx-4.0 + Cascadelake-Server-v1 should not have arch-capabilities') vm.shutdown() vm = self.get_vm()
@@ -289,14 +289,14 @@ class X86CPUModelAliases(avocado_qemu.Test): vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=on,check=off,enforce=off') vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), - 'pc-i440fx-4.1 + Cascadelake-Server-v1 should have arch-capabilities') + 'pc-i440fx-4.0 + Cascadelake-Server-v2 should have arch-capabilities') vm.shutdown() # command line must override machine-type and versioned CPU model: vm = self.get_vm() vm.add_args('-S') vm.set_machine('pc-i440fx-4.0') - vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=on,check=off,enforce=off,+arch-capabilities') + vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=on,check=off,enforce=off,+arch-capabilities') vm.launch() self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capabilities should have arch-capabilities')
Signature · 1 line
2.21.0
Patchew URL: https://patchew.org/QEMU/[email protected]/
Patchew URL: https://patchew.org/QEMU/[email protected]/
Hi,
This series seems to have some coding style problems. See output below for more information:
Subject: [Qemu-devel] [PATCH 0/3] Acceptance test x86_cpu_model_versions: fixes and minor improvements
Message-id: [email protected]
Type: series
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
2a57147 Acceptance test x86_cpu_model_versions: split into smaller tests 30c6782 Acceptance test x86_cpu_model_versions: fix mismatches between test and messages f63b60f Acceptance test x86_cpu_model_versions: shutdown VMs
=== OUTPUT BEGIN ===
1/3 Checking commit f63b60f49e7a (Acceptance test x86_cpu_model_versions: shutdown VMs)
2/3 Checking commit 30c678277001 (Acceptance test x86_cpu_model_versions: fix mismatches between test and messages)
ERROR: line over 90 characters
#22: FILE: tests/acceptance/x86_cpu_model_versions.py:283:
+ 'pc-i440fx-4.0 + Cascadelake-Server-v1 should not have arch-capabilities')
ERROR: line over 90 characters
#31: FILE: tests/acceptance/x86_cpu_model_versions.py:292:
+ 'pc-i440fx-4.0 + Cascadelake-Server-v2 should have arch-capabilities')
ERROR: line over 90 characters
#39: FILE: tests/acceptance/x86_cpu_model_versions.py:299:
+ vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=on,check=off,enforce=off,+arch-capabilities')
total: 3 errors, 0 warnings, 24 lines checked
Patch 2/3 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.
3/3 Checking commit 2a57147a862b (Acceptance test x86_cpu_model_versions: split into smaller tests) === OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]
Quoted 3 lines · Cleber Rosa
This corrects some of the messages given on failures (aligning them to the test code), and splits a larger test into smaller and more manageable pieces.
Thanks!
I'm queueing this on python-next.
Signature · 1 line
Eduardo