vsperf: launch should not depend on current $PWD 33/21033/6
authorOtto Sabart <osabart@redhat.com>
Mon, 10 Oct 2016 08:46:19 +0000 (10:46 +0200)
committerOtto Sabart <seberm@seberm.com>
Tue, 11 Oct 2016 12:33:14 +0000 (12:33 +0000)
JIRA: VSPERF-392

Change-Id: I44866b7d3298617003b87b015eb08bf32c4014f7
Signed-off-by: Otto Sabart <osabart@redhat.com>
conf/03_traffic.conf
conf/04_vnf.conf
docs/userguide/testusage.rst
tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py
tools/pkt_gen/testcenter/testcenter-rfc2544-throughput.py
vsperf

index 0426692..98bce2c 100644 (file)
@@ -109,7 +109,7 @@ TRAFFICGEN_STC_WEST_PORT_NUM = ""
 TRAFFICGEN_STC_TEST_SESSION_NAME = "RFC2544 Tput"
 # The directory to copy results to
 
-TRAFFICGEN_STC_RESULTS_DIR = "./Results"
+TRAFFICGEN_STC_RESULTS_DIR = os.path.join(ROOT_DIR, "Results")
 #  The prefix for the CSV results file
 
 TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX = "RFC2544_tput"
index e0c72b1..e3a4824 100644 (file)
@@ -15,7 +15,7 @@
 # ############################
 # VNF configuration
 # ############################
-VNF_DIR = 'vnfs/'
+VNF_DIR = os.path.join(ROOT_DIR, 'vnfs/')
 VNF = 'QemuDpdkVhostUser'
 VNF_AFFINITIZATION_ON = True
 
index 9648569..788f84a 100755 (executable)
@@ -147,6 +147,9 @@ IP addresses. l2fwd can be found in <vswitchperf_dir>/src/l2fwd
 Executing tests
 ^^^^^^^^^^^^^^^
 
+All examples inside these docs assume, that user is inside the VSPERF
+directory. VSPERF can be executed from any directory.
+
 Before running any tests make sure you have root permissions by adding
 the following line to /etc/sudoers:
 
index 91f7e27..538d8a8 100644 (file)
@@ -22,6 +22,7 @@ TestCenter REST APIs. This test supports Python 3.4
 import argparse
 import logging
 import os
+from conf import settings
 
 
 logger = logging.getLogger(__name__)
@@ -141,7 +142,7 @@ def main():
                                 dest="test_user_name")
     optional_named.add_argument("--results_dir",
                                 required=False,
-                                default="./Results",
+                                default=settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
                                 help="The directory to copy results to",
                                 dest="results_dir")
     optional_named.add_argument("--csv_results_file_prefix",
index becf787..239fd10 100644 (file)
@@ -22,6 +22,7 @@ TestCenter command sequencer. This test supports Python 2.7.
 from __future__ import print_function
 import argparse
 import os
+from conf import settings
 
 
 def create_dir(path):
@@ -129,7 +130,7 @@ def main():
                                dest="test_session_name")
     optionalnamed.add_argument("--results_dir",
                                required=False,
-                               default="./Results",
+                               default=settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
                                help="The directory to copy results to",
                                dest="results_dir")
     optionalnamed.add_argument("--csv_results_file_prefix",
diff --git a/vsperf b/vsperf
index a12560d..5bfa2ab 100755 (executable)
--- a/vsperf
+++ b/vsperf
@@ -54,12 +54,15 @@ VERBOSITY_LEVELS = {
     'critical': logging.CRITICAL
 }
 
-_TEMPLATE_RST = {'head'  : 'tools/report/report_head.rst',
-                 'foot'  : 'tools/report/report_foot.rst',
+_CURR_DIR = os.path.dirname(os.path.realpath(__file__))
+
+_TEMPLATE_RST = {'head'  : os.path.join(_CURR_DIR, 'tools/report/report_head.rst'),
+                 'foot'  : os.path.join(_CURR_DIR, 'tools/report/report_foot.rst'),
                  'final' : 'test_report.rst',
-                 'tmp'   : 'tools/report/report_tmp_caption.rst'
+                 'tmp'   : os.path.join(_CURR_DIR, 'tools/report/report_tmp_caption.rst')
                 }
 
+
 _LOGGER = logging.getLogger()
 
 def parse_arguments():
@@ -482,11 +485,11 @@ def main():
 
     # configure settings
 
-    settings.load_from_dir('conf')
+    settings.load_from_dir(os.path.join(_CURR_DIR, 'conf'))
 
     # Load non performance/integration tests
     if args['integration']:
-        settings.load_from_dir('conf/integration')
+        settings.load_from_dir(os.path.join(_CURR_DIR, 'conf/integration'))
 
     # load command line parameters first in case there are settings files
     # to be used