-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·134 lines (106 loc) · 3.35 KB
/
test.sh
File metadata and controls
executable file
·134 lines (106 loc) · 3.35 KB
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
#!/bin/bash -xe
# ----- Variables -------------------------------------------------------------
# Variables in the build.properties file will be available to Jenkins
# build steps. Variables local to this script can be defined below.
. ./build.properties
# -----------------------------------------------------------------------------
# fix for jenkins inserting the windows-style path in $WORKSPACE
cd "$WORKSPACE"
export WORKSPACE=`pwd`
# ----- Utility functions -----------------------------------------------------
function winpath() {
# Convert gitbash style path '/c/Users/Big John/Development' to 'c:\Users\Big John\Development',
# via dumb substitution. Handles drive letters; incurs process creation penalty for sed.
if [ -e /etc/bash.bashrc ] ; then
# Cygwin specific settings
echo "`cygpath -w $1`"
else
# Msysgit specific settings
echo "$1" | sed -e 's|^/\(\w\)/|\1:\\|g;s|/|\\|g'
fi
}
function bashpath() {
# Convert windows style path 'c:\Users\Big John\Development' to '/c/Users/Big John/Development'
# via dumb substitution. Handles drive letters; incurs process creation penalty for sed.
if [ -e /etc/bash.bashrc ] ; then
# Cygwin specific settings
echo "`cygpath $1`"
else
# Msysgit specific settings
echo "$1" | sed -e 's|\(\w\):|/\1|g;s|\\|/|g'
fi
}
function parentwith() { # used to find $WORKSPACE, below.
# Starting at the current dir and progressing up the ancestors,
# retuns the first dir containing $1. If not found returns pwd.
SEARCHTERM="$1"
DIR=`pwd`
while [ ! -e "$DIR/$SEARCHTERM" ]; do
NEWDIR=`dirname "$DIR"`
if [ "$NEWDIR" = "$DIR" ]; then
pwd
return
fi
DIR="$NEWDIR"
done
echo "$DIR"
}
# ----- Default values --------------------------------------------------------
# If we aren't running under jenkins some variables will be unset.
# So set them to a reasonable value.
if [ -z "$WORKSPACE" ]; then
export WORKSPACE=`parentwith .git`;
fi
if [ -z "$VERSION_NUMBER" ]; then
export VERSION_NUMBER="0.0.0"
fi
if [ -z "$BUILD_NUMBER" ]; then
# presume local workstation, use date-based build number
export BUILD_NUMBER=`date +%H%M` # hour + minute
fi
if [ -z "$BUILD_TAG" ]; then
export BUILD_TAG="${VERSION_NUMBER}.${BUILD_NUMBER}"
fi
if [ -z "$NUNIT_RUNNER_NAME" ]
then
NUNIT_RUNNER_NAME="nunit-console.exe"
fi
if [ -z "$NUNIT_XML_OUTPUT" ]
then
NUNIT_XML_OUTPUT="nunit-result.xml"
fi
# ---- Run Tests --------------------------------------------------------------------------
# Make sure the nunit-console is available first...
NUNIT_CONSOLE_RUNNER=`/usr/bin/find packages | grep "${NUNIT_RUNNER_NAME}\$"`
if [ -z "$NUNIT_CONSOLE_RUNNER" ]
then
echo "Could not find $NUNIT_RUNNER_NAME in the $WORKSPACE/packages folder."
exit -1
fi
TEST_LIBS=""
for TEST_DIR in $WORKSPACE/*.Tests; do
if [ -d $TEST_DIR ] ; then
for TEST_DLL in $TEST_DIR/bin/$Configuration/*.Tests.dll; do
if [ -f $TEST_DLL ] ; then
TEST_LIBS="$TEST_LIBS `winpath $TEST_DLL`"
fi
done
fi
done
if [ -e /etc/bash.bashrc ] ; then
# Cygwin specific settings
$NUNIT_CONSOLE_RUNNER \
-framework:net-4.0 \
-labels \
-stoponerror \
-xml=$NUNIT_XML_OUTPUT \
$TEST_LIBS
else
# Msysgit specific settings
$NUNIT_CONSOLE_RUNNER \
//framework:net-4.0 \
//labels \
//stoponerror \
//xml=$NUNIT_XML_OUTPUT \
$TEST_LIBS
fi