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 23A24A00C3; Mon, 17 Jan 2022 13:11:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 185BE411C3; Mon, 17 Jan 2022 13:11:41 +0100 (CET) Received: from mailgw01.pantheon.sk (mailgw01.pantheon.sk [46.229.239.26]) by mails.dpdk.org (Postfix) with ESMTP id 0C39C40141 for ; Mon, 17 Jan 2022 13:11:40 +0100 (CET) Received: from mailgw01.pantheon.sk (localhost.localdomain [127.0.0.1]) by mailgw01.pantheon.sk (Proxmox) with ESMTP id A92BA201766; Mon, 17 Jan 2022 13:11:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; h=cc:cc:content-transfer-encoding:content-type:content-type :date:from:from:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=dkim; bh=9CFD6+moq3jZgWO7z+FW 5WTeCcstLu4QZTBiMkgMAcA=; b=rNeWxVDWUgZ+TWc/C4gIeVezsceMQ3FP3mo3 e9WtBVlrGokm8Oirdz5p8NFPR4mNuY7CkJvYemrB1FvPAXkkhyeAuhxhy9Ij4Ui5 hq039iyRLi2+wDTx4+Z4Qv0R4jrGXe+CSxvt1+1P6q4Y00w80t/A+HpHCOJ3Fo1+ zYkV6GpFOS2nA3k+Uibxide19VrqIGOQOpqD6iY53RBhR5ZjTR/EIIGmz8Oindvy EIOMfKUXRelyjL3/kDyZ/EzNQ0C9ggGW0mwS+l5KX1U7Whq859d/vWh8rhLMm4J4 HX8Jk7a2wXZCsdry+qWCqfEDhBZR+4/1c6/2GcYyXM5GR89Yvg== From: =?iso-8859-2?Q?Juraj_Linke=B9?= To: "ohilyard@iol.unh.edu" , "dts@dpdk.org" CC: "lijuan.tu@intel.com" Subject: RE: [PATCH] Fix hardcoded config folders Thread-Topic: [PATCH] Fix hardcoded config folders Thread-Index: AQHYBwRB54rDkecxO0yq8maq5FiGb6xnFY0Q Date: Mon, 17 Jan 2022 12:11:38 +0000 Message-ID: References: <20220111155937.36524-1-ohilyard@iol.unh.edu> In-Reply-To: <20220111155937.36524-1-ohilyard@iol.unh.edu> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.101.4.10] Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 > -----Original Message----- > From: ohilyard@iol.unh.edu > Sent: Tuesday, January 11, 2022 5:00 PM > To: dts@dpdk.org > Cc: lijuan.tu@intel.com; Owen Hilyard > Subject: [PATCH] Fix hardcoded config folders >=20 > From: Owen Hilyard >=20 > 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. >=20 > 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(-) >=20 I had a quick glance at this and it seems to me that we should change the F= OLDERS settings variable as well. Maybe in another patch, since it contains= more than just the conf path? Should DTS_CONFIG_PATHS in ci/get_tests_for_patchset.py also use CONFIG_ROO= T_PATH? Do we want to address comments as well? E.g. the docstring of load_global_c= onfig in dts/virt_base.py. The same question goes for docs, there are a few instances of conf/.cfg. > 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 >=20 > -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 >=20 > -filter_json_file =3D './conf/test_case_checklist.json' > -support_json_file =3D './conf/test_case_supportlist.json' > - > +filter_json_file =3D os.path.join(CONFIG_ROOT_PATH, > +'test_case_checklist.json') support_json_file =3D > +os.path.join(CONFIG_ROOT_PATH, 'test_case_supportlist.json') >=20 > 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 =3D folder.split('/') > name =3D folder_info[-1] > if name !=3D '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")}') >=20 > if name =3D=3D 'examples': > example =3D '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 >=20 > from framework.config import UserConf > from framework.pmd_output import PmdOutput > +from framework.settings import CONFIG_ROOT_PATH > from framework.test_case import TestCase >=20 >=20 > @@ -47,7 +48,7 @@ class Testiavf_package_and_driver_check(TestCase): > self.verify(len(self.dut_ports) >=3D 1, "Insufficient ports") > self.PF_QUEUE =3D 16 >=20 > - conf_file =3D 'conf/iavf_driver_package.cfg' > + conf_file =3D os.path.join(CONFIG_ROOT_PATH, > + 'iavf_driver_package.cfg') > conf_peer =3D UserConf(conf_file) > conf_session =3D conf_peer.conf._sections['suite'] > self.driverPath_latest =3D conf_session['ice_driver_file_locatio= n_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. >=20 > import binascii > +import os.path > import time >=20 > 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 >=20 >=20 > @@ -87,7 +89,7 @@ class TestIPsecGW(TestCase): > "u": "0x1" > } >=20 > - conf_file =3D r'conf/ipsec_ep0.cfg' > + conf_file =3D os.path.join(CONFIG_ROOT_PATH, 'ipsec_ep0.cfg') > self.dut.session.copy_file_to(conf_file, '/tmp') >=20 > 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 >=20 > 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 >=20 > @@ -54,7 +55,7 @@ class TestVhostUserLiveMigration(TestCase): > "Insufficient ports for testing") >=20 > # get mount info from cfg file > - conf_info =3D UserConf('conf/%s.cfg' % self.suite_name) > + conf_info =3D UserConf(os.path.join(CONFIG_ROOT_PATH, > + f'{self.suite_name}.cfg')) > conf_session =3D conf_info.conf._sections['mount_info'] > self.mount_path =3D conf_session['backup_mount_path'] > self.share_path =3D 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 >=20 > from framework.config import UserConf > +from framework.settings import CONFIG_ROOT_PATH >=20 > -conf_file =3D 'conf/vhost_peer_conf.cfg' > +conf_file =3D os.path.join(CONFIG_ROOT_PATH, 'vhost_peer_conf.cfg') > conf_peer =3D UserConf(conf_file) > conf_session =3D conf_peer.conf._sections['peerconf'] >=20 > diff --git a/tools/setup.py b/tools/setup.py index c70730c7..f4cc5d74 100= 755 > --- a/tools/setup.py > +++ b/tools/setup.py > @@ -20,10 +20,12 @@ DTS_TOOLS =3D DTS_PATH + '/tools' > DTS_SUITES =3D DTS_PATH + '/tests' > DTS_EXECS =3D DTS_PATH + '/executions' >=20 > -DTS_EXEC_CFG =3D DTS_PATH + '/execution.cfg' > -DTS_CRBS_CFG =3D DTS_PATH + '/conf/crbs.cfg' > -DTS_PORTS_CFG =3D DTS_PATH + '/conf/ports.cfg' > -DTS_IXIA_CFG =3D DTS_PATH + '/conf/ixia.cfg' > +CONFIG_ROOT_PATH =3D os.environ.get("DTS_CFG_FOLDER") or > +os.path.join(DTS_PATH, "conf/") > + > +DTS_EXEC_CFG =3D os.path.join(DTS_PATH, 'execution.cfg') DTS_CRBS_CFG = =3D > +os.path.join(CONFIG_ROOT_PATH, 'crbs.cfg') DTS_PORTS_CFG =3D > +os.path.join(CONFIG_ROOT_PATH, 'ports.cfg') DTS_IXIA_CFG =3D > +os.path.join(CONFIG_ROOT_PATH, 'ixia.cfg') >=20 > sys.path.append(DTS_FRAMEWORK) > sys.path.append(DTS_TOOLS) > -- > 2.30.2 >=20