forked from mackerelio/mackerel-agent-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.bash
More file actions
executable file
·42 lines (38 loc) · 677 Bytes
/
Copy pathtest.bash
File metadata and controls
executable file
·42 lines (38 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# install dependencies
go install github.com/lufia/graphitemetrictest/cmd/graphite-metric-test@latest || exit
# prepare tests
for f in mackerel-plugin-*/test.sh
do
dir=$(dirname "$f")
name=$(basename "$dir")
go build -o "$dir/$name" ./"$dir" || exit
done
# run tests
declare -A plugins=()
for f in mackerel-plugin-*/test.sh
do
./"$f" &
pid=$!
plugins[$pid]="$f"
pids="${pids} ${pid}"
done
# collect the results
declare -a results=()
status=0
for i in $pids
do
if wait "$i"
then
results+=("OK: ${plugins[$i]}")
else
results+=("ERR: ${plugins[$i]}")
status=1
fi
done
echo '======' >&2
for s in "${results[@]}"
do
echo "$s" >&2
done
exit $status