From: Mike Qiu <[email protected]>

Currently, cmdparser.py will setup a tmp dir for
site_tests in the dir where you run autotest, like
client/tests/sleeptest/tmp/site_tests. Let's move
the creation of site_tests to the general tmp area
(client/tmp/site_tests).

Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
Signed-off-by: Mike Qiu <[email protected]>
---
 client/autotest_local.py |  8 ++++----
 client/cmdparser.py      | 26 +++++++++++++-------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/client/autotest_local.py b/client/autotest_local.py
index 55633ae..c3d3315 100644
--- a/client/autotest_local.py
+++ b/client/autotest_local.py
@@ -10,10 +10,6 @@ except ImportError:
     autodir = os.path.dirname(autodirbin)
     sys.path.insert(0, autodirbin)
 
-from autotest.client import job
-from autotest.client.shared import global_config
-from autotest.client import cmdparser, optparser
-
 autodirtest = os.path.join(autodir, "tests")
 
 os.environ['AUTODIR'] = autodir
@@ -21,6 +17,10 @@ os.environ['AUTODIRBIN'] = autodirbin
 os.environ['AUTODIRTEST'] = autodirtest
 os.environ['PYTHONPATH'] = autodirbin
 
+from autotest.client import job
+from autotest.client.shared import global_config
+from autotest.client import cmdparser, optparser
+
 
 class AutotestLocalApp:
     '''
diff --git a/client/cmdparser.py b/client/cmdparser.py
index 674040d..84692ba 100644
--- a/client/cmdparser.py
+++ b/client/cmdparser.py
@@ -7,7 +7,7 @@ Autotest command parser
 import os, re, sys, logging
 from autotest.client import os_dep, utils
 from autotest.client.shared import global_config, logging_config, 
logging_manager
-from autotest.client.shared import base_packages, packages
+from autotest.client.shared import packages
 
 GLOBAL_CONFIG = global_config.global_config
 
@@ -16,12 +16,17 @@ GLOBALDIRTEST = GLOBAL_CONFIG.get_config_value('COMMON',
                                                'test_dir',
                                                 default="")
 
-tmpdir = os.path.abspath(os.path.join('.', 'tmp'))
+try:
+    autodir = os.path.abspath(os.environ['AUTODIR'])
+except KeyError:
+    autodir = GLOBAL_CONFIG.get_config_value('COMMON',
+                                             'autotest_top_path')
+tmpdir = os.path.join(autodir, 'tmp')
 
-FETCHDIRTEST = GLOBAL_CONFIG.get_config_value('COMMON',
-                                               'test_output_dir',
-                                                default=tmpdir)
-FETCHDIRTEST = os.path.join(FETCHDIRTEST, 'site_tests')
+output_dir = GLOBAL_CONFIG.get_config_value('COMMON',
+                                            'test_output_dir',
+                                             default=tmpdir)
+FETCHDIRTEST = os.path.join(output_dir, 'site_tests')
 
 if not os.path.isdir(FETCHDIRTEST):
     os.makedirs(FETCHDIRTEST)
@@ -106,15 +111,10 @@ class CommandParser(object):
             name = ""
 
         logging.info("Fetching file %s:%s", url, name)
-        autodir = os.path.abspath(os.environ['AUTODIR'])
-        tmpdir = os.path.join(autodir, 'tmp')
-        tests_out_dir = GLOBAL_CONFIG.get_config_value('COMMON',
-                                                       'test_output_dir',
-                                                       default=tmpdir)
-        pkg_dir = os.path.join(tests_out_dir, 'packages')
+        pkg_dir = os.path.join(output_dir, 'packages')
         install_dir = os.path.join(FETCHDIRTEST, name)
 
-        pkgmgr = packages.PackageManager(tests_out_dir,
+        pkgmgr = packages.PackageManager(output_dir,
             run_function_dargs={'timeout':3600})
         pkgmgr.install_pkg(name, 'test', pkg_dir, install_dir,
             repo_url=url)
-- 
1.7.11.4

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

Reply via email to