Skip to contentSkip to conversation

libteam: improve the ptest output

PATCH New [email protected] 1 participant 1 message Dec 21, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libteam: improve the ptest output

From: Mingli Yu <[email protected]>

There is no PASS or FAIL related status report before, so improve the ptest output to print the status.

---
 ...basic_test.py-check-the-return-value.patch | 34 +++++++++++++++++++
 .../recipes-support/libteam/libteam/run-ptest |  5 +++
 .../recipes-support/libteam/libteam_1.31.bb   |  1 +
 3 files changed, 40 insertions(+)
 create mode 100644 meta-oe/recipes-support/libteam/libteam/0001-team_basic_test.py-check-the-return-value.patch
meta-oe/recipes-support/libteam/libteam/0001-team_basic_test.py-check-the-return-value.patch new file +34 -0
new file mode 100644
index 000000000..96891c9ea
@@ -0,0 +1,34 @@
+From e86a58271d7d0a3b9cd546251d2527e93898bdb8 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <[email protected]>
+Date: Tue, 21 Dec 2021 11:15:31 +0800
+Subject: [PATCH] team_basic_test.py: check the return value
+
+Not only print the traceback like before, also check the
+return value.
+
+Upstream-Status: Submitted [https://github.com/jpirko/libteam/pull/63]
+
+Signed-off-by: Mingli Yu <[email protected]>
+---
+ scripts/team_basic_test.py | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/team_basic_test.py b/scripts/team_basic_test.py
+index 0b64af2..17588c7 100755
+--- a/scripts/team_basic_test.py
++++ b/scripts/team_basic_test.py
+@@ -203,4 +203,10 @@ def main():
+     btest.run()
+ 
+ if __name__ == "__main__":
+-    main()
++    try:
++        ret = main()
++    except Exception as esc:
++        ret = 1
++        import traceback
++        traceback.print_exc()
++    sys.exit(ret)
+-- 
+2.17.1
+
meta-oe/recipes-support/libteam/libteam/run-ptest +5 -0
index b5c6f4ebb..26f097d58 100644
@@ -1,3 +1,8 @@
 #!/bin/sh
 
 python3 $(dirname $0)/team_basic_test.py
+if [ $? -eq 0 ] ; then
+    echo "PASS: libteam"
+else
+    echo "FAIL: libteam"
+fi
meta-oe/recipes-support/libteam/libteam_1.31.bb +1 -0
index a3bed722e..e43d3e0da 100644
@@ -12,6 +12,7 @@ SRC_URI = "git://github.com/jpirko/libteam;branch=master;protocol=https \
            file://0002-teamd-Re-adjust-include-header-order.patch \
            file://0001-team_basic_test.py-disable-RedHat-specific-test.patch \
            file://0001-team_basic_test.py-switch-to-python3.patch \
+           file://0001-team_basic_test.py-check-the-return-value.patch \
            file://run-ptest \
            "
 SRCREV = "3ee12c6d569977cf1cd30d0da77807a07aa77158"
Signature · 1 line
2.17.1