DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nicolas Chautru <nicolas.chautru@intel.com>
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	[thread overview]
Message-ID: <20231103233413.756110-2-nicolas.chautru@intel.com> (raw)
In-Reply-To: <20231103233413.756110-1-nicolas.chautru@intel.com>

From: Hernan Vargas <hernan.vargas@intel.com>

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 <hernan.vargas@intel.com>
---
 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


  reply	other threads:[~2023-11-03 23:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-03 23:34 [PATCH v3 00/10] test-bbdev changes for 23.11 Nicolas Chautru
2023-11-03 23:34 ` Nicolas Chautru [this message]
2023-11-09 12:37   ` [PATCH v3 01/10] test/bbdev: fix python script subprocess Maxime Coquelin
2023-11-03 23:34 ` [PATCH v3 02/10] test/bbdev: rename macros from acc200 to vrb Nicolas Chautru
2023-11-09 12:37   ` Maxime Coquelin
2023-11-03 23:34 ` [PATCH v3 03/10] test/bbdev: handle exception for LLR generation Nicolas Chautru
2023-11-09 12:46   ` Maxime Coquelin
2023-11-03 23:34 ` [PATCH v3 04/10] test/bbdev: improve test log messages Nicolas Chautru
2023-11-03 23:34 ` [PATCH v3 05/10] test/bbdev: assert failed test for queue configure Nicolas Chautru
2023-11-03 23:34 ` [PATCH v3 06/10] test/bbdev: ldpc encoder concatenation vector Nicolas Chautru
2023-11-03 23:34 ` [PATCH v3 07/10] test/bbdev: add MLD support Nicolas Chautru
2023-11-09 15:44   ` Maxime Coquelin
2023-11-03 23:34 ` [PATCH v3 08/10] test/bbdev: support new FFT capabilities Nicolas Chautru
2023-11-03 23:34 ` [PATCH v3 09/10] test/bbdev: support 4 bit LLR compression Nicolas Chautru
2023-11-03 23:34 ` [PATCH v3 10/10] test/bbdev: update python script parameters Nicolas Chautru
2023-11-09 10:16   ` Maxime Coquelin
2023-11-09 15:37     ` Chautru, Nicolas
2023-11-09 15:51 ` [PATCH v3 00/10] test-bbdev changes for 23.11 Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231103233413.756110-2-nicolas.chautru@intel.com \
    --to=nicolas.chautru@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=hernan.vargas@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).