From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A62C72BA3 for ; Thu, 17 Jan 2019 09:44:00 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jan 2019 00:43:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,488,1539673200"; d="scan'208";a="267814608" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 17 Jan 2019 00:43:58 -0800 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 17 Jan 2019 00:43:53 -0800 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 17 Jan 2019 00:43:53 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.63]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.196]) with mapi id 14.03.0415.000; Thu, 17 Jan 2019 16:43:50 +0800 From: "Zhao, XinfengX" To: "dts@dpdk.org" CC: "Zhao, XinfengX" Thread-Topic: [dts][PATCH V1] tests: add the suite of cryptodev unit-test Thread-Index: AQHUrWG6JSPG1RHtnE6SydvkP5woFKWzJo3w Date: Thu, 17 Jan 2019 08:43:50 +0000 Message-ID: <44051B25D8C8784BB77FFB604D6A70CA1201D9D2@shsmsx102.ccr.corp.intel.com> References: <1547619024-4366-1-git-send-email-xinfengx.zhao@intel.com> In-Reply-To: <1547619024-4366-1-git-send-email-xinfengx.zhao@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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 V1] tests: add the suite of cryptodev unit-test 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: Thu, 17 Jan 2019 08:44:02 -0000 Tested-by : Xinfeng Zhao -----Original Message----- From: Zhao, XinfengX=20 Sent: Wednesday, January 16, 2019 2:10 PM To: dts@dpdk.org Cc: Zhao, XinfengX Subject: [dts][PATCH V1] tests: add the suite of cryptodev unit-test add the methods of cryptodev common and the suite of cryptodev unit-test Signed-off-by: Xinfeng Zhao --- tests/TestSuite_cryptodev_common.py | 170 ++++++++++++++++++++++++= ++++ tests/TestSuite_cryptodev_func_unit-test.py | 137 ++++++++++++++++++++++ 2 files changed, 307 insertions(+) create mode 100644 tests/TestSuite_cryptodev_common.py create mode 100644 tests/TestSuite_cryptodev_func_unit-test.py diff --git a/tests/TestSuite_cryptodev_common.py b/tests/TestSuite_cryptode= v_common.py new file mode 100644 index 0000000..4cb8ec0 --- /dev/null +++ b/tests/TestSuite_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 #=20 +modification, are permitted provided that the following conditions #=20 +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 #=20 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #=20 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #=20 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #=20 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #=20 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #=20 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #=20 +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_QAT_SYM=3Dn$/CONFIG_RTE_LIBRTE_PM= D_QAT_SYM=3Dy/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dn$/CONFIG_RTE_LIBRTE_P= MD_AESNI_MB=3Dy/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dn$/CONFIG_RTE_LIBRTE_PM= D_OPENSSL=3Dy/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3Dn$/CONFIG_RTE_LIBRTE_= PMD_AESNI_GCM=3Dy/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dn$/CONFIG_RTE_LIBRTE_PMD= _SNOW3G=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=20 + 's/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dn$/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dy/'=20 + 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 device = 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}}'".for= mat(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_de= v_id, driver), "# ", 10) + for line in crypto_list: + cmd =3D "echo 0000:{} > /sys/bus/pci/devices/0000\:{}/driver/unbin= d".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_QAT_SYM=3Dy$/CONFIG_RTE_LIBRTE_PM= D_QAT_SYM=3Dn/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_MB=3Dy$/CONFIG_RTE_LIBRTE_P= MD_AESNI_MB=3Dn/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_OPENSSL=3Dy$/CONFIG_RTE_LIBRTE_PM= D_OPENSSL=3Dn/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=3Dy$/CONFIG_RTE_LIBRTE_= PMD_AESNI_GCM=3Dn/' config/common_base", "# ") + test_case.dut.send_expect( + "sed -i 's/CONFIG_RTE_LIBRTE_PMD_SNOW3G=3Dy$/CONFIG_RTE_LIBRTE_PMD= _SNOW3G=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=20 +'s/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dy$/CONFIG_RTE_LIBRTE_PMD_ZUC=3Dn/'=20 +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 diff --git a/tests/TestSuite_cryptodev_func_unit-test.py b/tests/TestSuite_= cryptodev_func_unit-test.py new file mode 100644 index 0000000..20aa81a --- /dev/null +++ b/tests/TestSuite_cryptodev_func_unit-test.py @@ -0,0 +1,137 @@ +# 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 #=20 +modification, are permitted provided that the following conditions #=20 +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 #=20 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #=20 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR #=20 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT #=20 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, #=20 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT #=20 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, #=20 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY #=20 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #=20 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #=20 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import json + +from test_case import TestCase + +import TestSuite_cryptodev_common as cc + + +class UnitTestsCryptodev(TestCase): + + def set_up_all(self): + self._app_path =3D "./{target}/app/test".format(target=3Dself.dut.= target) + if not cc.is_build_skip(self): + cc.build_dpdk_with_cryptodev(self) + cc.bind_qat_device(self) + + def set_up(self): + pass + + def tear_down(self): + self.dut.kill_all() + + def tear_down_all(self): + cc.clear_dpdk_config(self) + + def test_cryptodev_qat_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_qat_autotest", eal_opt_str) + + def _test_cryptodev_qat_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_qat_perftest", eal_opt_str) + + def _test_cryptodev_qat_continual_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_qat_continual_perftest",=20 + eal_opt_str) + + def _test_cryptodev_qat_snow3g_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_qat_snow3g_perftest",=20 + eal_opt_str) +=20 + def test_cryptodev_aesni_mb_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_aesni_mb_autotest",=20 + eal_opt_str) + + def _test_cryptodev_aesni_mb_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_aesni_mb_perftest",=20 + eal_opt_str) + + def test_cryptodev_aesni_gcm_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_aesni_gcm_autotest",=20 + eal_opt_str) + + def _test_cryptodev_aesni_gcm_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_aesni_gcm_perftest",=20 + eal_opt_str) + + def test_cryptodev_sw_snow3g_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_sw_snow3g_autotest",=20 + eal_opt_str) + + def _test_cryptodev_sw_snow3g_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_sw_snow3g_perftest",=20 + eal_opt_str) + + def test_cryptodev_sw_kasumi_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_sw_kasumi_autotest",=20 + eal_opt_str) + + def test_cryptodev_sw_zuc_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_sw_zuc_autotest", eal_opt_str) + + def test_cryptodev_null_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_null_autotest", eal_opt_str) + + def test_cryptodev_openssl_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_openssl_autotest", eal_opt_str) + + def _test_cryptodev_openssl_perftest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_openssl_perftest", eal_opt_str) + + def test_cryptodev_scheduler_autotest(self): + eal_opt_str =3D cc.get_eal_opt_str(self) + self.__run_unit_test("cryptodev_scheduler_autotest",=20 + eal_opt_str) + + def __run_unit_test(self, testsuite, eal_opt_str, timeout=3D600): + self.logger.info("STEP_TEST: " + testsuite) + self.dut.send_expect("dmesg -C", "# ", 30) + cmd_str =3D cc.get_dpdk_app_cmd_str(self._app_path, eal_opt_str) + self.dut.send_expect(cmd_str, "RTE>>", 30) + + out =3D "" + try: + out =3D self.dut.send_expect(testsuite, "RTE>>", timeout) + self.dut.send_expect("quit", "# ", 30) + except Exception, ex: + self.logger.error("Cryptodev Unit Tests Exception") + dmesg =3D self.dut.alt_session.send_expect("dmesg", "# ", 30) + self.logger.error("dmesg info:") + self.logger.error(dmesg) + + self.logger.info(out) + self.verify("Test OK" in out, "Test Failed") -- 2.7.4