2929VULN_DIR = "/sys/devices/system/cpu/vulnerabilities"
3030
3131
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+
3240def configure_microvm (
3341 factory ,
3442 kernel ,
@@ -211,10 +219,7 @@ def check_vulnerabilities_on_guest(status):
211219 assert report_guest_vulnerabilities == known_guest_vulnerabilities
212220
213221
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
218223def test_spectre_meltdown_checker_on_host (spectre_meltdown_checker ):
219224 """
220225 Test with the spectre / meltdown checker on host.
@@ -249,10 +254,7 @@ def test_spectre_meltdown_checker_on_host(spectre_meltdown_checker):
249254 assert report == expected , f"Unexpected vulnerabilities: { report } vs { expected } "
250255
251256
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
256258def test_spectre_meltdown_checker_on_guest (spectre_meltdown_checker , build_microvm ):
257259 """
258260 Test with the spectre / meltdown checker on guest.
@@ -270,10 +272,7 @@ def test_spectre_meltdown_checker_on_guest(spectre_meltdown_checker, build_micro
270272 check_vulnerabilities_on_guest (status )
271273
272274
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
277276def test_spectre_meltdown_checker_on_restored_guest (
278277 spectre_meltdown_checker , build_microvm , microvm_factory
279278):
@@ -294,10 +293,7 @@ def test_spectre_meltdown_checker_on_restored_guest(
294293 check_vulnerabilities_on_guest (status )
295294
296295
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
301297def test_spectre_meltdown_checker_on_guest_with_template (
302298 spectre_meltdown_checker , build_microvm_with_template
303299):
@@ -314,10 +310,7 @@ def test_spectre_meltdown_checker_on_guest_with_template(
314310 )
315311
316312
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
321314def test_spectre_meltdown_checker_on_guest_with_custom_template (
322315 spectre_meltdown_checker , build_microvm_with_custom_template
323316):
@@ -333,10 +326,7 @@ def test_spectre_meltdown_checker_on_guest_with_custom_template(
333326 )
334327
335328
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
340330def test_spectre_meltdown_checker_on_restored_guest_with_template (
341331 spectre_meltdown_checker , build_microvm_with_template , microvm_factory
342332):
@@ -355,10 +345,7 @@ def test_spectre_meltdown_checker_on_restored_guest_with_template(
355345 )
356346
357347
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
362349def test_spectre_meltdown_checker_on_restored_guest_with_custom_template (
363350 spectre_meltdown_checker ,
364351 build_microvm_with_custom_template ,
0 commit comments