From: pradeep <[email protected]>

Connectathon test is nfs testsuite which can run on
both BSD and System V based systems.

Changes from v2:
 * Cleaned up and simplified test code
 * Test now is called 'connectathon', following the proper
   testsuite name
 * tarball is called 'connectathon.tar.bz2', so it was
   cleaned up and recompressed using bz2
 * Test logs are now written to the results test dir
 * Used postprocess to raise on error

Signed-off-by: Pradeep K Surisetty <[email protected]>
Signed-off-by: Poornima Nayak <[email protected]>
---
 client/tests/connectathon/connectathon.py |   67 +++++++++++++++++++++++++++++
 client/tests/connectathon/control         |   31 +++++++++++++
 2 files changed, 98 insertions(+), 0 deletions(-)
 create mode 100644 client/tests/connectathon/connectathon.py
 create mode 100644 client/tests/connectathon/control

diff --git a/client/tests/connectathon/connectathon.py 
b/client/tests/connectathon/connectathon.py
new file mode 100644
index 0000000..a0ef86f
--- /dev/null
+++ b/client/tests/connectathon/connectathon.py
@@ -0,0 +1,67 @@
+import os, shutil, glob, logging
+from autotest_lib.client.bin import test, utils
+from autotest_lib.client.common_lib import error
+
+
+class connectathon(test.test):
+    """
+    Connectathon test is an nfs testsuite which can run on
+    both BSD and System V based systems. The tests.init file
+    has to be modified based on the OS in which this test is run.
+
+    The tar file in this dir has an init file which works for Linux
+    platform.
+
+    @see www.connectathon.org
+    @author Poornima.Nayak ([email protected])(original code)
+    """
+    version = 1
+    def initialize(self):
+        """
+        Sets the overall failure counter for the test.
+        """
+        self.nfail = 0
+
+
+    def setup(self, tarball='connectathon.tar.bz2'):
+        connectathon_tarball = utils.unmap_url(self.bindir, tarball,
+                                               self.tmpdir)
+        utils.extract_tarball_to_dir(connectathon_tarball, self.srcdir)
+
+        os.chdir(self.srcdir)
+        utils.system('make clean')
+        utils.system('make')
+
+
+    def run_once(self, testdir=None, args='', cthon_iterations=1):
+        """
+        Runs the test, with the appropriate control file.
+        """
+        os.chdir(self.srcdir)
+
+        if testdir is None:
+            testdir = self.tmpdir
+
+        self.results_path = os.path.join(self.resultsdir,
+                                         'raw_output_%s' % self.iteration)
+
+        try:
+            if not args:
+                # run basic test
+                args = "-b -t"
+
+            self.results = utils.system_output('./runtests -N %s %s %s' %
+                                              (cthon_iterations, args, 
testdir))
+            utils.open_write_close(self.results_path, self.results)
+
+        except error.CmdError, e:
+            self.nfail += 1
+            logging.error("Test failed: %s", e)
+
+
+    def postprocess(self):
+        """
+        Raises on failure.
+        """
+        if self.nfail != 0:
+            raise error.TestFail('Connectathon test suite failed.')
diff --git a/client/tests/connectathon/control 
b/client/tests/connectathon/control
new file mode 100644
index 0000000..92fa518
--- /dev/null
+++ b/client/tests/connectathon/control
@@ -0,0 +1,31 @@
+AUTHOR = "Poornima Nayak <[email protected]>"
+NAME = "connectathon"
+TEST_CATEGORY = "NFS FVT"
+TEST_CLASS = "General"
+TEST_TYPE = "client"
+TIME = 'MEDIUM'
+DOC = '''
+Test for testing nfs mounted paths.
+
+More information about connecthon can be found at
+http://www.connectathon.org/nfstests.html
+'''
+
+import datetime, os
+now = datetime.datetime.now()
+#iter_range = [10, 100, 1000, 10000]
+#tests = ['-b -t', '-g -t', '-g -f', '-s -t', '-s -f', '-l -f', '-l -t']
+iter_range = [1]
+tests = ['-s -t']
+tag_ver = 0
+for test in tests:
+    for j in iter_range:
+        # On this example, /mnt/test is an NFS mounted location previously set
+        dir = os.path.join('/mnt', 'test', now.strftime("%Y-%m-%d%H:%M"))
+        if not os.path.isdir(dir):
+            os.makedirs(dir)
+        job.run_test(url='connectathon', testdir=dir, args=test,
+                     cthon_iterations=j,
+                     tag=("itera-%s-test-%s" % (j, tag_ver)))
+        tag_ver = tag_ver + 1
+
-- 
1.7.6

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to