[dts] [PATCH] framework: change default running directory to parent directory

Yong Liu yong.liu at intel.com
Mon Feb 9 10:15:56 CET 2015


---
 framework/config.py   |  4 ++--
 framework/dts.py      | 13 ++++++++++---
 framework/main.py     | 14 +++++++-------
 framework/rst.py      |  4 ++--
 framework/settings.py |  8 ++++++++
 5 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/framework/config.py b/framework/config.py
index af014a8..d2548e8 100755
--- a/framework/config.py
+++ b/framework/config.py
@@ -37,8 +37,8 @@ import re
 import ConfigParser  # config parse module
 import argparse      # prase arguments module
 
-portconf = "../conf/ports.cfg"
-crbconf = "../conf/crbs.cfg"
+portconf = "conf/ports.cfg"
+crbconf = "conf/crbs.cfg"
 
 
 class UserConf():
diff --git a/framework/dts.py b/framework/dts.py
index 9ba23fe..bddbe33 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -42,7 +42,7 @@ import rst          # rst file support
 from crbs import crbs
 from tester import Tester
 from dut import Dut
-from settings import NICS, DRIVERS
+from settings import FOLDERS, NICS, DRIVERS
 from serializer import Serializer
 from exception import VerifyFailure
 from test_case import TestCase
@@ -128,7 +128,7 @@ def close_crb_sessions():
         dut.close()
     if tester is not None:
         tester.close()
-    log_handler.info("DTF ended")
+    log_handler.info("DTS ended")
 
 
 def get_nic_driver(pci_id):
@@ -401,10 +401,18 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
     global stats
     global log_handler
 
+    # change operation directory
+    os.chdir("../")
+
     # prepare the output folder
     if not os.path.exists(output_dir):
         os.mkdir(output_dir)
 
+    # add python module search path
+    for folder in FOLDERS.values():
+        sys.path.append(folder)
+    sys.path.append(suite_dir)
+
     # init log_handler handler
     if verbose is True:
         logger.set_verbose()
@@ -423,7 +431,6 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
     # register exit action
     atexit.register(close_crb_sessions)
 
-    sys.path.append(suite_dir)
     os.environ["TERM"] = "dumb"
 
     serializer = Serializer()
diff --git a/framework/main.py b/framework/main.py
index 21815dd..d38aa8a 100755
--- a/framework/main.py
+++ b/framework/main.py
@@ -47,9 +47,9 @@ def git_build_package(gitLabel, gitPkg, output):
     gitURL = r"http://dpdk.org/git/dpdk"
     gitPrefix = r"dpdk/"
     print "git clone %s %s/%s" % (gitURL, output, gitPrefix)
-    os.system("git clone %s ../output/%s" % (gitURL, gitPrefix))
-    print "git archive --format=tar.gz --prefix=%s %s -o ../%s" % (gitPrefix, gitLabel, gitPkg)
-    os.system("cd ../output/%s && git archive --format=tar.gz --prefix=%s %s -o ../%s" % (gitPrefix, gitPrefix, gitLabel, gitPkg))
+    os.system("git clone %s output/%s" % (gitURL, gitPrefix))
+    print "git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix, gitLabel, gitPkg)
+    os.system("cd output/%s && git archive --format=tar.gz --prefix=%s %s -o %s" % (gitPrefix, gitPrefix, gitLabel, gitPkg))
 
 #
 # Main program begins here
@@ -60,7 +60,7 @@ def git_build_package(gitLabel, gitPkg, output):
 parser = argparse.ArgumentParser(description='DPDK test framework.')
 
 parser.add_argument('--config-file',
-                    default='../execution.cfg',
+                    default='execution.cfg',
                     help='configuration file that describes the test ' +
                     'cases, DUTs and targets')
 
@@ -72,11 +72,11 @@ parser.add_argument('--patch',
                     help='apply a patch to the package under test')
 
 parser.add_argument('--snapshot',
-                    default='../dpdk.tar.gz',
+                    default='dpdk.tar.gz',
                     help='snapshot .tgz file to use as input')
 
 parser.add_argument('--output',
-                    default='../output',
+                    default='output',
                     help='Output directory where dts log and result saved')
 
 parser.add_argument('-s', '--skip-setup',
@@ -95,7 +95,7 @@ parser.add_argument('-p', '--project',
                     help='specify that which project will be tested')
 
 parser.add_argument('--suite-dir',
-                    default='../tests',
+                    default='tests',
                     help='Test suite directory where test suites will be imported')
 
 parser.add_argument('-t', '--test-cases',
diff --git a/framework/rst.py b/framework/rst.py
index 8c2d6c5..9b8eb69 100644
--- a/framework/rst.py
+++ b/framework/rst.py
@@ -52,8 +52,8 @@ Result:
     Result: PASS
 """
 
-path2Plan = '../test_plans'
-path2Result = '../output'
+path2Plan = 'test_plans'
+path2Result = 'output'
 rstName = ""
 rstAnnexName = ""
 
diff --git a/framework/settings.py b/framework/settings.py
index 40b81fb..e4ca5dd 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -28,6 +28,14 @@
 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""
+Folders for framework running enviornment.
+"""
+FOLDERS = {
+    'Framework'     : 'framework',
+    'Testscripts'   : 'tests',
+    'Configuration' : 'conf',
+}
 
 """
 Nics and its identifiers supported by the framework.
-- 
1.9.3



More information about the dts mailing list