[OE-core] [PATCH 2/2] mdadm: make ptest output format align with common style

changqing.li at windriver.com changqing.li at windriver.com
Tue Jul 16 03:48:42 UTC 2019


From: Changqing Li <changqing.li at windriver.com>

Signed-off-by: Changqing Li <changqing.li at windriver.com>
---
 meta/recipes-extended/mdadm/files/run-ptest | 17 +----------------
 meta/recipes-extended/mdadm/mdadm_4.1.bb    |  8 ++++++++
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/meta/recipes-extended/mdadm/files/run-ptest b/meta/recipes-extended/mdadm/files/run-ptest
index 234f973..e4a9c2b 100644
--- a/meta/recipes-extended/mdadm/files/run-ptest
+++ b/meta/recipes-extended/mdadm/files/run-ptest
@@ -1,19 +1,4 @@
 #!/bin/sh
 
-LOG="$(pwd)/test.log"
 # make the test continue to execute even one fail
-./test --keep-going 2>&1|tee ${LOG}
-# translate the test report
-# "tests/18imsm-r10_4d-takeover-r0_2d... succeeded" -> "PASS: tests/18imsm-r10_4d-takeover-r0_2d"
-# "tests/19raid6repair... FAILED - see //log for details" -> "FAIL: tests/19raid6repair"
-sed -i -e '/succeeded/ s/^/PASS: /' -e '/FAILED/ s/^/FAIL: /' ${LOG}
-sed -i -e 's/... FAILED//g' -e 's/... succeeded//g' ${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}
+./test --keep-going
diff --git a/meta/recipes-extended/mdadm/mdadm_4.1.bb b/meta/recipes-extended/mdadm/mdadm_4.1.bb
index 766004f..4978da7 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.1.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.1.bb
@@ -73,6 +73,14 @@ do_install_ptest() {
 	cp -R --no-dereference --preserve=mode,links -v ${S}/tests ${D}${PTEST_PATH}/tests
 	cp ${S}/test ${D}${PTEST_PATH}
 	sed -e 's!sleep 0.*!sleep 1!g; s!/var/tmp!/!g' -i ${D}${PTEST_PATH}/test
+        sed -i -e '/echo -ne "$_script... "/d' \
+               -e 's/echo "succeeded"/echo -e "PASS: $_script"/g' \
+               -e '/save_log fail/N; /_fail=1/i\\t\t\techo -ne "FAIL: $_script"' \
+               -e '/die "dmesg prints errors when testing $_basename!"/i\\t\t\t\techo -ne "FAIL: $_script" &&' \
+               ${D}${PTEST_PATH}/test
+
+        chmod +x ${D}${PTEST_PATH}/test
+
 	ln -s ${base_sbindir}/mdadm ${D}${PTEST_PATH}/mdadm
 	for prg in test_stripe swap_super raid6check
 	do
-- 
2.7.4



More information about the Openembedded-core mailing list