File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # check the number of arguments
4
+ if [ " $# " -ne 2 ]; then
5
+ echo " Usage: $0 <test_type> <iterations>"
6
+ echo " test_type must be one of 3A, 3B, 3C, 3D"
7
+ exit 1
8
+ fi
9
+
10
+ test_type=$1
11
+ iterations=$2
12
+
13
+ # check the test_type
14
+ if [[ " $test_type " != " 3A" && " $test_type " != " 3B" && " $test_type " != " 3C" && " $test_type " != " 3D" ]]; then
15
+ echo " Invalid test_type: $test_type "
16
+ echo " test_type must be one of 3A, 3B, 3C, 3D"
17
+ exit 1
18
+ fi
19
+
20
+ # check the iterations is a positive integer
21
+ if ! [[ " $iterations " =~ ^[0-9]+$ ]]; then
22
+ echo " Invalid iterations: $iterations "
23
+ echo " iterations must be a positive integer"
24
+ exit 1
25
+ fi
26
+
27
+ echo " go test -run $test_type "
28
+ for (( i= 1 ; i<= iterations; i++ ))
29
+ do
30
+ echo " Running test iteration $i "
31
+ output=$( go test -run $test_type 2>&1 ) # 2>&1 redirects stderr to stdout
32
+ if [[ $? -ne 0 ]]; then
33
+ echo " Error in iteration $i :"
34
+ echo " $output "
35
+ fi
36
+ done
You can’t perform that action at this time.
0 commit comments