Skip to content

Commit

Permalink
Add new test case for SVE support
Browse files Browse the repository at this point in the history
This commit adds a new test case to check
the SVE support on the host. It includes
modifications to the configuration file
and updates to the test script. The new
test case checks for the absence of SVE
on the host.

Signed-off-by: Aakanksha Tripathi <[email protected]>
  • Loading branch information
Aakanksha0311 authored and Aakanksha Tripathi committed Nov 15, 2023
1 parent de5a309 commit 5d68ae3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
6 changes: 5 additions & 1 deletion libvirt/tests/cfg/cpu/aarch64_cpu_sve.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@
vector_lenth_list = '[{"sve":"disable"}, {"sve128":"require"}]'
define_error = "yes"
expect_msg = "SVE disabled, but SVE vector lengths provided"
- host_sve_check:
only negative_test
check_host_sve = "yes"
status_error = "yes"
variants:
- positive_test:
status_error = "no"
- negative_test:
only invalid_length, conflict_length
only invalid_length, conflict_length, host_sve_check
status_error = "yes"
13 changes: 10 additions & 3 deletions libvirt/tests/src/cpu/aarch64_cpu_sve.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def run(test, params, env):

status_error = "yes" == params.get("status_error", "no")
define_error = "yes" == params.get("define_error", "no")
check_host_sve = "yes" == params.get("check_host_sve", "no")
expect_sve = "yes" == params.get("expect_sve", "yes")
expect_msg = params.get("expect_msg", "")
vector_length = params.get("vector_length", "sve")
Expand All @@ -57,10 +58,15 @@ def _prepare_env(vm):
if (not utils_package.package_install("util-linux")
or not utils_package.package_install("util-linux", session)):
test.error("Failed to install util-linux")

# Cancel test if host doesn't support SVE
if process.run(check_sve,
ignore_status=True, shell=True).exit_status:
test.cancel("Host doesn't support SVE")
if not check_host_sve:
test.cancel("Host supports SVE")
else:
return

# To enable SVE: Hardware support && enable kconfig
# CONFIG_ARM64_SVE
if session.cmd_status(check_sve_config % current_boot):
Expand All @@ -86,7 +92,7 @@ def _get_maxium_sve_length(vm):
session = vm.wait_for_login(timeout=120)
ret = session.cmd(get_maxium_sve_length).strip()
# dmesg record maximum sve length in bytes
sve_length_byte = re.search("length (\d+) bytes", ret).groups()[0]
sve_length_byte = re.search(r"length (\d+) bytes", ret).groups()[0]
# Change max_length into sve + length(bit) E.g. sve512
sve_length_bit = "sve" + str(int(sve_length_byte) * 8)
logging.debug("guest sve_length_bit is %s" % sve_length_bit)
Expand Down Expand Up @@ -155,7 +161,8 @@ def _guest_has_sve(vm):
except LibvirtXMLError as e:
if define_error:
if not re.search(expect_msg, str(e)):
test.fail("Expect definition failure: %s but got %s" % (expect_msg, str(e)))
test.fail("Expect definition failure: %s but got %s" %
(expect_msg, str(e)))
return True
else:
test.error("Failed to define guest: %s" % str(e))
Expand Down

0 comments on commit 5d68ae3

Please sign in to comment.