From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 7AB5B292D for ; Mon, 25 Feb 2019 10:34:32 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 01:34:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,411,1544515200"; d="scan'208";a="124980791" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 25 Feb 2019 01:34:31 -0800 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 25 Feb 2019 01:34:31 -0800 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 25 Feb 2019 01:34:30 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.110]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.190]) with mapi id 14.03.0415.000; Mon, 25 Feb 2019 17:34:28 +0800 From: "Tu, Lijuan" To: "Zhao, XinfengX" , "dts@dpdk.org" CC: "Zhao, XinfengX" Thread-Topic: [dts] [PATCH] tests: add the common script for all cryptodev test_suite Thread-Index: AQHUusemHGKAyh0ldkaF5QumkeHQNqXwZP7w Date: Mon, 25 Feb 2019 09:34:27 +0000 Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA26BBB@SHSMSX101.ccr.corp.intel.com> References: <1549092180-52600-1-git-send-email-xinfengx.zhao@intel.com> In-Reply-To: <1549092180-52600-1-git-send-email-xinfengx.zhao@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzZkY2JhNjgtZTEzZC00MWE4LWIzOWUtNzM3NDkzZmQ0N2U0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiY1dReUFCUFF3cTFmOXpOV09qSEJrSkNoZXBaOTRESldYQjJWZkJJUTBqdUxYRlRqM2FwdkFMMTY4ak0rY3NOaiJ9 x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH] tests: add the common script for all cryptodev test_suite X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Feb 2019 09:34:33 -0000 Applied, thanks > -----Original Message----- > From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xinfeng Zhao > Sent: Saturday, February 2, 2019 3:23 PM > To: dts@dpdk.org > Cc: Zhao, XinfengX > Subject: [dts] [PATCH] tests: add the common script for all cryptodev tes= t_suite >=20 > add tests/cryptodev_common.py >=20 > Signed-off-by: Xinfeng Zhao > --- > tests/cryptodev_common.py | 170 > ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 170 insertions(+) > create mode 100644 tests/cryptodev_common.py >=20 > diff --git a/tests/cryptodev_common.py b/tests/cryptodev_common.py new fi= le > mode 100644 index 0000000..5570f7a > --- /dev/null > +++ b/tests/cryptodev_common.py > @@ -0,0 +1,170 @@ > +# BSD LICENSE > +# > +# Copyright(c) 2016-2017 Intel Corporation. All rights reserved. > +# All rights reserved. > +# > +# Redistribution and use in source and binary forms, with or without # > +modification, are permitted provided that the following conditions # > +are met: > +# > +# * Redistributions of source code must retain the above copyright > +# notice, this list of conditions and the following disclaimer. > +# * Redistributions in binary form must reproduce the above copyright > +# notice, this list of conditions and the following disclaimer in > +# the documentation and/or other materials provided with the > +# distribution. > +# * Neither the name of Intel Corporation nor the names of its > +# contributors may be used to endorse or promote products derived > +# from this software without specific prior written permission. > +# > +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND > CONTRIBUTORS # > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS > FOR # > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE > COPYRIGHT # > +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, > INCIDENTAL, # > +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT > # > +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF > USE, # > +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON > ANY # > +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. > + > + > +def build_dpdk_with_cryptodev(test_case): > + # Rebuild the dpdk with cryptodev pmds > + snow3g_lib_path =3D "/root/libsso_snow3g/snow3g/" > + if "snow3g_lib_path" in test_case.get_suite_cfg(): > + snow3g_lib_path =3D test_case.get_suite_cfg()["snow3g_lib_path"] > + > + zuc_lib_path =3D "/root/libsso_zuc.1.0.1.1-8/zuc" > + if "zuc_lib_path" in test_case.get_suite_cfg(): > + zuc_lib_path =3D test_case.get_suite_cfg()["zuc_lib_path"] > + > + kasumi_lib_path =3D "/root/LibSSO_0_3_1/isg_cid- > wireless_libs/ciphers/kasumi/" > + if "kasumi_lib_path" in test_case.get_suite_cfg(): > + kasumi_lib_path =3D test_case.get_suite_cfg()["kasumi_lib_path"] > + > + test_case.dut.send_expect( > + "export LIBSSO_SNOW3G_PATH=3D{}".format(snow3g_lib_path), "#") > + test_case.dut.send_expect( > + "export LIBSSO_ZUC_PATH=3D{}".format(zuc_lib_path), "#") > + test_case.dut.send_expect( > + "export LIBSSO_KASUMI_PATH=3D{}".format(kasumi_lib_path), "#") > + > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dn$/CONFIG_RTE_LIBRTE_PMD_AESN > I_MB=3Dy/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=3Dn$/CONFIG_RTE_LIBRTE_PMD_QAT_S > YM=3Dy/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3Dn$/CONFIG_RTE_LIBRTE_PMD_AES > NI_GCM=3Dy/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dn$/CONFIG_RTE_LIBRTE_PMD_OPENS > SL=3Dy/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dn$/CONFIG_RTE_LIBRTE_PMD_SNOW > 3G=3Dy/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dn$/CONFIG_RTE_LIBRTE_PMD_KASUMI > =3Dy/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > + 's/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dn$/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dy/' > + config/common_base", "# ") > + > + test_case.dut.skip_setup =3D False > + test_case.dut.build_install_dpdk(test_case.dut.target) > + > + > +def bind_qat_device(test_case, driver =3D "igb_uio"): > + if not driver: > + test_case.logger.error("Please configure the driver of qat devic= e to bind") > + if driver =3D=3D 'vfio-pci': > + test_case.dut.send_expect('modprobe vfio-pci', '#', 10) > + > + if "crypto_dev_id" in test_case.get_suite_cfg(): > + crypto_dev_id =3D test_case.get_suite_cfg()["crypto_dev_id"] > + else: > + crypto_dev_id =3D "443" > + test_case.logger.info("crypto device id: " + crypto_dev_id) > + > + # Bind QAT VF devices > + out =3D test_case.dut.send_expect("lspci -d:{}|awk '{{print > $1}}'".format(crypto_dev_id), "# ", 10) > + crypto_list =3D out.replace("\r", "\n").replace("\n\n", "\n").split(= "\n") > + test_case._crypto_pci =3D crypto_list[0] > + test_case.dut.send_expect( > + 'echo "8086 {}" > /sys/bus/pci/drivers/{}/new_id'.format(crypto_= dev_id, > driver), "# ", 10) > + for line in crypto_list: > + cmd =3D "echo 0000:{} > > /sys/bus/pci/devices/0000\:{}/driver/unbind".format( > + line, line.replace(":", "\:")) > + test_case.dut.send_expect(cmd, "# ", 10) > + cmd =3D "echo 0000:{} > /sys/bus/pci/drivers/{}/bind".format( > + line, driver) > + test_case.dut.send_expect(cmd, "# ", 10) > + > + > +def clear_dpdk_config(test_case): > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dy$/CONFIG_RTE_LIBRTE_PMD_AESN > I_MB=3Dn/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_QAT_SYM=3Dy$/CONFIG_RTE_LIBRTE_PMD_QAT_S > YM=3Dn/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3Dy$/CONFIG_RTE_LIBRTE_PMD_AES > NI_GCM=3Dn/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dy$/CONFIG_RTE_LIBRTE_PMD_OPENS > SL=3Dn/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dy$/CONFIG_RTE_LIBRTE_PMD_SNOW > 3G=3Dn/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > 's/CONFIG_RTE_LIBRTE_PMD_KASUMI=3Dy$/CONFIG_RTE_LIBRTE_PMD_KASUMI > =3Dn/' config/common_base", "# ") > + test_case.dut.send_expect( > + "sed -i > +'s/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dy$/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dn/' > +config/common_base", "# ") > + > + > +default_eal_opts =3D { > + "c": None, > + "l": None, > + "w": None, > + "vdev": None, > + "socket-mem": "512,512", > + "n": "4" > +} > + > + > +def get_eal_opt_str(test_case, override_eal_opts=3D{}): > + return get_opt_str(test_case, default_eal_opts, override_eal_opts) > + > + > +def get_opt_str(test_case, default_opts, override_opts=3D{}): > + opts =3D default_opts.copy() > + > + # Update options with test suite/case config file > + for key in opts.keys(): > + if key in test_case.get_case_cfg(): > + opts[key] =3D test_case.get_case_cfg()[key] > + > + # Update options with func input > + opts.update(override_opts) > + > + # Generate option string > + opt_str =3D "" > + for key,value in opts.items(): > + if value is None: > + continue > + dash =3D "-" if len(key) =3D=3D 1 else "--" > + opt_str =3D opt_str + "{0}{1} {2} ".format(dash, key, value) > + > + return opt_str > + > + > +def get_dpdk_app_cmd_str(app_path, eal_opt_str, app_opt_str=3DNone): > + if not app_opt_str: > + return "{0} {1}".format(app_path, eal_opt_str) > + return "{0} {1} -- {2}".format(app_path, eal_opt_str, app_opt_str) > + > + > +def is_test_skip(test_case): > + if "test_skip" in test_case.get_case_cfg() \ > + and test_case.get_case_cfg()["test_skip"] =3D=3D "Y": > + test_case.logger.info("Test Skip is YES") > + return True > + > + > +def is_build_skip(test_case): > + if "build_skip" in test_case.get_suite_cfg() \ > + and test_case.get_suite_cfg()["build_skip"] =3D=3D "Y": > + test_case.logger.info("Build Skip is YES") > + return True > -- > 2.7.4