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 C1693A00BE; Fri, 11 Feb 2022 06:42:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2E0B4121E; Fri, 11 Feb 2022 06:42:46 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 44D52426DF for ; Fri, 11 Feb 2022 06:42:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644558165; x=1676094165; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Ok1ZY+lPs73DXx+nHhyKG49r3aYkKqQHSjq4FHYVPao=; b=KOTwoQXFJ6AvcWFiPcEH0jcj43Kyf/cHk+iazYljulNH13CJlJ5kSaid lV41iQ+X7mPrC1c9sY9QBJMsRdtjCJewr0tJNsSPruwF+3+B9ZGkZIBEl CE8ZvwnmPcilbbFrehGFsGaHgaBAijK5X31CoU1hlY941Tt3Uzbho9Oew WslgbKss9tb78blIxCgz8iFmg1gka67iVmbafU3F9tkT5WmlGQtwQevo3 Ch3mwHq/pMS54BKYLl6qk+MRaXsS60lu5uqvQIznJ+CRZR1W7I58lr54D rgqH8T72naMFvgbBWr+nX/ex1Zsx1W11oWwKC6W/pNHvj1IO+C/9v6ql8 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="274221495" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="274221495" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 21:42:44 -0800 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="541952924" Received: from unknown (HELO localhost.localdomain) ([10.239.251.93]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 21:42:43 -0800 From: Zhimin Huang To: dts@dpdk.org, xueqin.lin@intel.com Cc: Zhimin Huang Subject: [dts] [PATCH V2 3/3] tests/asan_smoke:add ASan test suite Date: Fri, 11 Feb 2022 22:09:20 +0800 Message-Id: <20220211140920.29929-3-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220211140920.29929-1-zhiminx.huang@intel.com> References: <20220211140920.29929-1-zhiminx.huang@intel.com> 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 add ASan test suite. Signed-off-by: Zhimin Huang --- tests/TestSuite_asan_smoke.py | 101 ++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 tests/TestSuite_asan_smoke.py diff --git a/tests/TestSuite_asan_smoke.py b/tests/TestSuite_asan_smoke.py new file mode 100644 index 00000000..b2127355 --- /dev/null +++ b/tests/TestSuite_asan_smoke.py @@ -0,0 +1,101 @@ +# BSD LICENSE +# +# Copyright(c) 2022 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. + +from .smoke_base import SmokeTest +from framework.packet import Packet +from framework.pmd_output import PmdOutput +from framework.test_case import TestCase + +class TestASanSmoke(TestCase): + + def set_up_all(self): + """ + Run at the start of each test suite. + Generic filter Prerequistites + """ + self.smoke_dut_ports = self.dut.get_ports(self.nic) + self.ports_pci = [self.dut.ports_info[self.smoke_dut_ports[0]]['pci']] + # Verify that enough ports are available + self.verify(len(self.smoke_dut_ports) >= 1, "Insufficient ports") + self.tester_port0 = self.tester.get_local_port(self.smoke_dut_ports[0]) + self.smoke_tester_nic = self.tester.get_interface(self.tester_port0) + self.smoke_tester_mac = self.tester.get_mac(self.smoke_dut_ports[0]) + self.smoke_dut_mac = self.dut.get_mac_address(self.smoke_dut_ports[0]) + self.cores = "1S/5C/1T" + # check core num + core_list = self.dut.get_core_list(self.cores) + self.verify(len(core_list) >= 5, "Insufficient cores for testing") + + # init Packet(), SmokeTest(), PmdOutput() + self.pkt = Packet() + self.smoke_base = SmokeTest(self) + self.pmd_out = PmdOutput(self.dut) + + # build dpdk with ASan tool + self.dut.build_install_dpdk(target=self.target, + extra_options="-Dbuildtype=debug -Db_lundef=false -Db_sanitize=address") + + def set_up(self): + """ + Run before each test case. + """ + pass + + def tear_down(self): + """ + Run after each test case. + """ + self.pmd_out.execute_cmd("stop") + + def tear_down_all(self): + """ + Run after each test suite. + """ + self.dut.send_expect("quit", "#") + self.dut.kill_all() + self.dut.build_install_dpdk(self.target) + + def check_testpmd_status(self): + cmd = "ps -aux | grep testpmd | grep -v grep" + out = self.dut.send_expect(cmd, "#", 15, alt_session=True) + self.verify("testpmd" in out, "After build dpdk with ASan, start testpmd failed") + + def test_rxtx_with_ASan_enable(self): + out = self.pmd_out.start_testpmd(cores=self.cores, ports=self.ports_pci) + self.check_testpmd_status() + self.verify(all([error_key not in out for error_key in ['heap-buffer-overflow', 'use-after-free']]), + "the testpmd have error key words") + self.pmd_out.execute_cmd("set fwd mac") + self.pmd_out.execute_cmd("set verbose 1") + self.pmd_out.execute_cmd("start") + queues, stats = self.smoke_base.send_pkg_return_stats() + self.verify(stats['RX-packets'] != 0 and stats['RX-packets'] == stats['TX-packets'], "RX-packets: {} " + "TX-packets : {}, rx tx test failed".format(stats['RX-packets'], stats['TX-packets'])) \ No newline at end of file -- 2.17.1