@@ -301,40 +301,84 @@ should_attempt_test() {
301301}
302302
303303test_all () {
304+ local passed_cnt=0
305+ local unstable_cnt=0
306+ local failed_cnt=0
307+ local total_cnt=0
308+ local expected_cnt=` find $tests_path -mindepth 1 -maxdepth 1 ! -path . -type d | wc -l`
309+
304310 local test_pattern=" ${1:- .} "
305311
306312 echo " ." > $tests_todo_file
307313 while [ -s $tests_todo_file ] ; do
308314 echo -n > $tests_todo_file
309-
310- find $tests_path -mindepth 1 -maxdepth 1 ! -path . -type d | xargs ls -td1 | cut -d " /" -f 4 | egrep " $test_pattern " | while read test_name ; do
315+ while read test_name ; do
311316 if ! test_listed_as_attempted " $test_name " ; then
312317 echo " $test_name " >> $tests_todo_file
313318 fi
314319 if should_attempt_test " $test_name " " $test_pattern " ; then
315- test_single " $test_name "
316- if [ $? -eq 0 ] ; then
320+ # try up to 3 times. Some tests seem to be not stable
321+
322+ test_status=" PASSED"
323+ for i in {1..3}
324+ do
325+ if [ ${i} -ne 1 ] ; then
326+ test_status=" UNSTABLE"
327+ echo " Retrying test after failure (${i} /3). Testname: $test_name "
328+ # cleanup the state just in case
329+ bash $tests_path /deploy-replication || return 1
330+ fi
331+ test_single " $test_name "
332+ test_single_result=$?
333+ if [ $test_single_result -eq 0 ] ; then
334+ break
335+ fi
336+ done
337+ if [ $test_single_result -eq 0 ] ; then
338+ echo " Test finished. Testname: ${test_name} status: ${test_status} "
317339 echo " $test_name " >> $tests_successful_file
318340 else
319341 echo " $test_name " >> $tests_failed_file
342+ test_status=" FAILED"
343+ echo " Test finished. Testname: ${test_name} status: ${test_status} "
320344 if [ " $ALLOW_TESTS_FAILURES " != " YES" ] ; then
321345 echo " Tests failures not allowed. Exiting."
322346 exit 1
323347 else
324348 echo " Tests failures allowed. Continuing."
349+ # cleanup the state just in case
350+ bash $tests_path /deploy-replication || return 1
325351 fi
326352 fi
353+ if [ " ${test_status} " == " PASSED" ] ; then
354+ (( passed_cnt++ ))
355+ elif [ " ${test_status} " == " UNSTABLE" ] ; then
356+ (( unstable_cnt++ ))
357+ elif [ " ${test_status} " == " FAILED" ] ; then
358+ (( failed_cnt++ ))
359+ else
360+ echo " Unexpected test_status: ${test_status} "
361+ fi
362+ (( total_cnt++ ))
327363 else
328364 : # echo "# should not attempt $test_name"
329365 fi
330- done || return 1
366+ done < <( find $tests_path -mindepth 1 -maxdepth 1 ! -path . -type d | xargs ls -td1 | cut -d " / " -f 4 | egrep " $test_pattern " ) || return 1
331367 done
332368 find $tests_path -mindepth 1 -maxdepth 1 ! -path . -type d | xargs ls -td1 | cut -d " /" -f 4 | egrep " $test_pattern " | while read test_name ; do
333369 if ! test_listed_as_attempted " $test_name " ; then
334370 echo " # ERROR: tests completed by $test_name seems to have been skipped"
335371 exit 1
336372 fi
337373 done || exit 1
374+
375+ echo " Test results:"
376+ echo " PASSED: ${passed_cnt} /${total_cnt} /${expected_cnt} "
377+ echo " UNSTABLE: ${unstable_cnt} /${total_cnt} /${expected_cnt} "
378+ echo " FAILED: ${failed_cnt} /${total_cnt} /${expected_cnt} "
379+ if [ ${total_cnt} -ne ${expected_cnt} ] ; then
380+ echo " WARNING! Some tests were skipped. Expected: ${expected_cnt} , executed: ${total_cnt} "
381+ fi
338382}
339383
340384main () {
0 commit comments