|
2 | 2 | # SPDX-License-Identifier: Apache-2.0
|
3 | 3 | """Tests the VSOCK throughput of Firecracker uVMs."""
|
4 | 4 |
|
| 5 | +import json |
5 | 6 | import os
|
| 7 | +from pathlib import Path |
6 | 8 |
|
7 | 9 | import pytest
|
8 | 10 |
|
@@ -73,7 +75,14 @@ def guest_command(self, port_offset):
|
73 | 75 | @pytest.mark.parametrize("payload_length", ["64K", "1024K"], ids=["p64K", "p1024K"])
|
74 | 76 | @pytest.mark.parametrize("mode", ["g2h", "h2g", "bd"])
|
75 | 77 | def test_vsock_throughput(
|
76 |
| - microvm_factory, guest_kernel_acpi, rootfs, vcpus, payload_length, mode, metrics |
| 78 | + microvm_factory, |
| 79 | + guest_kernel_acpi, |
| 80 | + rootfs, |
| 81 | + vcpus, |
| 82 | + payload_length, |
| 83 | + mode, |
| 84 | + metrics, |
| 85 | + results_dir, |
77 | 86 | ):
|
78 | 87 | """
|
79 | 88 | Test vsock throughput for multiple vm configurations.
|
@@ -107,4 +116,13 @@ def test_vsock_throughput(
|
107 | 116 | test = VsockIPerf3Test(vm, mode, payload_length)
|
108 | 117 | data = test.run_test(vm.vcpus_count + 2)
|
109 | 118 |
|
| 119 | + for i, g2h in enumerate(data["g2h"]): |
| 120 | + Path(results_dir / f"g2h_{i}.json").write_text( |
| 121 | + json.dumps(g2h), encoding="utf-8" |
| 122 | + ) |
| 123 | + for i, h2g in enumerate(data["h2g"]): |
| 124 | + Path(results_dir / f"h2g_{i}.json").write_text( |
| 125 | + json.dumps(h2g), encoding="utf-8" |
| 126 | + ) |
| 127 | + |
110 | 128 | emit_iperf3_metrics(metrics, data, VsockIPerf3Test.WARMUP_SEC)
|
0 commit comments