#!/usr/bin/env bash get_key_value() { echo "$1" | sed 's/^--[a-zA-Z_-]*=//' } usage() { cat <${RESULT} grep -q '^Completed:' ${RESULT}; not_completed=$? if [[ ${not_completed} == 1 ]]; then mv ${RESULT} ${RESULT}.incompleted echo -e "\033[0;31mTest run failed to complete, please check result file:\033[0m ${RESULT}.incompleted!\n" else echo "MTR report: `grep '^Completed:' ${RESULT}`" # since 8.0.22, mysql-test-run add a shutdown_report at the end of test run FAIL_CASES=$(grep "Failing test(s)" ${RESULT} | sed -e 's/Failing test(s)://g; s/sanitize_report//g; s/shutdown_report//g') mv ${RESULT} ${RESULT}.origin if [[ ! -z "${FAIL_CASES}" ]]; then echo "Retry failed cases: ${FAIL_CASES}" $MTR ${FAIL_CASES} &>${RESULT} grep -q '^Completed:' ${RESULT}; not_completed=$? if [[ ${not_completed} == 1 ]]; then mv ${RESULT} ${RESULT}.retry_incompleted echo -e "\033[0;31mTest re-run failed to complete, please check result file:\033[0m ${RESULT}.retry_incompleted!\n" else echo "MTR rerun-report: `grep '^Completed:' ${RESULT}`" FAIL_CASES=$(grep "Failing test(s)" ${RESULT} | sed -e 's/Failing test(s)://g; s/sanitize_report//g; s/shutdown_report//g') mv ${RESULT} ${RESULT}.retry if [[ ! -z "${FAIL_CASES}" ]]; then echo -e "\033[0;31mFailed cases after retry:\033[0m ${FAIL_CASES}\n" fi fi fi if [[ -z "${FAIL_CASES}" ]]; then /bin/rm -rf $VAR fi fi }