-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.sh
76 lines (61 loc) · 1.33 KB
/
build.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
build() {
mono .nuget/NuGet.exe install NUnit.Runners
mono .nuget/NuGet.exe restore Disque.Net.sln
xbuild /t:Rebuild Disque.Net.sln
if [[ $? != 0 ]] ; then
build_failed
else
build_succeeded
fi
}
build_failed() {
print_status "BUILD FAILED"
return 1
}
build_succeeded() {
print_status "BUILD SUCCEEDED"
run_tests
}
run_tests() {
print_status "RUNNING TESTS"
if [ -z "$USE_SYSTEM_NUNIT_CONSOLE" ]; then
RUNNER_PATH="packages/NUnit.Runners.2.6.4/tools"
else
RUNNER_PATH="/usr/lib/nunit"
fi
NUNIT_ADDT_ARGS=""
if [[ $NUNIT_RUN != "" ]]; then
NUNIT_RUN_CSV=""
for RUN in $NUNIT_RUN
do
NUNIT_RUN_CSV="$NUNIT_RUN_CSV,$RUN"
done
NUNIT_ADDT_ARGS="$NUNIT_ADDT_ARGS -run $NUNIT_RUN_CSV"
fi
mono ${RUNNER_PATH}/nunit-console.exe \
Disque.Net.Tests/bin/Debug/Disque.Net.Tests.dll \
$NUNIT_ADDT_ARGS
local test_result=$?
if [[ "${test_result}" != 0 ]] ; then
tests_failed
else
tests_passed
fi
}
tests_failed() {
print_status "TESTS FAILED"
return 2
}
tests_passed() {
print_status "TESTS PASSED"
}
print_status() {
echo ""
echo "*** $1 ***"
echo ""
}
NUNIT_RUN=$*
build
EXIT_CODE=$?
echo "Exit [$EXIT_CODE]"
exit $EXIT_CODE