29
29
VULN_DIR = "/sys/devices/system/cpu/vulnerabilities"
30
30
31
31
32
+ skip_if_g3_on_linux_4_14 = pytest .mark .skipif (
33
+ global_props .cpu_model == "ARM_NEOVERSE_V1"
34
+ and global_props .host_linux_version == "4.14" ,
35
+ # Graviton3 instances in 4.14 require a non-SVE kernel to boot
36
+ reason = "[cm]7g 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
37
+ )
38
+
39
+
32
40
def configure_microvm (
33
41
factory ,
34
42
kernel ,
@@ -211,10 +219,7 @@ def check_vulnerabilities_on_guest(status):
211
219
assert report_guest_vulnerabilities == known_guest_vulnerabilities
212
220
213
221
214
- @pytest .mark .skipif (
215
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
216
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
217
- )
222
+ @skip_if_g3_on_linux_4_14
218
223
def test_spectre_meltdown_checker_on_host (spectre_meltdown_checker ):
219
224
"""
220
225
Test with the spectre / meltdown checker on host.
@@ -249,10 +254,7 @@ def test_spectre_meltdown_checker_on_host(spectre_meltdown_checker):
249
254
assert report == expected , f"Unexpected vulnerabilities: { report } vs { expected } "
250
255
251
256
252
- @pytest .mark .skipif (
253
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
254
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
255
- )
257
+ @skip_if_g3_on_linux_4_14
256
258
def test_spectre_meltdown_checker_on_guest (spectre_meltdown_checker , build_microvm ):
257
259
"""
258
260
Test with the spectre / meltdown checker on guest.
@@ -270,10 +272,7 @@ def test_spectre_meltdown_checker_on_guest(spectre_meltdown_checker, build_micro
270
272
check_vulnerabilities_on_guest (status )
271
273
272
274
273
- @pytest .mark .skipif (
274
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
275
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
276
- )
275
+ @skip_if_g3_on_linux_4_14
277
276
def test_spectre_meltdown_checker_on_restored_guest (
278
277
spectre_meltdown_checker , build_microvm , microvm_factory
279
278
):
@@ -294,10 +293,7 @@ def test_spectre_meltdown_checker_on_restored_guest(
294
293
check_vulnerabilities_on_guest (status )
295
294
296
295
297
- @pytest .mark .skipif (
298
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
299
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
300
- )
296
+ @skip_if_g3_on_linux_4_14
301
297
def test_spectre_meltdown_checker_on_guest_with_template (
302
298
spectre_meltdown_checker , build_microvm_with_template
303
299
):
@@ -314,10 +310,7 @@ def test_spectre_meltdown_checker_on_guest_with_template(
314
310
)
315
311
316
312
317
- @pytest .mark .skipif (
318
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
319
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
320
- )
313
+ @skip_if_g3_on_linux_4_14
321
314
def test_spectre_meltdown_checker_on_guest_with_custom_template (
322
315
spectre_meltdown_checker , build_microvm_with_custom_template
323
316
):
@@ -333,10 +326,7 @@ def test_spectre_meltdown_checker_on_guest_with_custom_template(
333
326
)
334
327
335
328
336
- @pytest .mark .skipif (
337
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
338
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
339
- )
329
+ @skip_if_g3_on_linux_4_14
340
330
def test_spectre_meltdown_checker_on_restored_guest_with_template (
341
331
spectre_meltdown_checker , build_microvm_with_template , microvm_factory
342
332
):
@@ -355,10 +345,7 @@ def test_spectre_meltdown_checker_on_restored_guest_with_template(
355
345
)
356
346
357
347
358
- @pytest .mark .skipif (
359
- global_props .instance == "c7g.metal" and global_props .host_linux_version == "4.14" ,
360
- reason = "c7g host 4.14 requires modifications to the 5.10 guest kernel to boot successfully." ,
361
- )
348
+ @skip_if_g3_on_linux_4_14
362
349
def test_spectre_meltdown_checker_on_restored_guest_with_custom_template (
363
350
spectre_meltdown_checker ,
364
351
build_microvm_with_custom_template ,
0 commit comments