-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathacc_test_count.sh
executable file
·37 lines (31 loc) · 1.01 KB
/
acc_test_count.sh
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
#!/usr/bin/env bash
#set -x # uncomment for debug
set -e
# Define the tags we want to count
tags=("all" "resource" "datasource" "smoke" "cloud_router" "hosted_cloud" "dedicated_cloud" "core" "marketplace" "location" "other")
# Initialize an array to store the counts
declare -a counts
# Initialize the counts for each tag to zero
for ((i=0; i<${#tags[@]}; i++)); do
counts[i]=0
done
# Iterate over the test files
for file in internal/provider/*_test.go; do
# Read the first line of each file
read -r first_line < "$file"
# Extract the tags from the first line
tags_line="${first_line#*\/\/go:build }"
# Iterate over the defined tags
for ((i=0; i<${#tags[@]}; i++)); do
tag=${tags[i]}
# Check if the tag is present in the first line
if [[ $tags_line == *"$tag"* ]]; then
# Increment the count for the tag
((counts[i]++))
fi
done
done
# Print the tag counts
for ((i=0; i<${#tags[@]}; i++)); do
echo "Tag '${tags[i]}' count: ${counts[i]}"
done