mdadm: make ptest output format align with common style

(From OE-Core rev: 99176bce7a185c996ef892b4f9b2617825a607fb)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Changqing Li
2019-07-16 11:48:42 +08:00
committed by Richard Purdie
parent d9d208c532
commit eba6cd155a
2 changed files with 9 additions and 16 deletions

View File

@@ -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

View File

@@ -74,6 +74,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