test-network: check whether ethtool support driver field for dummy interfaces
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 19 Feb 2019 10:56:48 +0000 (19:56 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 19 Feb 2019 13:00:06 +0000 (22:00 +0900)
Fixes #11758.

test/test-network/systemd-networkd-tests.py

index 718d3ce..797ba7c 100755 (executable)
@@ -289,7 +289,13 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
         output = subprocess.check_output(['networkctl', 'status', 'dropin-*']).rstrip().decode('utf-8')
         self.assertNotRegex(output, '1: lo ')
         self.assertRegex(output, 'dropin-test')
-        #self.assertRegex(output, 'Driver: dummy')
+
+        ret = subprocess.run(['ethtool', '--driver', 'dropin-test'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+        print(ret.stdout.rstrip().decode('utf-8'))
+        if ret.returncode == 0 and re.search('driver: dummy', ret.stdout.rstrip().decode('utf-8')) != None:
+            self.assertRegex(output, 'Driver: dummy')
+        else:
+            print('ethtool does not support driver field at least for dummy interfaces, skipping test for Driver field of networkctl.')
 
     def test_bridge(self):
         self.copy_unit_to_networkd_unit_path('25-bridge.netdev')