Fix testfile path hardcoded in show-expected-fail-tests.sh (#719)

Signed-off-by: Alex Chen <minecnly@gmail.com>
This commit is contained in:
Alex Chen 2019-06-25 18:50:19 +08:00 committed by Andrew Morgan
parent b88112b05d
commit 7792f12e6f
2 changed files with 18 additions and 3 deletions

View File

@ -59,7 +59,7 @@ Once the tests are complete, run the helper script to see if you need to add
any newly passing test names to `testfile` in the project's root directory: any newly passing test names to `testfile` in the project's root directory:
```sh ```sh
../dendrite/show-expected-fail-tests.sh results.tap ../dendrite/show-expected-fail-tests.sh results.tap ../dendrite/testfile
``` ```
If the script prints nothing/exits with 0, then you're good to go. If the script prints nothing/exits with 0, then you're good to go.

View File

@ -1,13 +1,28 @@
#! /bin/bash #! /bin/bash
results_file=$1 results_file=$1
testfile=$2
fail_build=0
if [ ! -f "$results_file" ]; then
echo "ERROR: Specified results file ${results_file} doesn't exist."
fail_build=1
fi
if [ ! -f "$testfile" ]; then
echo "ERROR: Specified testfile ${testfile} doesn't exist."
fail_build=1
fi
[ "$fail_build" = 0 ] || exit 1
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$//') 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="" tests_to_add=""
already_in_testfile="" already_in_testfile=""
fail_build=0
while read -r test_id; do while read -r test_id; do
grep "${test_id}" testfile > /dev/null 2>&1 grep "${test_id}" "${testfile}" > /dev/null 2>&1
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
tests_to_add="${tests_to_add}${test_id}\n" tests_to_add="${tests_to_add}${test_id}\n"
fail_build=1 fail_build=1