From a4e76fdb316d3f7901f24f36e077c6936bd679c2 Mon Sep 17 00:00:00 2001 From: Otto Sabart Date: Mon, 10 Oct 2016 10:46:19 +0200 Subject: vsperf: launch should not depend on current $PWD JIRA: VSPERF-392 Change-Id: I44866b7d3298617003b87b015eb08bf32c4014f7 Signed-off-by: Otto Sabart --- conf/03_traffic.conf | 2 +- conf/04_vnf.conf | 2 +- docs/userguide/testusage.rst | 3 +++ tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py | 3 ++- tools/pkt_gen/testcenter/testcenter-rfc2544-throughput.py | 3 ++- vsperf | 13 ++++++++----- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/conf/03_traffic.conf b/conf/03_traffic.conf index 04266923..98bce2c5 100644 --- a/conf/03_traffic.conf +++ b/conf/03_traffic.conf @@ -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" diff --git a/conf/04_vnf.conf b/conf/04_vnf.conf index e0c72b10..e3a4824b 100644 --- a/conf/04_vnf.conf +++ b/conf/04_vnf.conf @@ -15,7 +15,7 @@ # ############################ # VNF configuration # ############################ -VNF_DIR = 'vnfs/' +VNF_DIR = os.path.join(ROOT_DIR, 'vnfs/') VNF = 'QemuDpdkVhostUser' VNF_AFFINITIZATION_ON = True diff --git a/docs/userguide/testusage.rst b/docs/userguide/testusage.rst index 9648569f..788f84a2 100755 --- a/docs/userguide/testusage.rst +++ b/docs/userguide/testusage.rst @@ -147,6 +147,9 @@ IP addresses. l2fwd can be found in /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: diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py index 91f7e27f..538d8a8a 100644 --- a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py +++ b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py @@ -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", diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2544-throughput.py b/tools/pkt_gen/testcenter/testcenter-rfc2544-throughput.py index becf7877..239fd109 100644 --- a/tools/pkt_gen/testcenter/testcenter-rfc2544-throughput.py +++ b/tools/pkt_gen/testcenter/testcenter-rfc2544-throughput.py @@ -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 a12560da..5bfa2abe 100755 --- 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 -- cgit 1.2.3-korg