forked from jech/babeld
-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.sh
executable file
·86 lines (79 loc) · 1.19 KB
/
test.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
#!/bin/bash
set -eux
CI=${CI:=""}
TEST=${TEST:=""}
check_deps()
{
if !hash cppcheck 2>/dev/null; then
echo "Please install cppcheck"
fi
}
build_babel()
{
cores=$(grep -c ^processor /proc/cpuinfo)
make clean
make -j $cores
if [ $? -ne 0 ]
then
echo "Compile failed!"
exit 1
fi
}
run_lint()
{
cppcheck --force .
if [ $? -ne 0 ]
then
echo "Linting failed!"
exit 1
fi
echo "Linting successful"
}
run_integration_tests()
{
pushd tests
sudo -E ./multihop-smoketest.sh
if [ $? -ne 0 ]
then
echo "Integration test failed!"
exit 1
fi
popd
}
run_compat_tests()
{
pushd tests
sudo -E ./multihop-compat.sh
if [ $? -ne 0 ]
then
echo "Compatibility tests failed!"
exit 1
fi
popd
}
if [ -z "$CI" ]; then
check_deps
build_babel
run_lint
run_integration_tests
run_compat_tests
else
case $TEST in
"lint")
run_lint
;;
"build")
build_babel
;;
"integration")
build_babel
run_integration_tests
;;
"compat")
run_compat_tests
;;
*)
echo "Unknown test \"$TEST\" (valid values: {lint|build|integration})"
;;
esac
fi