-
-
Notifications
You must be signed in to change notification settings - Fork 249
/
test-all.sh
executable file
·136 lines (117 loc) · 4.36 KB
/
test-all.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
echo "Running go fmt..."
gofmt -s -w ./..
echo "Running unit tests..."
go test ./... || exit
echo "Building application..."
go build -ldflags="-s -w" || exit
echo '```' > LANGUAGES.md
./scc --languages >> LANGUAGES.md
echo '```' >> LANGUAGES.md
echo "Running integration tests..."
GREEN='\033[1;32m'
RED='\033[0;31m'
NC='\033[0m'
if ./scc --not-a-real-option > /dev/null ; then
echo -e "${RED}================================================="
echo -e "FAILED Invalid option should produce error code "
echo -e "======================================================="
exit
else
echo -e "${GREEN}PASSED invalid option test"
fi
if ./scc > /dev/null ; then
echo -e "${GREEN}PASSED no directory specified test"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should run correctly with no directory specified"
echo -e "======================================================="
exit
fi
if ./scc processor > /dev/null ; then
echo -e "${GREEN}PASSED directory specified test"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should run correctly with directory specified"
echo -e "======================================================="
exit
fi
if ./scc --avg-wage 10000 --binary --by-file --cocomo --debug --exclude-dir .git -f tabular -i go -c -d -M something -s name -w processor > /dev/null ; then
echo -e "${GREEN}PASSED multiple options test"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should run correctly with multiple options"
echo -e "======================================================="
exit
fi
if ./scc -i sh -M "vendor|examples|p.*" > /dev/null ; then
echo -e "${GREEN}PASSED regular expression ignore test"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should run with regular expression ignore"
echo -e "======================================================="
exit
fi
if ./scc "examples/shared_extension/" | grep -q "Coq"; then
echo -e "${GREEN}PASSED shared extension test 1"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should be able to work with shared extension 1"
echo -e "======================================================="
exit
fi
if ./scc "examples/shared_extension/" | grep -q "SystemVerilog"; then
echo -e "${GREEN}PASSED shared extension test 2"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should be able to work with shared extension 2"
echo -e "======================================================="
exit
fi
if ./scc "examples/shared_extension/" | grep -q "V "; then
echo -e "${GREEN}PASSED shared extension test 3"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should be able to work with shared extension 3"
echo -e "======================================================="
exit
fi
# Simple test to see if we get any concurrency issues
for i in {1..100}
do
if ./scc > /dev/null ; then
:
else
echo -e "${RED}======================================================="
echo -e "FAILED Should not have concurrency issue"
echo -e "================================================="
exit
fi
done
echo -e "${GREEN}PASSED concurrency issue test"
if ./scc main.go > /dev/null ; then
echo -e "${GREEN}PASSED file specified test"
else
echo -e "${RED}======================================================="
echo -e "FAILED Should run correctly with a file is specified"
echo -e "================================================="
exit
fi
# Try out duplicates
for i in {1..100}
do
if ./scc -d "examples/duplicates/" | grep -e "Java" | grep -q -e " 1 "; then
:
else
echo -e "${RED}======================================================="
echo -e "FAILED Duplicates should be consistent"
echo -e "======================================================="
exit
fi
done
echo -e "${GREEN}PASSED duplicates test"
echo -e "${NC}Cleaning up..."
rm ./scc
echo -e "${GREEN}================================================="
echo -e "ALL TESTS PASSED"
echo -e "================================================="