diff mbox series

nftables: use automake ptest output format

Message ID 20221103001742.21508-1-Randy.MacLeod@windriver.com
State Under Review
Headers show
Series nftables: use automake ptest output format | expand

Commit Message

Randy MacLeod Nov. 3, 2022, 12:17 a.m. UTC
Make run-ptest use the correct libdir for multilib builds.

Log the ptest output to a date stamped file and append a test summary
to the end of the log.

Munge the log as it is produced to:
 - insert the expected automake keywords: PASS and FAIL.
 - remove escape sequences used for ANSI colours as well as movement commands

Add additional discrete tool dependencies to the nftables-ptest list since
the test suite does not work with the busybox versions.

Signed-off-by: Randy MacLeod <Randy.MacLeod@windriver.com>
---
 .../recipes-filter/nftables/nftables/run-ptest  | 17 ++++++++++++++++-
 .../recipes-filter/nftables/nftables_1.0.5.bb   |  4 +++-
 2 files changed, 19 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta-networking/recipes-filter/nftables/nftables/run-ptest b/meta-networking/recipes-filter/nftables/nftables/run-ptest
index 611b84485..27d780ace 100644
--- a/meta-networking/recipes-filter/nftables/nftables/run-ptest
+++ b/meta-networking/recipes-filter/nftables/nftables/run-ptest
@@ -1,2 +1,17 @@ 
 #!/bin/sh
-tests/shell/run-tests.sh -v
+
+NFTABLESLIB=@libdir@/nftables
+cd ${NFTABLESLIB}/ptest
+
+LOG="${NFTABLESLIB}/ptest/nftables_ptest_$(date +%Y%m%d-%H%M%S).log"
+tests/shell/run-tests.sh -v | sed  -e '/OK/ s/^/PASS: / ; /FAILED/ s/^/FAIL: /' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | tee -a ${LOG}
+
+passed=`grep PASS: ${LOG}|wc -l`
+failed=`grep FAIL: ${LOG}|wc -l`
+all=$((passed + failed))
+
+(   echo "=== Test Summary ==="
+    echo "TOTAL: ${all}"
+    echo "PASSED: ${passed}"
+    echo "FAILED: ${failed}"
+) | tee -a ${LOG}
diff --git a/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb b/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb
index 1708786f4..c5a2968d1 100644
--- a/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb
+++ b/meta-networking/recipes-filter/nftables/nftables_1.0.5.bb
@@ -35,7 +35,7 @@  PACKAGES =+ "${PN}-python"
 FILES:${PN}-python = "${nonarch_libdir}/${PYTHON_DIR}"
 RDEPENDS:${PN}-python = "python3-core python3-json ${PN}"
 
-RDEPENDS:${PN}-ptest += " ${PN}-python make bash python3-core python3-ctypes python3-json python3-misc util-linux"
+RDEPENDS:${PN}-ptest += " ${PN}-python bash make iproute2 iputils-ping procps python3-core python3-ctypes python3-json python3-misc sed util-linux"
 
 TESTDIR = "tests"
 
@@ -50,4 +50,6 @@  do_install_ptest() {
     cp -rf ${S}/${TESTDIR} ${D}${PTEST_PATH}/${TESTDIR}
     sed -i 's#/usr/bin/python#/usr/bin/python3#' ${D}${PTEST_PATH}/${TESTDIR}/json_echo/run-test.py
     sed -i 's#/usr/bin/env python#/usr/bin/env python3#' ${D}${PTEST_PATH}/${TESTDIR}/py/nft-test.py
+    # handle multilib
+    sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
 }