Make it possible to use another directory to store test
results. With this, user can choose either to:

1) Pass a flag --result_dir to autotest specifying results
2) Set it in global_config.ini
3) Do neither and autotest behaves as usual

CC: Jes Sorensen <[email protected]>
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>

---
 client/bin/autotest |    4 ++++
 client/bin/job.py   |   19 +++++++++++++++----
 global_config.ini   |    3 +++
 3 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/client/bin/autotest b/client/bin/autotest
index 808c3f0..e294142 100755
--- a/client/bin/autotest
+++ b/client/bin/autotest
@@ -56,6 +56,10 @@ parser.add_option('--hostname', dest='hostname', 
type='string',
                   help='Take this as the hostname of this machine '
                        '(given by autoserv)')
 
+parser.add_option('--result_dir', dest='result_dir',
+                  type='string', default="", action='store',
+                  help='Specify an alternate path to store test result logs')
+
 parser.add_option('--client_test_setup', dest='client_test_setup',
                   type='string', default=None, action='store',
                   help='a comma seperated list of client tests to prebuild on '
diff --git a/client/bin/job.py b/client/bin/job.py
index 1abdbcd..0144258 100644
--- a/client/bin/job.py
+++ b/client/bin/job.py
@@ -19,6 +19,7 @@ from autotest_lib.client.common_lib import base_packages, 
packages
 from autotest_lib.client.common_lib import global_config
 from autotest_lib.client.tools import html_report
 
+GLOBAL_CONFIG = global_config.global_config
 
 LAST_BOOT_TAG = object()
 JOB_PREAMBLE = """
@@ -146,7 +147,17 @@ class base_client_job(base_job.base_job):
         always <autodir>/results/<tag>, where tag is passed in on the command
         line as an option.
         """
-        return os.path.join(self.autodir, 'results', options.tag)
+        result_dir_config = GLOBAL_CONFIG.get_config_value('CLIENT',
+                                                           'result_dir',
+                                                           default="")
+        if options.result_dir:
+            basedir = options.result_dir
+        elif result_dir_config:
+            basedir = result_dir_config
+        else:
+            basedir = self.autodir
+
+        return os.path.join(basedir, 'results', options.tag)
 
 
     def _get_status_logger(self):
@@ -270,9 +281,9 @@ class base_client_job(base_job.base_job):
         Perform the drop caches initialization.
         """
         self.drop_caches_between_iterations = (
-                       global_config.global_config.get_config_value('CLIENT',
-                                            'drop_caches_between_iterations',
-                                            type=bool, default=True))
+                                    GLOBAL_CONFIG.get_config_value('CLIENT',
+                                    'drop_caches_between_iterations',
+                                    type=bool, default=True))
         self.drop_caches = drop_caches
         if self.drop_caches:
             utils.drop_caches()
diff --git a/global_config.ini b/global_config.ini
index 97c5d45..c740ad1 100644
--- a/global_config.ini
+++ b/global_config.ini
@@ -45,6 +45,9 @@ client_autodir_paths: /usr/local/autotest,/home/autotest
 [CLIENT]
 drop_caches: True
 drop_caches_between_iterations: True
+# Specify an alternate location to store the test results
+#result_dir: /var/log/autotest/
+result_dir:
 
 [SERVER]
 hostname: autotest
-- 
1.7.6

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

Reply via email to