bugfix: Support paths with user's home shortcut 61/4361/3
authorMartin Klozik <martinx.klozik@intel.com>
Wed, 9 Dec 2015 14:32:06 +0000 (14:32 +0000)
committerMaryam Tahhan <maryam.tahhan@intel.com>
Mon, 14 Dec 2015 14:44:39 +0000 (14:44 +0000)
VSPERF will explicitly expand any '~' to the absolute path to the user's
home directory before call of subsystem.Popen method. Only calls,
which process configuration values are modified.

Change-Id: Ibd9399ae84bf4698c86bf8eff97ca6ce785fb3fb
JIRA: VSPERF-45
Signed-off-by: Martin Klozik <martinx.klozik@intel.com>
Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com>
Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Reviewed-by: Al Morton <acmorton@att.com>
src/dpdk/dpdk.py
tools/pkt_gen/testcenter/testcenter.py
tools/tasks.py

index 85d0001..3f5333a 100644 (file)
@@ -296,7 +296,7 @@ def _unbind_nics_get_driver():
        after unbinding them from DPDK.
     """
     _driver_list = []
-    _output = subprocess.check_output([RTE_PCI_TOOL, '--status'])
+    _output = subprocess.check_output([os.path.expanduser(RTE_PCI_TOOL), '--status'])
     _my_encoding = locale.getdefaultlocale()[1]
     for line in _output.decode(_my_encoding).split('\n'):
         for nic in settings.getValue('WHITELIST_NICS'):
index 4ba5bc8..f670612 100644 (file)
@@ -127,7 +127,7 @@ class TestCenter(trafficgen.ITrafficGenerator):
             verbose = True
             print("Arguments used to call test: %s" % args)
 
-        subprocess.check_call(args)
+        subprocess.check_call(map(os.path.expanduser, args))
 
         file = os.path.join(settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
                             settings.getValue("TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX") + ".csv")
index 33a5931..09dd88d 100644 (file)
@@ -75,8 +75,9 @@ def run_task(cmd, logger, msg=None, check_error=False):
     logger.debug('%s%s', CMD_PREFIX, ' '.join(cmd))
 
     try:
-        proc = subprocess.Popen(
-            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0)
+        proc = subprocess.Popen(map(os.path.expanduser, cmd),
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE, bufsize=0)
 
         while True:
             reads = [proc.stdout.fileno(), proc.stderr.fileno()]
@@ -121,7 +122,7 @@ def run_background_task(cmd, logger, msg):
     logger.info(msg)
     logger.debug('%s%s', CMD_PREFIX, ' '.join(cmd))
 
-    proc = subprocess.Popen(cmd, stdout=_get_stdout(), bufsize=0)
+    proc = subprocess.Popen(map(os.path.expanduser, cmd), stdout=_get_stdout(), bufsize=0)
 
     return proc.pid