Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 242 lines (196 sloc) 6.683 kb
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
1 #!/bin/bash
2 ### ====================================================================== ###
3 ## ##
4 ## This is the main entry point for the build system. ##
5 ## ##
6 ## Users should execute this file rather than 'mvn' to ensure ##
7 ## the correct version is being used with the correct configuration. ##
8 ## ##
9 ### ====================================================================== ###
10
11 # $Id: build.sh 105735 2010-06-04 19:45:13Z pgier $
12
13 PROGNAME=`basename $0`
14 DIRNAME=`dirname $0`
15 GREP="grep"
16 ROOT="/"
17
18 # Ignore user's MAVEN_HOME if it is set
19 M2_HOME=""
20 MAVEN_HOME=""
21
22 MAVEN_OPTS="$MAVEN_OPTS -Xmx512M"
23 export MAVEN_OPTS
24
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
25 # The default search path for Maven.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
26 MAVEN_SEARCH_PATH="\
27 tools
28 tools/maven \
29 tools/apache/maven \
30 maven"
31
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
32 # The default arguments.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
33 MVN_OPTIONS="-s ../tools/maven/conf/settings.xml"
34
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
35 # Use the maximum available, or set MAX_FD != -1 to use that.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
36 MAX_FD="maximum"
37
38 # OS specific support (must be 'true' or 'false').
39 cygwin=false;
40 darwin=false;
41 case "`uname`" in
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
42 CYGWIN*) cygwin=true;;
43 Darwin*) darwin=true;;
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
44 esac
45
863202c Ondrej Zizka Don't run smoke tests if -Dtest=... is specified.
OndraZizka authored
46
47
48
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
49 #
863202c Ondrej Zizka Don't run smoke tests if -Dtest=... is specified.
OndraZizka authored
50 # Integration testsuite support.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
51 #
52
53 #
54 CMD_LINE_PARAMS=
55 TESTS_SPECIFIED="N"
56 . testsuite/groupDefs.sh
57
58 #
59 # Helper to process command line for test directives
60 # - user-specified parameters (allTests, stress-tests, benchmark-tests) are translated into the appropriate
61 # maven build profiles and removed from the command line
62 # - smoke tests run with build
63 #
64 process_test_directives() {
65
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
66 MVN_GOALS="";
0256450 Ondrej Zizka Set default goal also in integration-tests.sh
OndraZizka authored
67
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
68 # For each parameter, check for testsuite directives.
69 for param in $@ ; do
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
70 case $param in
ceccf17 Ondrej Zizka Rewrite integration-tests.sh to reflect new pom.xml
OndraZizka authored
71 ## -DallTests runs all tests except benchmark and stress.
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
72 -DallTests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS -DallTests -fae";;
ceccf17 Ondrej Zizka Rewrite integration-tests.sh to reflect new pom.xml
OndraZizka authored
73
74 -Dinteg-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $INTEGRATION_TESTS";;
75 -Dcluster-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $CLUSTER_TESTS";;
76 -Dsmoke-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $SMOKE_TESTS";;
77 -Dbasic-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $BASIC_TESTS";;
78 -Ddomain-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $DOMAIN_TESTS";;
79 -Dcompat-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $COMPAT_TESTS";;
80 -Dbenchmark-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $BENCHMARK_TESTS";;
81 -Dstress-tests) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $STRESS_TESTS";;
82 ## Don't run smoke tests if a single test is specified.
83 -Dtest=*) TESTS_SPECIFIED="Y"; CMD_LINE_PARAMS="$CMD_LINE_PARAMS $param";; # -DfailIfNoTests=false
84
85 ## Collect Maven goals.
0256450 Ondrej Zizka Set default goal also in integration-tests.sh
OndraZizka authored
86 clean) MVN_GOALS="$MVN_GOALS$param ";;
87 test) MVN_GOALS="$MVN_GOALS$param ";;
88 install) MVN_GOALS="$MVN_GOALS$param ";;
89 deploy) MVN_GOALS="$MVN_GOALS$param ";;
90 site) MVN_GOALS="$MVN_GOALS$param ";;
ceccf17 Ondrej Zizka Rewrite integration-tests.sh to reflect new pom.xml
OndraZizka authored
91 ## Pass through all other params.
92 *) CMD_LINE_PARAMS="$CMD_LINE_PARAMS $param";;
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
93 esac
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
94 done
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
95
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
96 # Default goal if none specified.
97 if [ -z "$MVN_GOALS" ]; then MVN_GOALS="install"; fi
98 CMD_LINE_PARAMS="$MVN_GOALS $CMD_LINE_PARAMS";
0256450 Ondrej Zizka Set default goal also in integration-tests.sh
OndraZizka authored
99
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
100 # If no tests specified, run smoke tests.
101 if [[ $TESTS_SPECIFIED == "N" ]]; then
102 CMD_LINE_PARAMS="$CMD_LINE_PARAMS $SMOKE_TESTS"
103 fi
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
104 }
105
106 #
107 # Helper to complain.
108 #
109 die() {
110 echo "${PROGNAME}: $*"
111 exit 1
112 }
113
114 #
115 # Helper to complain.
116 #
117 warn() {
118 echo "${PROGNAME}: $*"
119 }
120
121 #
122 # Helper to source a file if it exists.
123 #
124 maybe_source() {
125 for file in $*; do
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
126 if [ -f "$file" ]; then
127 . $file
128 fi
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
129 done
130 }
131
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
132 find_maven() {
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
133 search="$*"
134 for d in $search; do
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
135 MAVEN_HOME="`pwd`/$d"
136 MVN="$MAVEN_HOME/bin/mvn"
137 if [ -x "$MVN" ]; then
138 # found one
139 echo $MAVEN_HOME
140 break
141 fi
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
142 done
143 }
144
145 #
146 # Main function.
147 #
148 main() {
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
149 # If there is a build config file. then source it.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
150 maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"
151
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
152 # Increase the maximum file descriptors if we can.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
153 if [ $cygwin = "false" ]; then
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
154 MAX_FD_LIMIT=`ulimit -H -n`
155 if [ $? -eq 0 ]; then
156 if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
157 # Use the system max.
158 MAX_FD="$MAX_FD_LIMIT"
159 fi
160
161 ulimit -n $MAX_FD
162 if [ $? -ne 0 ]; then
163 warn "Could not set maximum file descriptor limit: $MAX_FD"
164 fi
165 else
166 warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
167 fi
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
168 fi
169
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
170 # Try the search path.
171 MAVEN_HOME=`find_maven $MAVEN_SEARCH_PATH`
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
172
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
173 # Try looking up to root.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
174 if [ "x$MAVEN_HOME" = "x" ]; then
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
175 target="build"
176 _cwd=`pwd`
177
178 while [ "x$MAVEN_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
179 cd ..
180 cwd=`pwd`
181 MAVEN_HOME=`search $MAVEN_SEARCH_PATH`
182 done
183
184 # Make sure we get back.
185 cd $_cwd
186
187 if [ "$cwd" != "$ROOT" ]; then
188 found="true"
189 fi
190
191 # Complain if we did not find anything.
192 if [ "$found" != "true" ]; then
193 die "Could not locate Maven; check \$MVN or \$MAVEN_HOME."
194 fi
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
195 fi
196
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
197 # Make sure we have one.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
198 MVN=$MAVEN_HOME/bin/mvn
199 if [ ! -x "$MVN" ]; then
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
200 die "Maven file is not executable: $MVN"
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
201 fi
202
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
203 # Need to specify planet57/buildmagic protocol handler package.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
204 MVN_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"
205
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
206 # Setup some build properties.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
207 MVN_OPTS="$MVN_OPTS -Dbuild.script=$0"
208
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
209 # Change to the directory where the script lives
210 # so users are not forced to be in the same directory as build.xml.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
211 cd $DIRNAME/testsuite
212
213 MVN_GOAL=$@
214 if [ -z "$MVN_GOAL" ]; then
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
215 MVN_GOAL="install"
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
216 fi
217
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
218 # Process test directives before calling maven.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
219 process_test_directives $MVN_GOAL
220 MVN_GOAL=$CMD_LINE_PARAMS
221
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
222 # Export some stuff for maven.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
223 export MVN MAVEN_HOME MVN_OPTS MVN_GOAL
224
225 echo "$MVN $MVN_OPTIONS $MVN_GOAL"
226
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
227 # Execute in debug mode, or simply execute.
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
228 if [ "x$MVN_DEBUG" != "x" ]; then
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
229 /bin/sh -x $MVN $MVN_OPTIONS $MVN_GOAL
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
230 else
bffe499 Ondrej Zizka Added -fae to -DallTests in integration-tests.sh
OndraZizka authored
231 exec $MVN $MVN_OPTIONS $MVN_GOAL
1ad802a Ondrej Zizka In the middle of moving
OndraZizka authored
232 fi
233
234 cd $DIRNAME
235 }
236
237 ##
238 ## Bootstrap
239 ##
240
241 main "$@"
Something went wrong with that request. Please try again.