Skip to content

Commit 420c299

Browse files
committed
Add script to test failure rate
1 parent b1a54c8 commit 420c299

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test_failure_rate.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
#
3+
#
4+
repeat=$1
5+
cmd="${@:2}"
6+
7+
if [[ -z "$repeat" || -z "$cmd" ]]; then
8+
echo "Usage: test_error_rate.sh <repeat_count> command [ args ... ]"
9+
echo "For example, to test uploading a binary to nodemcu board 200 times, run:"
10+
echo "./test_failure_rate.sh 200 ./esptool -cp /dev/tty.SLAB_USBtoUART -cb 921600 -cd nodemcu -cf some_test_file.bin"
11+
exit 1
12+
fi
13+
14+
success=0
15+
fail=0
16+
17+
for i in $(seq 1 $repeat); do
18+
echo "Run $i"
19+
if $cmd; then
20+
success=$(($success+1))
21+
else
22+
fail=$(($fail+1))
23+
fi
24+
done
25+
26+
echo "Success: $success"
27+
echo "Fail: $fail"

0 commit comments

Comments
 (0)