From d936e93846989c817f9a35ed67fb1dd54fa39d2b Mon Sep 17 00:00:00 2001 From: Mingli Yu Date: Tue, 21 Dec 2021 11:52:38 +0800 Subject: [PATCH] libteam: improve the ptest output There is no PASS or FAIL related status report before, so improve the ptest output to print the status. Signed-off-by: Mingli Yu Signed-off-by: Khem Raj --- ...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 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 0000000000..96891c9ea7 --- /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 +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 +--- + 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 b5c6f4ebb9..26f097d587 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 a3bed722e7..e43d3e0dae 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"