Add a new autotest_regression module, tailored to
perform some quick, basic checks against the autotest
tree. It leverages the new install_distro_packages
API to try installing the appropriate package in
some popular distros.

The plan is to expand this check routine, to include
things like basic automated assessment of the health
of the web and cli interfaces.

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 .../autotest_regression/autotest_regression.py     | 45 ++++++++++++++++++++++
 client/tests/autotest_regression/control           | 22 +++++++++++
 2 files changed, 67 insertions(+)
 create mode 100644 client/tests/autotest_regression/autotest_regression.py
 create mode 100644 client/tests/autotest_regression/control

diff --git a/client/tests/autotest_regression/autotest_regression.py 
b/client/tests/autotest_regression/autotest_regression.py
new file mode 100644
index 0000000..2388811
--- /dev/null
+++ b/client/tests/autotest_regression/autotest_regression.py
@@ -0,0 +1,45 @@
+import logging, os
+from autotest.client import test, utils
+from autotest.client.shared import git, error
+
+class autotest_regression(test.test):
+    version = 1
+    @error.context_aware
+    def run_once(self, uri='git://github.com/autotest/autotest.git',
+                 branch='next', commit=None, base_uri=None):
+        n_fail = []
+        error.context("Checking out autotest", logging.info)
+        a_repo = git.GitRepoHelper(uri, branch, commit,
+                                   destination_dir=self.srcdir,
+                                   base_uri=base_uri)
+        a_repo.execute()
+        top_commit = a_repo.get_top_commit()
+        encoded_version = "%s:%s:%s" % (uri, branch, top_commit)
+        self.write_test_keyval({"software_version_autotest": encoded_version})
+
+        error.context("Running unittest suite", logging.info)
+        unittest_path = os.path.join(self.srcdir, 'utils', 'unittest_suite.py')
+        try:
+            utils.system(unittest_path)
+        except error.CmdError, e:
+            n_fail.append('Unittest failed: %s' % e.result_obj.stderr)
+
+        error.context("Running full tree check", logging.info)
+        check_path = os.path.join(self.srcdir, 'utils', 'check_patch.py')
+        try:
+            utils.system("%s --full --yes" % check_path)
+        except error.CmdError, e:
+            n_fail.append('Full tree check shows errors: %s' %
+                          e.result_obj.stderr)
+
+        error.context("Running a sleeptest", logging.info)
+        alocal_path = os.path.join(self.srcdir, 'client', 'autotest-local')
+        try:
+            utils.system("%s run sleeptest" % alocal_path)
+        except error.CmdError, e:
+            n_fail.append('Sleeptest failed: %s' %
+                          e.result_obj.stderr)
+
+        if n_fail:
+            raise error.TestFail("Autotest regression failed: %s" %
+                                 " ".join(n_fail))
\ No newline at end of file
diff --git a/client/tests/autotest_regression/control 
b/client/tests/autotest_regression/control
new file mode 100644
index 0000000..7ba6756
--- /dev/null
+++ b/client/tests/autotest_regression/control
@@ -0,0 +1,22 @@
+AUTHOR = "Lucas Meneghel Rodrigues <[email protected]>"
+NAME = "autotest_regression"
+TIME = "MEDIUM"
+TEST_CLASS = "Autotest"
+TEST_CATEGORY = "Functional"
+TEST_TYPE = "client"
+PKGS = ['pylint']
+PKG_DEPS = {'Fedora': PKGS,
+            'Red Hat': PKGS,
+            'Debian': PKGS,
+            'Ubuntu': PKGS}
+DOC = """
+Runs a series of tests in the autotest source tree. The goal is to regularly
+test the general state of the autotest source tree, unittests, static checking
+and some amount of sanity functionality checking.
+"""
+from autotest.client.shared import software_manager
+software_manager.install_distro_packages(PKG_DEPS)
+# One can specify custom uris, branches and even commits
+# job.run_test(url='autotest_regression', 
uri='git://github.com/lmr/autotest.git',
+#              branch='master', 
commit='7ed113d3c8606092fe64a663baf03d8ca03c6459')
+job.run_test(url='autotest_regression')
-- 
1.7.11.2

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

Reply via email to