This is an experiment, quite ad-hoc way of specifying depencies for this test suite. My intentions are to stir discussion around a unified way of providing dependency info, and of course, install them on demand.
Nevertheless, this change should not affect users of distros other than Fedora (which has a list of dependencies), and will let users of this distro run this test more smoothly. Signed-off-by: Cleber Rosa <cr...@redhat.com> --- client/tests/xfstests/xfstests.py | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/client/tests/xfstests/xfstests.py b/client/tests/xfstests/xfstests.py index 28a56d3..aa8b69f 100644 --- a/client/tests/xfstests/xfstests.py +++ b/client/tests/xfstests/xfstests.py @@ -1,5 +1,5 @@ import os, re, glob, logging -from autotest.client.shared import error +from autotest.client.shared import error, software_manager from autotest.client import test, utils, os_dep class xfstests(test.test): @@ -11,6 +11,10 @@ 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') @@ -50,7 +54,35 @@ class xfstests(test.test): 'assuming failure. Please check debug logs') - def setup(self, tarball = 'xfstests.tar.bz2'): + 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): + ''' + 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 @@ -66,7 +98,6 @@ class xfstests(test.test): os_dep.command('xfs_db') os_dep.command('xfs_bmap') os_dep.command('xfsdump') - self.job.require_gcc() tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) -- 1.7.11.2 _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest