From cf6eb0e175e8fdfa235f0f62179208da56479f8b Mon Sep 17 00:00:00 2001 From: zhangchunle Date: Mon, 13 Jul 2020 14:45:59 +0800 Subject: [PATCH] summary failedtests (#25388) --- paddle/scripts/paddle_build.sh | 41 ++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 54d5ae0f68e..d90ac126b82 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -742,6 +742,23 @@ EOF fi } +failed_test_lists='' +tmp_dir=`mktemp -d` + +function collect_failed_tests() { + for file in `ls $tmp_dir`; do + exit_code=0 + grep -q 'The following tests FAILED:' $tmp_dir/$file||exit_code=$? + if [ $exit_code -ne 0 ]; then + failuretest='' + else + failuretest=`grep -A 10000 'The following tests FAILED:' $tmp_dir/$file | sed 's/The following tests FAILED://g'|sed '/^$/d'` + failed_test_lists="${failed_test_lists} + ${failuretest}" + fi + done +} + function card_test() { set -m case_count $1 $2 @@ -764,7 +781,7 @@ function card_test() { fi trap 'caught_error' CHLD - + tmpfile_rand=`date +%s%N` NUM_PROC=$[CUDA_DEVICE_COUNT/$cardnumber] for (( i = 0; i < $NUM_PROC; i++ )); do # CUDA_VISIBLE_DEVICES http://acceleware.com/blog/cudavisibledevices-masking-gpus @@ -777,21 +794,21 @@ function card_test() { cuda_list="$cuda_list,$[i*cardnumber+j]" fi done + tmpfile=$tmp_dir/$tmpfile_rand"_"$i if [ ${TESTING_DEBUG_MODE:-OFF} == "ON" ] ; then if [[ $cardnumber == $CUDA_DEVICE_COUNT ]]; then - ctest -I $i,,$NUM_PROC -R "($testcases)" -V & - else - env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" -V & + (ctest -I $i,,$NUM_PROC -R "($testcases)" -V | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) & + else + (env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" -V | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) & fi else if [[ $cardnumber == $CUDA_DEVICE_COUNT ]]; then - ctest -I $i,,$NUM_PROC -R "($testcases)" --output-on-failure & + (ctest -I $i,,$NUM_PROC -R "($testcases)" --output-on-failure | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) & else - env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" --output-on-failure & + (env CUDA_VISIBLE_DEVICES=$cuda_list ctest -I $i,,$NUM_PROC -R "($testcases)" --output-on-failure | tee $tmpfile; test ${PIPESTATUS[0]} -eq 0) & fi fi done - wait; # wait for all subshells to finish ut_endTime_s=`date +%s` if [ "$2" == "" ]; then @@ -876,6 +893,16 @@ set +x card_test "$single_card_tests_1" 1 # run cases with single GPU card_test "$multiple_card_tests" 2 # run cases with two GPUs card_test "$exclusive_tests" # run cases exclusively, in this cases would be run with 4/8 GPUs + collect_failed_tests + if [ -n "${failed_test_lists}" ];then + failed_test_lists_ult=`echo "${failed_test_lists}" |grep -Po '[^ ].*$'` + echo "========================================" + echo "Summary Failed Tests... " + echo "========================================" + echo "The following tests FAILED: " + echo "${failed_test_lists_ult}" + fi + rm -f $tmp_dir/* if [[ "$EXIT_CODE" != "0" ]]; then exit 8; fi -- GitLab