From: Cleber Rosa <[email protected]>

The only place that we can truly set up all deps before processing
the test itself.

Signed-off-by: Cleber Rosa <[email protected]>
---
 client/tests/xfstests/control     | 24 +++++++++++++++++++++++-
 client/tests/xfstests/xfstests.py | 32 +-------------------------------
 2 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/client/tests/xfstests/control b/client/tests/xfstests/control
index 9ab1f69..c01107f 100644
--- a/client/tests/xfstests/control
+++ b/client/tests/xfstests/control
@@ -4,6 +4,9 @@ NAME = 'xfs filesystem test suite'
 TEST_CLASS = 'kernel'
 TEST_CATEGORY = 'Functional'
 TEST_TYPE = 'client'
+PKG_DEPS = {'Fedora' : ['autoconf', 'libtool', 'gcc', 'xfsprogs', 'xfsdump',
+                        'xfsprogs-devel', 'xfsprogs-qa-devel', 'libuuid-devel',
+                        'libacl-devel', 'libattr-devel']}
 DOC = """
 xfstests in autotest
 --------------------
@@ -58,12 +61,31 @@ virtual partition depends on the following programs to be 
available:
      * kpartx
 Make sure you have them or a real spare device to test things.
 """
+from autotest.client import utils
+from autotest.client.shared import software_manager
+from autotest.client import partition
+
+# Install package dependencies if your distro is present in PKG_DEPS
+distro = utils.get_os_vendor()
+if PKG_DEPS.has_key(distro):
+    deps = self.SW_DEPS.get(distro, None)
+    real_deps = []
+    if deps is not None:
+        s = software_manager.SoftwareManager()
+        for d in deps:
+            if not s.check_installed(d):
+                reals_deps.append(d)
+    if reals_deps:
+        real_deps_text = ' '.join(real_deps)
+        logging.info('Installing xfstests dependency "%s"', real_deps_text)
+        s.install(real_deps_text)
+
+
 # Define the partitions you want to use.
 #
 # Here, by default we use the concept of virtual partition (a partition of 1GB
 # of size), to avoid setup by the user. However, you'll most likely use a real
 # block device for your tests.
-from autotest.client import partition
 file_img = os.path.join(job.tmpdir, 'xfstests.img')
 vp = partition.virtual_partition(file_img=file_img, file_size=1024*1024)
 device = vp.device
diff --git a/client/tests/xfstests/xfstests.py 
b/client/tests/xfstests/xfstests.py
index aa8b69f..fd155ae 100644
--- a/client/tests/xfstests/xfstests.py
+++ b/client/tests/xfstests/xfstests.py
@@ -11,11 +11,6 @@ class xfstests(test.test):
     NA_RE = re.compile(r'Passed all 0 tests')
     NA_DETAIL_RE = re.compile(r'(\d{3})\s*(\[not run\])\s*(.*)')
 
-    SW_DEPS = {'Fedora' : ['autoconf', 'libtool', 'gcc', 'xfsprogs', 'xfsdump',
-                           'xfsprogs-devel', 'xfsprogs-qa-devel',
-                           'libuuid-devel', 'libacl-devel',
-                           'libattr-devel']}
-
     def _get_available_tests(self):
         tests = glob.glob('???.out')
         tests += glob.glob('???.out.linux')
@@ -54,35 +49,10 @@ class xfstests(test.test):
                                   'assuming failure. Please check debug logs')
 
 
-    def _distro_has_deps_annotated(self):
-        '''
-        Checks if the current distro has a list of package dependencies
-        '''
-        distro = utils.get_os_vendor()
-        return self.SW_DEPS.has_key(distro)
-
-
-    def _install_software_deps(self):
-        '''
-        Install the software dependecies for the detected distro
-        '''
-        distro = utils.get_os_vendor()
-        deps = self.SW_DEPS.get(distro, None)
-        if deps is not None:
-            s = software_manager.SoftwareManager()
-            for d in deps:
-                if not s.check_installed(d):
-                    logging.info('Installing xfstests dependency "%s"', d)
-                    s.install(d)
-
-
-    def setup(self, tarball='xfstests.tar.bz2', use_package_manager=True):
+    def setup(self, tarball='xfstests.tar.bz2'):
         '''
         Sets up the environment necessary for running xfstests
         '''
-        if use_package_manager and self._distro_has_deps_annotated():
-            self._install_software_deps()
-
         #
         # Anticipate failures due to missing devel tools, libraries, headers
         # and xfs commands
-- 
1.7.11.2

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to