t/run-fio-tests: catch modprobe exceptions
authorVincent Fu <vincentfu@gmail.com>
Sat, 25 Jul 2020 17:02:21 +0000 (13:02 -0400)
committerVincent Fu <vincentfu@gmail.com>
Sat, 25 Jul 2020 19:01:57 +0000 (15:01 -0400)
Catch exceptions that occur when running modprobe in case the build
environment has it disabled (e.g., AWS CodeBuild).

t/run-fio-tests.py

index c116bf5a913e1045ac797ff5028d5cbb7b637efc..7e4120f4d7d1df9a1b58dce26f0295c090c213bf 100755 (executable)
@@ -485,11 +485,14 @@ class Requirements(object):
 
             Requirements._root = (os.geteuid() == 0)
             if Requirements._zbd and Requirements._root:
-                subprocess.run(["modprobe", "null_blk"],
-                               stdout=subprocess.PIPE,
-                               stderr=subprocess.PIPE)
-                if os.path.exists("/sys/module/null_blk/parameters/zoned"):
-                    Requirements._zoned_nullb = True
+                try:
+                    subprocess.run(["modprobe", "null_blk"],
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE)
+                    if os.path.exists("/sys/module/null_blk/parameters/zoned"):
+                        Requirements._zoned_nullb = True
+                except Exception:
+                    pass
 
         if platform.system() == "Windows":
             utest_exe = "unittest.exe"