From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C630FA034C; Tue, 11 Jan 2022 16:59:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C17F542732; Tue, 11 Jan 2022 16:59:43 +0100 (CET) Received: from mail-pj1-f97.google.com (mail-pj1-f97.google.com [209.85.216.97]) by mails.dpdk.org (Postfix) with ESMTP id CEA9D41143 for ; Tue, 11 Jan 2022 16:59:42 +0100 (CET) Received: by mail-pj1-f97.google.com with SMTP id b1-20020a17090a990100b001b14bd47532so6720591pjp.0 for ; Tue, 11 Jan 2022 07:59:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fGRPRTCEQA7WZ4h19CERZ1GTnapUWYANYr5/5Zm6FsE=; b=MvR+r94aoh1Kh76bhLmR+MYzinnguQsfpsuuPbfsOpyKE6hT5FnYaaj0JVvvhi/KGu FNaItLqrPBW/tki+wf5z1cME/LWeKQ6uDfQPy6It2ohQA6O8gi6xAJPa+ojXE81NCB/w /pQ2H+Xh1uq8LtdUOrSLbDJJbQGGoa0bMWnpg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fGRPRTCEQA7WZ4h19CERZ1GTnapUWYANYr5/5Zm6FsE=; b=KbhtcqXmobg8VQ0f1e2+p6+MqEikCqviFcc5V03/NqpOpQBfoop/kYZUg164DJRodd sV8WHj18wGr4aJ8pDPLJKZts9T9o7n9S2zTScg41wSMLAB1ZgeBhEnH9lVmCSCZ0RGo8 JdF1M1vlVEijF3pZmu6B8qeCZ8Bxo2dltNVhiQPL+Moz8Fz1Y+Fyfd4aJ+c6iwPV0MKW nMV+MbDM9l+TakLJxrxD97+oJypEdjafzHmY34xjZDBPuh87QhLcbDXvxfengipiyuU8 P3Q+k9Us+I+qIVUo4na50hpPVmLqPkjiYvHD5AFYk669KYo+L6plu80z7vYJbys4+w2o ybnQ== X-Gm-Message-State: AOAM531mwF5G6Mu4cpHHsrzyayBkOs+sHduV5mRy27/YGxtFr81RdsEE akwTGu3ux4+ajLnpFRtne9VszRjEHrYqq3Ngd6gO8PxG/NTlsG4tshk34yFpg/mDIsx6dAaljKk qpsHkrGpLs9zkI+aMD+4Ikikmhq2GDRddVH4NnRdT2LePq+3dHCmZLFR7s4lgzt+xirKo+Yxfon +lK9dHFoDQ1i3CAw== X-Google-Smtp-Source: ABdhPJxua54Ye85kddjb8Utr1u0PhH4b06Npqu9/VVxUGZ8GL4iXBNInsxXQrhnW6B7u1z574EXB+TJFFDsm X-Received: by 2002:a63:3e0c:: with SMTP id l12mr4568965pga.454.1641916781921; Tue, 11 Jan 2022 07:59:41 -0800 (PST) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id lk4sm702095pjb.14.2022.01.11.07.59.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jan 2022 07:59:41 -0800 (PST) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::105d]) by postal.iol.unh.edu (Postfix) with ESMTP id 1B1BC6052500; Tue, 11 Jan 2022 10:59:41 -0500 (EST) From: ohilyard@iol.unh.edu To: dts@dpdk.org Cc: lijuan.tu@intel.com, Owen Hilyard Subject: [PATCH] Fix hardcoded config folders Date: Tue, 11 Jan 2022 10:59:37 -0500 Message-Id: <20220111155937.36524-1-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org From: Owen Hilyard All hardcoded instances of "DTS_ROOT/conf" or "./conf" have been replaced with CONFIG_ROOT_PATH, which is either the environment variable DTS_CFG_FOLDER if it is set, or is DTS_ROOT/conf/ by default. Signed-off-by: Owen Hilyard --- framework/checkCase.py | 10 ++++------ framework/project_dpdk.py | 4 ++-- tests/TestSuite_iavf_package_driver_error_handle.py | 3 ++- tests/TestSuite_ipsec_gw_cryptodev_func.py | 4 +++- tests/TestSuite_vhost_user_live_migration.py | 5 +++-- tests/vhost_peer_conf.py | 4 +++- tools/setup.py | 10 ++++++---- 7 files changed, 23 insertions(+), 17 deletions(-) diff --git a/framework/checkCase.py b/framework/checkCase.py index 3182dc77..013b9551 100644 --- a/framework/checkCase.py +++ b/framework/checkCase.py @@ -1,14 +1,12 @@ import collections import json +import os -import xlrd - -from .settings import HOST_DRIVER_SETTING, get_nic_name, load_global_setting +from .settings import HOST_DRIVER_SETTING, get_nic_name, load_global_setting, CONFIG_ROOT_PATH from .utils import RED -filter_json_file = './conf/test_case_checklist.json' -support_json_file = './conf/test_case_supportlist.json' - +filter_json_file = os.path.join(CONFIG_ROOT_PATH, 'test_case_checklist.json') +support_json_file = os.path.join(CONFIG_ROOT_PATH, 'test_case_supportlist.json') class CheckCase(object): """ diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py index 9927bcc1..05462b6d 100644 --- a/framework/project_dpdk.py +++ b/framework/project_dpdk.py @@ -46,7 +46,7 @@ from .settings import ( NICS, accepted_nic, load_global_setting, - save_global_setting, + save_global_setting, CONFIG_ROOT_PATH, ) from .ssh_connection import SSHConnection from .tester import Tester @@ -571,7 +571,7 @@ class DPDKdut(Dut): folder_info = folder.split('/') name = folder_info[-1] if name != 'examples' and name not in self.apps_name: - raise Exception('Please config %s file path on conf/app_name.cfg' % name) + raise Exception(f'Please config {name} file path on {os.path.join(CONFIG_ROOT_PATH, "app_name.cfg")}') if name == 'examples': example = 'all' diff --git a/tests/TestSuite_iavf_package_driver_error_handle.py b/tests/TestSuite_iavf_package_driver_error_handle.py index 0cdba385..c4277fc7 100644 --- a/tests/TestSuite_iavf_package_driver_error_handle.py +++ b/tests/TestSuite_iavf_package_driver_error_handle.py @@ -35,6 +35,7 @@ import time from framework.config import UserConf from framework.pmd_output import PmdOutput +from framework.settings import CONFIG_ROOT_PATH from framework.test_case import TestCase @@ -47,7 +48,7 @@ class Testiavf_package_and_driver_check(TestCase): self.verify(len(self.dut_ports) >= 1, "Insufficient ports") self.PF_QUEUE = 16 - conf_file = 'conf/iavf_driver_package.cfg' + conf_file = os.path.join(CONFIG_ROOT_PATH, 'iavf_driver_package.cfg') conf_peer = UserConf(conf_file) conf_session = conf_peer.conf._sections['suite'] self.driverPath_latest = conf_session['ice_driver_file_location_latest'] diff --git a/tests/TestSuite_ipsec_gw_cryptodev_func.py b/tests/TestSuite_ipsec_gw_cryptodev_func.py index a5d6e775..57ca79d9 100644 --- a/tests/TestSuite_ipsec_gw_cryptodev_func.py +++ b/tests/TestSuite_ipsec_gw_cryptodev_func.py @@ -30,11 +30,13 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import binascii +import os.path import time import framework.packet as packet import framework.utils as utils import tests.cryptodev_common as cc +from framework.settings import CONFIG_ROOT_PATH from framework.test_case import TestCase @@ -87,7 +89,7 @@ class TestIPsecGW(TestCase): "u": "0x1" } - conf_file = r'conf/ipsec_ep0.cfg' + conf_file = os.path.join(CONFIG_ROOT_PATH, 'ipsec_ep0.cfg') self.dut.session.copy_file_to(conf_file, '/tmp') def set_up(self): diff --git a/tests/TestSuite_vhost_user_live_migration.py b/tests/TestSuite_vhost_user_live_migration.py index e50800d5..8796f16a 100644 --- a/tests/TestSuite_vhost_user_live_migration.py +++ b/tests/TestSuite_vhost_user_live_migration.py @@ -28,13 +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. - +import os.path import re import time import framework.utils as utils from framework.config import UserConf from framework.exception import VirtDutInitException +from framework.settings import CONFIG_ROOT_PATH from framework.test_case import TestCase from framework.virt_common import VM @@ -54,7 +55,7 @@ class TestVhostUserLiveMigration(TestCase): "Insufficient ports for testing") # get mount info from cfg file - conf_info = UserConf('conf/%s.cfg' % self.suite_name) + conf_info = UserConf(os.path.join(CONFIG_ROOT_PATH, f'{self.suite_name}.cfg')) conf_session = conf_info.conf._sections['mount_info'] self.mount_path = conf_session['backup_mount_path'] self.share_path = conf_session['host_share_dir'] diff --git a/tests/vhost_peer_conf.py b/tests/vhost_peer_conf.py index c8802277..4dc47341 100644 --- a/tests/vhost_peer_conf.py +++ b/tests/vhost_peer_conf.py @@ -28,10 +28,12 @@ # 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. +import os from framework.config import UserConf +from framework.settings import CONFIG_ROOT_PATH -conf_file = 'conf/vhost_peer_conf.cfg' +conf_file = os.path.join(CONFIG_ROOT_PATH, 'vhost_peer_conf.cfg') conf_peer = UserConf(conf_file) conf_session = conf_peer.conf._sections['peerconf'] diff --git a/tools/setup.py b/tools/setup.py index c70730c7..f4cc5d74 100755 --- a/tools/setup.py +++ b/tools/setup.py @@ -20,10 +20,12 @@ DTS_TOOLS = DTS_PATH + '/tools' DTS_SUITES = DTS_PATH + '/tests' DTS_EXECS = DTS_PATH + '/executions' -DTS_EXEC_CFG = DTS_PATH + '/execution.cfg' -DTS_CRBS_CFG = DTS_PATH + '/conf/crbs.cfg' -DTS_PORTS_CFG = DTS_PATH + '/conf/ports.cfg' -DTS_IXIA_CFG = DTS_PATH + '/conf/ixia.cfg' +CONFIG_ROOT_PATH = os.environ.get("DTS_CFG_FOLDER") or os.path.join(DTS_PATH, "conf/") + +DTS_EXEC_CFG = os.path.join(DTS_PATH, 'execution.cfg') +DTS_CRBS_CFG = os.path.join(CONFIG_ROOT_PATH, 'crbs.cfg') +DTS_PORTS_CFG = os.path.join(CONFIG_ROOT_PATH, 'ports.cfg') +DTS_IXIA_CFG = os.path.join(CONFIG_ROOT_PATH, 'ixia.cfg') sys.path.append(DTS_FRAMEWORK) sys.path.append(DTS_TOOLS) -- 2.30.2