[PATCH] Find storage test cases automatically.
Chris Lumens
clumens at redhat.com
Thu Nov 20 16:30:43 UTC 2014
---
tests/storage/run_storage_tests.py | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/tests/storage/run_storage_tests.py b/tests/storage/run_storage_tests.py
index 8a52730..370a40e 100755
--- a/tests/storage/run_storage_tests.py
+++ b/tests/storage/run_storage_tests.py
@@ -2,23 +2,26 @@
import os, sys
+from pyanaconda.ui.common import collect
+
if os.geteuid() != 0:
sys.stderr.write("You must be root to run the storage tests; skipping.\n")
# This return code tells the automake test driver that this test was skipped.
os._exit(77)
-from cases.bz1014545 import BZ1014545_TestCase
-from cases.bz1067707 import BZ1067707_TestCase
-from cases.reuse import PartitionReuse_TestCase, LVMReuse_TestCase, BTRFSReuse_TestCase, ThinpReuse_TestCase
+if "top_srcdir" not in os.environ:
+ sys.stderr.write("$top_srcdir must be defined in the test environment\n")
+ # This return code tells the automake test driver that the test setup failed
+ sys.exit(99)
failures = 0
-for tc in [PartitionReuse_TestCase(),
- LVMReuse_TestCase(),
- BTRFSReuse_TestCase(),
- ThinpReuse_TestCase(),
- BZ1014545_TestCase(),
- BZ1067707_TestCase()]:
- failures += tc.run()
+classes = collect("cases.%s",
+ os.path.abspath(os.path.join(os.environ["top_srcdir"], "tests/storage/cases/")),
+ lambda obj: getattr(obj, "desc", None) is not None)
+
+for tc in classes:
+ obj = tc()
+ failures += obj.run()
os._exit(failures)
--
1.9.3
More information about the anaconda-patches
mailing list