ui/cocoa.m: Drop old macOS-10.12-and-earlier compat ifdefs
[qemu/armbru.git] / tests / avocado / netdev-ethtool.py
blob5f33288f8119d11ce9add857a2f51be34f31af55
1 # ethtool tests for emulated network devices
3 # This test leverages ethtool's --test sequence to validate network
4 # device behaviour.
6 # SPDX-License-Identifier: GPL-2.0-or-late
8 from avocado import skip
9 from avocado_qemu import QemuSystemTest
10 from avocado_qemu import wait_for_console_pattern
12 class NetDevEthtool(QemuSystemTest):
13 """
14 :avocado: tags=arch:x86_64
15 :avocado: tags=machine:q35
16 """
18 # Runs in about 17s under KVM, 19s under TCG, 25s under GCOV
19 timeout = 45
21 # Fetch assets from the netdev-ethtool subdir of my shared test
22 # images directory on fileserver.linaro.org.
23 def get_asset(self, name, sha1):
24 base_url = ('https://fileserver.linaro.org/s/'
25 'kE4nCFLdQcoBF9t/download?'
26 'path=%2Fnetdev-ethtool&files=' )
27 url = base_url + name
28 # use explicit name rather than failing to neatly parse the
29 # URL into a unique one
30 return self.fetch_asset(name=name, locations=(url), asset_hash=sha1)
32 def common_test_code(self, netdev, extra_args=None):
34 # This custom kernel has drivers for all the supported network
35 # devices we can emulate in QEMU
36 kernel = self.get_asset("bzImage",
37 "33469d7802732d5815226166581442395cb289e2")
39 rootfs = self.get_asset("rootfs.squashfs",
40 "9793cea7021414ae844bda51f558bd6565b50cdc")
42 append = 'printk.time=0 console=ttyS0 '
43 append += 'root=/dev/sr0 rootfstype=squashfs '
45 # any additional kernel tweaks for the test
46 if extra_args:
47 append += extra_args
49 # finally invoke ethtool directly
50 append += ' init=/usr/sbin/ethtool -- -t eth1 offline'
52 # add the rootfs via a readonly cdrom image
53 drive = f"file={rootfs},if=ide,index=0,media=cdrom"
55 self.vm.add_args('-kernel', kernel,
56 '-append', append,
57 '-drive', drive,
58 '-device', netdev)
60 self.vm.set_console(console_index=0)
61 self.vm.launch()
63 wait_for_console_pattern(self,
64 "The test result is PASS",
65 "The test result is FAIL",
66 vm=None)
67 # no need to gracefully shutdown, just finish
68 self.vm.kill()
70 def test_igb(self):
71 """
72 :avocado: tags=device:igb
73 """
74 self.common_test_code("igb")
76 def test_igb_nomsi(self):
77 """
78 :avocado: tags=device:igb
79 """
80 self.common_test_code("igb", "pci=nomsi")
82 # It seems the other popular cards we model in QEMU currently fail
83 # the pattern test with:
85 # pattern test failed (reg 0x00178): got 0x00000000 expected 0x00005A5A
87 # So for now we skip them.
89 @skip("Incomplete reg 0x00178 support")
90 def test_e1000(self):
91 """
92 :avocado: tags=device:e1000
93 """
94 self.common_test_code("e1000")
96 @skip("Incomplete reg 0x00178 support")
97 def test_i82550(self):
98 """
99 :avocado: tags=device:i82550
101 self.common_test_code("i82550")