aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2021-04-21 11:39:45 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2021-04-21 11:39:45 +0100
commited0b928764ba1cf2b4658d689d9595315dcf3815 (patch)
treeefee3f11b6a4eea82410fbe36fe37d8584c3645b
parent2c17100501bd8394d0cfd5ed417057791a83215f (diff)
vote: Simple but useful wrapper for unreliable reproductions
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
-rwxr-xr-xbin/vote25
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/vote b/bin/vote
new file mode 100755
index 0000000..c708d03
--- /dev/null
+++ b/bin/vote
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+#
+# Vote
+#
+# Run an unreliable command multiple times and report the percentage
+# success rate.
+#
+
+[ -z $CYCLES ] && CYCLES=25
+
+GOOD=0
+
+for i in `seq $CYCLES`
+do
+ "$@"
+ if [ $? -eq 0 ]
+ then
+ GOOD=$(($GOOD + 1))
+ fi
+
+ echo
+ echo "Success rate is $GOOD/$i ($(($GOOD * 100 / $i))%)"
+ echo
+done