Added retry in bash script

This commit is contained in:
MohitMali 2023-01-11 12:39:52 +05:30
parent 6012c2320e
commit 1105752564

View File

@ -2,9 +2,21 @@
adb logcat -c
adb logcat *:E -v color &
if ./gradlew jacocoInstrumentationTestReport; then
echo "jacocoInstrumentationTestReport succeeded" >&2
else
adb exec-out screencap -p >screencap.png
exit 1
fi
retry=0
while [ $retry -le 3 ]
do
if ./gradlew jacocoInstrumentationTestReport; then
echo "jacocoInstrumentationTestReport succeeded" >&2
break
else
adb kill-server
adb start-server
adb logcat -c
./gradlew clean
retry=$(( $retry + 1 ))
if [ $retry == 3 ]; then
adb exec-out screencap -p >screencap.png
exit 1
fi
fi
done