[meta-oe] libteam: improve the ptest output

Message ID 20211221035238.40950-1-mingli.yu@windriver.com
State New
Headers show
Series [meta-oe] libteam: improve the ptest output | expand

Commit Message

Yu, Mingli Dec. 21, 2021, 3:52 a.m. UTC
From: Mingli Yu <mingli.yu@windriver.com>

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

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 ...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

Patch

diff --git a/meta-oe/recipes-support/libteam/libteam/0001-team_basic_test.py-check-the-return-value.patch b/meta-oe/recipes-support/libteam/libteam/0001-team_basic_test.py-check-the-return-value.patch
new file mode 100644
index 000000000..96891c9ea
--- /dev/null
+++ b/meta-oe/recipes-support/libteam/libteam/0001-team_basic_test.py-check-the-return-value.patch
@@ -0,0 +1,34 @@ 
+From e86a58271d7d0a3b9cd546251d2527e93898bdb8 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+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 <mingli.yu@windriver.com>
+---
+ 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
+
diff --git a/meta-oe/recipes-support/libteam/libteam/run-ptest b/meta-oe/recipes-support/libteam/libteam/run-ptest
index b5c6f4ebb..26f097d58 100644
--- a/meta-oe/recipes-support/libteam/libteam/run-ptest
+++ b/meta-oe/recipes-support/libteam/libteam/run-ptest
@@ -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
diff --git a/meta-oe/recipes-support/libteam/libteam_1.31.bb b/meta-oe/recipes-support/libteam/libteam_1.31.bb
index a3bed722e..e43d3e0da 100644
--- a/meta-oe/recipes-support/libteam/libteam_1.31.bb
+++ b/meta-oe/recipes-support/libteam/libteam_1.31.bb
@@ -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"