-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vm_hugetlb_selftests: hugetlb kernel selftests execution in guest
Creates a new test case that downloads the current kernel source RPM, extracts the files, compiles the mm selftests and executes the hugetlb selftests to ensure the correct behavior of this feature at the VM level. Signed-off-by: mcasquer <[email protected]>
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
- vm_hugetlb_selftests: | ||
only Linux | ||
only x86_64 | ||
type = vm_hugetlb_selftests | ||
virt_test_type = qemu | ||
setup_hugepages = yes | ||
depends_pkgs = rsync libcap-devel numactl-devel glibc-devel | ||
kernel_path = "/home/kernel" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from virttest import error_context | ||
from virttest import utils_package | ||
|
||
|
||
@error_context.context_aware | ||
def run(test, params, env): | ||
""" | ||
vm_hugetlb_selftests test | ||
1) Download the current kernel source RPM | ||
2) Extract the RPM files | ||
3) Extract the linux package and compile the mm selftests | ||
4) Execute the higetlb kernel selftests | ||
:param test: QEMU test object | ||
:param params: Dictionary with the test parameters | ||
:param env: Dictionary with test environment | ||
""" | ||
vm = env.get_vm(params["main_vm"]) | ||
vm.verify_alive() | ||
session = vm.wait_for_login() | ||
kernel_path = params.get("kernel_path", "/home/kernel") | ||
vm_arch = params["vm_arch_name"] | ||
pkgs = params.objects("depends_pkgs") | ||
if not utils_package.package_install(pkgs, session): | ||
test.cancel("Install dependency packages failed") | ||
|
||
error_context.context("Extract the RPM files", test.log.debug) | ||
session.cmd("cd %s" % kernel_path) | ||
session.cmd("rpm2cpio kernel-*.rpm | cpio -div") | ||
session.cmd("tar -xvf linux-*.tar.xz") | ||
session.cmd("cd linux-*/tools/testing/selftests/mm") | ||
|
||
error_context.base_context("Compile the mm selftests", test.log.info) | ||
s, o = session.cmd_status_output("make") | ||
if s != 0: | ||
test.fail("Error during mm selftests compilation: %s" % o) | ||
|
||
error_context.base_context("Execute the hugetlb selftests", test.log.info) | ||
s, o = session.cmd_status_output("sh run_vmtests.sh -t hugetlb", 180) | ||
if s != 0: | ||
test.fail("Error during hugetlb selftests execution: %s" % o) | ||
|
||
error_context.context("The hugeltb tests results: %s" % o, test.log.debug) |