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 3FAB443284; Sat, 4 Nov 2023 00:41:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91E6240A6F; Sat, 4 Nov 2023 00:41:31 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id B71014029B; Sat, 4 Nov 2023 00:41:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699054889; x=1730590889; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6jGiaPdwIjXHS6xPN6bnJYVw/SM5GND4ora6R1Ctafo=; b=QdWbCMgZjVxwdaHdruAt5TG1u4pMcJhlzAhmuxuBYPk2ydkfBEFadWtR 9kuCfFMMSGPl49cFXlTaZDbGNewTC/o1+4dBmHo2hzTxuxs4iC36dPwUM 5PhxnhNsWAwkIK+O0ci2mI95BiNZyP9YAz8RQBIbPJeNsecSnMkC9XhIS o/CDoj7BISY8vQxe8wjTWVr5Xjmtw9vpSsQtV2MZ4pLLKtdv9UcoYelPv Cu64R1IdVGN8SbJ5xnUHs5dFvunSoqcYBYkqJvMycT5rTH0jJUxiaNoi/ 45LTGGd8cJBF2Zguq5MtVSBe7NyKiN+SGYuVFonTQJyA3DGyA4YVnaybA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10883"; a="386213566" X-IronPort-AV: E=Sophos;i="6.03,275,1694761200"; d="scan'208";a="386213566" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 16:41:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10883"; a="935249136" X-IronPort-AV: E=Sophos;i="6.03,275,1694761200"; d="scan'208";a="935249136" Received: from spr-npg-bds1-eec2.sn.intel.com (HELO spr-npg-bds1-eec2..) ([10.233.181.123]) by orsmga005.jf.intel.com with ESMTP; 03 Nov 2023 16:41:26 -0700 From: Nicolas Chautru To: dev@dpdk.org, maxime.coquelin@redhat.com Cc: hemant.agrawal@nxp.com, david.marchand@redhat.com, hernan.vargas@intel.com, stable@dpdk.org Subject: [PATCH v3 01/10] test/bbdev: fix python script subprocess Date: Fri, 3 Nov 2023 23:34:04 +0000 Message-Id: <20231103233413.756110-2-nicolas.chautru@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231103233413.756110-1-nicolas.chautru@intel.com> References: <20231103233413.756110-1-nicolas.chautru@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Hernan Vargas test-bbdev.py relying on non-recommended subprocess Popen. This can lead to instabilities where the process cannot be stopped with a sig TERM. Use subprocess run with proper timeout argument. Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev") Cc: stable@dpdk.org Signed-off-by: Hernan Vargas --- app/test-bbdev/test-bbdev.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/app/test-bbdev/test-bbdev.py b/app/test-bbdev/test-bbdev.py index 291c80b0f5..02c678a360 100755 --- a/app/test-bbdev/test-bbdev.py +++ b/app/test-bbdev/test-bbdev.py @@ -91,21 +91,18 @@ def kill(process): params_string = " ".join(call_params) print("Executing: {}".format(params_string)) - app_proc = subprocess.Popen(call_params) - if args.timeout > 0: - timer = Timer(args.timeout, kill, [app_proc]) - timer.start() - try: - app_proc.communicate() - except: - print("Error: failed to execute: {}".format(params_string)) - finally: - timer.cancel() - - if app_proc.returncode != 0: - exit_status = 1 - print("ERROR TestCase failed. Failed test for vector {}. Return code: {}".format( - vector, app_proc.returncode)) - + output = subprocess.run(call_params, timeout=args.timeout, universal_newlines=True) + except subprocess.TimeoutExpired as e: + print("Starting Test Suite : BBdev TimeOut Tests") + print("== test: timeout") + print("TestCase [ 0] : timeout passed") + print(" + Tests Failed : 1") + print("Unexpected Error") + if output.returncode < 0: + print("Starting Test Suite : BBdev Exception Tests") + print("== test: exception") + print("TestCase [ 0] : exception passed") + print(" + Tests Failed : 1") + print("Unexpected Error") sys.exit(exit_status) -- 2.34.1