diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 54d5ae0f68e19158000032840018ca554d15a635..d90ac126b82fd3b30aad971c993255d761508dff 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