Better output format for show-expected-fail-tests.sh

Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
Cnly 2019-06-19 20:40:34 +08:00
parent cc5f108c98
commit 248da25bbf

View file

@ -1,17 +1,29 @@
#! /bin/bash
results_file=$1
tests_to_add=$(grep ' # TODO passed but expected fail' ${results_file} | sed -E 's/^ok [0-9]+ (\(expected fail\) )?//' | sed -E 's/( \([0-9]+ subtests\))? # TODO passed but expected fail$//')
passed_but_expected_fail=$(grep ' # TODO passed but expected fail' ${results_file} | sed -E 's/^ok [0-9]+ (\(expected fail\) )?//' | sed -E 's/( \([0-9]+ subtests\))? # TODO passed but expected fail$//')
tests_to_add=""
already_in_testfile=""
fail_build=0
while read -r test_id; do
grep "${test_id}" testfile > /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: Passed test not present in testfile: ${test_id}"
tests_to_add="${tests_to_add}${test_id}\n"
fail_build=1
else
echo "WARN: Test in testfile still marked as expected fail: ${test_id}"
already_in_testfile="${already_in_testfile}${test_id}\n"
fi
done <<< "${tests_to_add}"
done <<< "${passed_but_expected_fail}"
if [ -n "${tests_to_add}" ]; then
echo "ERROR: The following passed tests are not present in testfile. Please append them to the file:"
echo -e "${tests_to_add}"
fi
if [ -n "${already_in_testfile}" ]; then
echo "WARN: Tests in testfile still marked as expected fail:"
echo -e "${already_in_testfile}"
fi
exit ${fail_build}