11
11
import pandas
12
12
import pytest
13
13
14
- from framework .utils_iperf import IPerf3Test , emit_iperf3_metrics
14
+ from framework .utils_cpuid import check_guest_cpuid_output
15
+
16
+ # from framework.utils_iperf import IPerf3Test, emit_iperf3_metrics
15
17
from host_tools .cargo_build import gcc_compile
16
- from host_tools .fcmetrics import FCMetricsMonitor
18
+
19
+ # from host_tools.fcmetrics import FCMetricsMonitor
17
20
18
21
19
22
@pytest .mark .skipif (
@@ -28,7 +31,7 @@ def test_custom_udev_rule_latency(
28
31
"""Test the latency for hotplugging and booting CPUs in the guest"""
29
32
gcc_compile (Path ("./host_tools/hotplug_time.c" ), Path ("host_tools/hotplug_time.o" ))
30
33
data = []
31
- for i in range (50 ):
34
+ for _ in range (20 ):
32
35
uvm_hotplug = microvm_factory .build (guest_kernel_linux_acpi_only , rootfs_rw )
33
36
uvm_hotplug .jailer .extra_args .update ({"boot-timer" : None , "no-seccomp" : None })
34
37
uvm_hotplug .help .enable_console ()
@@ -51,7 +54,7 @@ def test_custom_udev_rule_latency(
51
54
)
52
55
53
56
uvm_hotplug .api .hotplug .put (Vcpu = {"add" : vcpu_count })
54
- time .sleep (2 )
57
+ time .sleep (5 )
55
58
56
59
# Extract API call duration
57
60
api_duration = (
@@ -73,10 +76,24 @@ def test_custom_udev_rule_latency(
73
76
/ 1000
74
77
)
75
78
except IndexError :
76
- timestamp = None
79
+ uvm_hotplug .kill ()
80
+ data .append ({"vcpus" : vcpu_count , "api" : api_duration , "onlining" : None })
81
+ continue
77
82
78
83
data .append ({"vcpus" : vcpu_count , "api" : api_duration , "onlining" : timestamp })
79
84
85
+ check_guest_cpuid_output (
86
+ uvm_hotplug ,
87
+ "lscpu" ,
88
+ None ,
89
+ ":" ,
90
+ {
91
+ "CPU(s)" : str (1 + vcpu_count ),
92
+ "On-line CPU(s) list" : f"0-{ vcpu_count } " ,
93
+ },
94
+ )
95
+ uvm_hotplug .kill ()
96
+
80
97
output_file = results_dir / f"hotplug-{ vcpu_count } .csv"
81
98
82
99
csv_data = pandas .DataFrame .from_dict (data ).to_csv (
@@ -99,7 +116,7 @@ def test_manual_latency(
99
116
"""Test the latency for hotplugging and booting CPUs in the guest"""
100
117
gcc_compile (Path ("./host_tools/hotplug_time.c" ), Path ("host_tools/hotplug_time.o" ))
101
118
data = []
102
- for _ in range (50 ):
119
+ for _ in range (20 ):
103
120
uvm_hotplug = microvm_factory .build (guest_kernel_linux_acpi_only , rootfs_rw )
104
121
uvm_hotplug .jailer .extra_args .update ({"boot-timer" : None , "no-seccomp" : None })
105
122
uvm_hotplug .help .enable_console ()
@@ -113,11 +130,13 @@ def test_manual_latency(
113
130
uvm_hotplug .ssh .scp_put (
114
131
Path ("./host_tools/hotplug_time.o" ), Path ("/home/hotplug_time.o" )
115
132
)
116
- uvm_hotplug .ssh .run ("tmux new-session -d /bin/bash /home/hotplug.sh" )
133
+ uvm_hotplug .ssh .run (
134
+ f"tmux new-session -d /bin/bash /home/hotplug.sh { vcpu_count } "
135
+ )
117
136
118
137
uvm_hotplug .api .hotplug .put (Vcpu = {"add" : vcpu_count })
119
138
120
- time .sleep (1. 5 )
139
+ time .sleep (5 )
121
140
# Extract API call duration
122
141
api_duration = (
123
142
float (
@@ -139,10 +158,24 @@ def test_manual_latency(
139
158
)
140
159
except IndexError :
141
160
data .append ({"vcpus" : vcpu_count , "api" : api_duration , "onlining" : None })
161
+ uvm_hotplug .kill ()
142
162
continue
143
163
144
164
data .append ({"vcpus" : vcpu_count , "api" : api_duration , "onlining" : timestamp })
145
165
166
+ check_guest_cpuid_output (
167
+ uvm_hotplug ,
168
+ "lscpu" ,
169
+ None ,
170
+ ":" ,
171
+ {
172
+ "CPU(s)" : str (1 + vcpu_count ),
173
+ "On-line CPU(s) list" : f"0-{ vcpu_count } " ,
174
+ },
175
+ )
176
+
177
+ uvm_hotplug .kill ()
178
+
146
179
output_file = results_dir / f"hotplug-{ vcpu_count } .csv"
147
180
148
181
csv_data = pandas .DataFrame .from_dict (data ).to_csv (
0 commit comments