From 287c23a8fba88bf27cc0ab889ebf7a66d7bcd122 Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Thu, 12 Sep 2024 07:54:06 +0100 Subject: [PATCH 1/3] test: hugepages: use SSHConnection.check_output instead of run Seems like it got missed during the big refactor that introduced `check_output` somehow. Fixes: acbef3c8eb1293db0c76837dd9c2115ac5e4465b Signed-off-by: Patrick Roy --- .../integration_tests/performance/test_huge_pages.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/integration_tests/performance/test_huge_pages.py b/tests/integration_tests/performance/test_huge_pages.py index ff13097a9db..034ee6749a0 100644 --- a/tests/integration_tests/performance/test_huge_pages.py +++ b/tests/integration_tests/performance/test_huge_pages.py @@ -128,8 +128,7 @@ def test_hugetlbfs_diff_snapshot(microvm_factory, uvm_plain, uffd_handler_paths) uvm_plain.resume() # Run command to dirty some pages - rc, _, _ = uvm_plain.ssh.run("sync") - assert not rc + uvm_plain.ssh.check_output("sync") snapshot_diff = uvm_plain.snapshot_diff() snapshot_merged = snapshot_diff.rebase_snapshot(base_snapshot) @@ -181,13 +180,11 @@ def test_ept_violation_count( # Wait for microvm to boot. Then spawn fast_page_fault_helper to setup an environment where we can trigger # a lot of fast_page_faults after restoring the snapshot. - rc, _, _ = vm.ssh.run( + vm.ssh.check_output( "nohup /usr/local/bin/fast_page_fault_helper >/dev/null 2>&1 Date: Thu, 12 Sep 2024 12:00:02 +0100 Subject: [PATCH 2/3] chore: fix permission on test_results directory test_results contains files from failed tests from debugging, but the directory is created inside of a privileged docker container. Thus after finishing a test run, fix up the permissions so that it can easily be dealt with. Signed-off-by: Patrick Roy --- tools/devtool | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/devtool b/tools/devtool index 4ac3f2f9882..f3b5cfbe21b 100755 --- a/tools/devtool +++ b/tools/devtool @@ -110,6 +110,7 @@ CTR_FC_ROOT_DIR="/firecracker" # Full path to the build dir, as bind-mounted in the container. CTR_FC_BUILD_DIR="${CTR_FC_ROOT_DIR}/build" +CTR_TEST_RESULTS_DIR="${CTR_FC_ROOT_DIR}/test_results" # Full path to the cargo target dir, as bind-mounted in the container. CTR_CARGO_TARGET_DIR="$CTR_FC_BUILD_DIR/cargo_target" @@ -230,7 +231,7 @@ cmd_fix_perms() { run_devctr \ --workdir "$CTR_FC_ROOT_DIR" \ -- \ - chown -R "$(id -u):$(id -g)" "$CTR_FC_BUILD_DIR" + chown -R "$(id -u):$(id -g)" "$CTR_FC_BUILD_DIR" "$CTR_TEST_RESULTS_DIR" } # Builds the development container from its Dockerfile. From 11dac33ae25a3ad27711d04f179313890d2bad6e Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Fri, 13 Sep 2024 11:47:10 +0100 Subject: [PATCH 3/3] test: vsock: simplify assertions Remove `assert True` as that's just `pass` with extra steps. Remove `if bla: assert False` as that's just `assert bla` with extra steps. Signed-off-by: Patrick Roy --- tests/integration_tests/functional/test_vsock.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/integration_tests/functional/test_vsock.py b/tests/integration_tests/functional/test_vsock.py index 104fbada886..29323feddf4 100644 --- a/tests/integration_tests/functional/test_vsock.py +++ b/tests/integration_tests/functional/test_vsock.py @@ -187,13 +187,11 @@ def test_vsock_transport_reset_h2g( # it shouldn't receive anything. worker.sock.settimeout(0.25) response = worker.sock.recv(32) - if response != b"": - # If we reach here, it means the connection did not close. - assert False, "Connection not closed: response recieved '{}'".format( - response.decode("utf-8") - ) + assert ( + response == b"" + ), f"Connection not closed: response recieved '{response.decode('utf-8')}'" except (SocketTimeout, ConnectionResetError, BrokenPipeError): - assert True + pass # Terminate VM. metrics = test_vm.flush_metrics()