On Wed, 2011-01-26 at 13:47 -0500, Chris Lumens wrote:
This allows tailoring those arguments to each test run within a suite, instead of previously where every test had to accept the exact same set. This seems to be a more flexible way of accomplishing the same thing.
I haven't had time to run the suite through with the new changes, but I know you've been running this quite a bit over the last few days in preparation for FUDCon.
All of the changes appear beneath tests/anaconda_storage/* ... no objections from me ... ACK.
Thanks for the improvements, James
tests/anaconda_storage/framework/cases/__init__.py | 18 ++++++++++++++++++ .../framework/suites/Ext2OnPartition.py | 9 +++++---- .../framework/suites/Ext3OnPartition.py | 9 +++++---- .../framework/suites/Ext4OnPartition.py | 9 +++------ .../anaconda_storage/framework/suites/__init__.py | 14 ++------------ 5 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/tests/anaconda_storage/framework/cases/__init__.py b/tests/anaconda_storage/framework/cases/__init__.py index 6f128fa..5493f86 100644 --- a/tests/anaconda_storage/framework/cases/__init__.py +++ b/tests/anaconda_storage/framework/cases/__init__.py @@ -103,13 +103,31 @@ class Creator: directories needed to store disk images will also be created. Test cases should not normally need to supply this method.
Required arguments:
name -- The name of this test case. imagesdir -- The directory to use when creating disk images.
drives -- A list of paths to disk images that have previously been
created with qemu-img (or some other tool).
Arguments that may be passed via kwargs:
reqMemory -- The amount of memory the VM to run this test case
needs in MB, or 512 by default.
runnerClassAttrs -- A dict of attributes and values that will
be added to the RunnerClass that will be
executed by this test suite.
testClassAttrs -- The same as runnerClassAttrs, but for TestClass.
Most of the time, these two dicts will probably
need to be identical. """ self.drives = drives self.imagesdir = imagesdir self.name = name self.reqMemory = kwargs.get("reqMemory", 512)
self.runnerClassAttrs = kwargs.get("runnerClassAttrs", {})
self.testClassAttrs = kwargs.get("testClassAttrs", {}) self._proc = None
diff --git a/tests/anaconda_storage/framework/suites/Ext2OnPartition.py b/tests/anaconda_storage/framework/suites/Ext2OnPartition.py index 0620861..e788e6e 100644 --- a/tests/anaconda_storage/framework/suites/Ext2OnPartition.py +++ b/tests/anaconda_storage/framework/suites/Ext2OnPartition.py @@ -24,7 +24,8 @@ class Ext2OnPartitionTestSuite(Ext4OnPartition.Ext4OnPartitionTestSuite): """Test autopartitioning from a single blank drive.""" name = "ext2-on-partition"
- def __init__(self, *args, **kwargs):
Ext4OnPartition.Ext4OnPartitionTestSuite.__init__(self, *args, **kwargs)
self.runnerClassAttrs = {"fstype": "ext2"}
self.testClassAttrs = {"fstype": "ext2"}
- @property
- def tests(self):
return [Creator("FSOnPartition", self.tempdir, self.drives,
runnerClassAttrs={"fstype": "ext2"},
testClassAttrs={"fstype": "ext2"})]
diff --git a/tests/anaconda_storage/framework/suites/Ext3OnPartition.py b/tests/anaconda_storage/framework/suites/Ext3OnPartition.py index f751314..a5ea5f0 100644 --- a/tests/anaconda_storage/framework/suites/Ext3OnPartition.py +++ b/tests/anaconda_storage/framework/suites/Ext3OnPartition.py @@ -24,7 +24,8 @@ class Ext3OnPartitionTestSuite(Ext4OnPartition.Ext4OnPartitionTestSuite): """Test autopartitioning from a single blank drive.""" name = "ext3-on-partition"
- def __init__(self, *args, **kwargs):
Ext4OnPartition.Ext4OnPartitionTestSuite.__init__(self, *args, **kwargs)
self.runnerClassAttrs = {"fstype": "ext3"}
self.testClassAttrs = {"fstype": "ext3"}
- @property
- def tests(self):
return [Creator("FSOnPartition", self.tempdir, self.drives,
runnerClassAttrs={"fstype": "ext3"},
testClassAttrs={"fstype": "ext3"})]
diff --git a/tests/anaconda_storage/framework/suites/Ext4OnPartition.py b/tests/anaconda_storage/framework/suites/Ext4OnPartition.py index d93de31..8d79a9d 100644 --- a/tests/anaconda_storage/framework/suites/Ext4OnPartition.py +++ b/tests/anaconda_storage/framework/suites/Ext4OnPartition.py @@ -27,11 +27,6 @@ class Ext4OnPartitionTestSuite(BaseSuite): """Test autopartitioning from a single blank drive.""" name = "ext4-on-partition"
- def __init__(self, *args, **kwargs):
BaseSuite.__init__(self, *args, **kwargs)
self.runnerClassAttrs = {"fstype": "ext4"}
self.testClassAttrs = {"fstype": "ext4"}
- def setup(self): (fd, diskimage) = tempfile.mkstemp(dir=self.tempdir) os.close(fd)
@@ -41,4 +36,6 @@ class Ext4OnPartitionTestSuite(BaseSuite):
@property def tests(self):
return [Creator("FSOnPartition", self.tempdir, self.drives)]
return [Creator("FSOnPartition", self.tempdir, self.drives,
runnerClassAttrs={"fstype": "ext4"},
testClassAttrs={"fstype": "ext4"})]
diff --git a/tests/anaconda_storage/framework/suites/__init__.py b/tests/anaconda_storage/framework/suites/__init__.py index 382d478..8779b38 100644 --- a/tests/anaconda_storage/framework/suites/__init__.py +++ b/tests/anaconda_storage/framework/suites/__init__.py @@ -71,21 +71,11 @@ class BaseSuite(object): create these images and populate this list. It is not necessary for test cases to use every single drive in this list.
runnerClassAttrs -- A dict of attributes and values that should
be added to each RunnerClass that will be
executed by this test suite.
testClassAttrs -- The same as runnerClassAttrs, but for TestClass.
Most of the time, these two dicts will probably
need to be identical. """ self.basedir = basedir self.diskimagesdir = diskimagesdir self.drives = []
self.runnerClassAttrs = {}
self.testClassAttrs = {}
self._runningReportDir = None self._runningTest = None self._tempdir = None
@@ -146,9 +136,9 @@ class BaseSuite(object): fo.write(fmt.format(s, module=obj.name.replace("TestSuite", ""), reportDir=reportSubdir, runnerClass=obj.name + "Runner",
runnerClassAttrs=pickle.dumps(self.runnerClassAttrs),
runnerClassAttrs=pickle.dumps(obj.runnerClassAttrs), testClass=obj.name + "TestCase",
testClassAttrs=pickle.dumps(self.testClassAttrs),
testClassAttrs=pickle.dumps(obj.testClassAttrs), token=token)) fo.close() os.chmod(driverOut, 0755)