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. --- 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)
Apparently, the only thing that requires it is man-db (which I am explicitly excluding for space), but it's still needed to build the initrd.
Also, remove udisks. It just gets in the way. --- tests/anaconda_storage/framework/storage-test.ks | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tests/anaconda_storage/framework/storage-test.ks b/tests/anaconda_storage/framework/storage-test.ks index 8327869..991880c 100644 --- a/tests/anaconda_storage/framework/storage-test.ks +++ b/tests/anaconda_storage/framework/storage-test.ks @@ -11,6 +11,7 @@ services --disabled=acpid,atd,crond,irqbalance,lvm2-monitor,netfs,nfs,nfslock,pc @core @base anaconda +less pyparted pykickstart system-config-firewall-base @@ -34,6 +35,7 @@ system-config-firewall-base -report-*-bugzilla* -telnet -traceroute +-udisks -*xfce* -xfconf -xfwm4
This makes it easier for me to test just a single suite - simply change the runnable property to return False, then add one that returns True to the subclass you're experimenting with. --- tests/anaconda_storage/framework/__init__.py | 3 +++ .../anaconda_storage/framework/suites/__init__.py | 7 +++++++ 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/tests/anaconda_storage/framework/__init__.py b/tests/anaconda_storage/framework/__init__.py index e8be283..cff3e64 100644 --- a/tests/anaconda_storage/framework/__init__.py +++ b/tests/anaconda_storage/framework/__init__.py @@ -236,6 +236,9 @@ class StorageTestFramework(object): os.chdir(self.basedir)
obj = suite(self.basedir, self.diskimagesdir) + if not obj.runnable: + continue + logging.info("===== Running Test Suite %s =====" % obj.name) logging.info("----- Creating Disk Images -----") obj.setup() diff --git a/tests/anaconda_storage/framework/suites/__init__.py b/tests/anaconda_storage/framework/suites/__init__.py index 8779b38..9899a59 100644 --- a/tests/anaconda_storage/framework/suites/__init__.py +++ b/tests/anaconda_storage/framework/suites/__init__.py @@ -104,6 +104,13 @@ class BaseSuite(object):
open(self._runningReportDir + "/FAILED", "w").close()
+ @property + def runnable(self): + """If this method returns False, the suite will not be run by the test + framework. Test suites can override this method as needed. + """ + return True + def run(self, token, livecd, resultsdir): """Execute this test suite. This is done by iterating over all test case objects, writing out config files, and then running their
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)
autoqa-devel@lists.fedorahosted.org