blob: 8cf4760eb3de31e34b91fdd3c811c96ab93d29e3 [file] [log] [blame]
Stephan Herrmannf80b55d2016-10-31 23:56:48 +01001#! /bin/sh
2# Copyright (c) 2010 Stephan Herrmann.
3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
7#
8# Contributors:
9# Stephan Herrmann - initial API and implementation
10###############################################################################
11
12# =============================================================================
13# MAIN BUILD AND TEST SCRIPT FOR THE OBJECT TEAMS DEVELOPMENT TOOLING (OTDT)
14# =============================================================================
15# INPUT: Variables from otdt_prerequisites:
16# -----------------------------------------------------------------------------
17# TMPDIR for log output
18# TEST_TMPDIR for temp test files
19# OT_TESTSUITE_DIR root directory for building and testing
20# METADATA directory for metadata from previous builds
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010021# SDK_QUALIFIER build qualifier of the base eclipse SDK
22# ECLIPSE_SDK_TGZ archive file of the base eclipse SDK build (full path)
23# ECLIPSE_TESTLIB_ZIP archive file of the eclipse test framework (full path)
24# PUBLISHED_UPDATES directory of previously published plugins&features
Stephan Herrmann434a0842016-11-01 18:02:29 +010025# FETCH_CACHE_LOCATION git working area holding caches for fetch
26# MAP_FILE_PATH path to the otdt.map file (original location of otdt.map.in)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010027# ANT_PROFILE configure the ant process
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010028# NICE niceness value for nice -n ${NICE}
29# =============================================================================
30# OUTPUT: Variables passed to the toplevel ant script
31# -----------------------------------------------------------------------------
32## As Environment Variables:
33## ANT_OPTS configure Ant
34## As Ant Arguments (from ANT_PROFILE):
35## -verbose configure Ant
36## As Java Properties:
37## -Declipse-app.tgz path of eclipse SDK
38## -Declipse.tests.zip path of eclipse test framework
39## -Dpublished.updates path to previously published things
40## -Ddo.build.all true|false: should OTDT and tests be built?
41## -Ddo.run.tests true|false: should test be run?
Stephan Herrmann434a0842016-11-01 18:02:29 +010042## -DfetchCacheLocation git working area holding caches for fetch
43## -Dmap.file.path path to the otdt.map file (original location of otdt.map.in)
44## -D_hasSaxon.jar to prevent copying of saxon8.jar (was needed on build.eclipse.org)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010045# =============================================================================
46
47usage()
48{
49 echo "Usage:"
50 echo "$0 [-b|-nobuild]"
51 echo " -b: build OTDT only, no testing."
52 echo " -nobuild: don't build OTDT, directly invoke testing."
53}
54
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010055cleanup()
56{
Stephan Herrmann423ec262016-11-01 00:11:19 +010057 echo "cleanup(): Currently no cleanup is configured"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010058}
59
60_prefix=`dirname $0`
61_prefix=`readlink -f $_prefix`
62. "${_prefix}/otdt_prerequisites-hipp.sh"
63
64echo "=== Sourced otdt_prerequisites-hipp.sh ==="
65env
66echo "====================================="
67
68#LOCAL: log file:
69OT_SUITE_LOG=$TMPDIR/ot-testsuite.log
70
71# LOCAL: the initial ant build file:
72BUILDFILE="${_prefix}/run.xml"
73
74#LOCAL: main ant target:
75MAIN_TARGET=${MAIN_TARGET:="ot-junit-all"}
76
77#LOCAL: should OTDT and tests be built?
78DO_BUILD="true"
79
80#LOCAL: should the tests be run?
81DO_RUN="true"
82
Stephan Herrmann434a0842016-11-01 18:02:29 +010083case ${MAIN_TARGET} in
84 "ot-junit-run")
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010085 DO_BUILD="false"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010086 ;;
Stephan Herrmann434a0842016-11-01 18:02:29 +010087 "ot-compiler-build")
88 ;&
89 "ot-junit-build")
90 DO_RUN="false"
91 ;;
92esac
Stephan Herrmannd9a85732016-11-01 16:32:04 +010093
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010094# start working:
95
96test -d "$TMPDIR" || mkdir -p "$TMPDIR"
97test -d "$OT_TESTSUITE_DIR" || mkdir -p "$OT_TESTSUITE_DIR"
98cd "$OT_TESTSUITE_DIR"
99
100# cleanup previous:
101if [ "$DO_BUILD" == "true" ]
102then
103 rm -rf build-root
104 rm -rf test-root
105 rm -rf updateSite
106 rm -rf updateSiteTests
107 rm -rf updateSiteCompiler
108 rm -rf metadata
Stephan Herrmann434a0842016-11-01 18:02:29 +0100109 rm -rf ecj
Stephan Herrmannb6718c12016-11-01 13:13:07 +0100110else
111 rm -f test-root/eclipse/results/*
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100112fi
113
114# preload metadata for appending:
115if [ -f "${METADATA}/content.xml" ]
116then
117 mkdir -p metadata
118 cp ${METADATA}/*.xml metadata
119fi
120
121trap "echo Aborting by SIGTERM; cleanup; exit 130" INT
122
123# Assemble the Ant call:
124ANT_OPTIONS="${ANT_PROFILE} \
125 -Declipse-app.tgz=${ECLIPSE_SDK_TGZ} \
126 -Declipse.tests.zip=${ECLIPSE_TESTLIB_ZIP} \
127 -Declipse.sdk.qualifier=${SDK_QUALIFIER} \
128 -Dpublished.updates=${PUBLISHED_UPDATES} \
129 -Ddo.run.tests=${DO_RUN} \
130 -Ddo.build.all=${DO_BUILD} \
Stephan Herrmanne73f8852016-11-01 00:23:59 +0100131 -Dtest.tmpDir=${TEST_TMPDIR} \
Stephan Herrmanncf1ce3f2016-11-01 01:04:19 +0100132 -DfetchCacheLocation=${FETCH_CACHE_LOCATION} \
Stephan Herrmannd9a85732016-11-01 16:32:04 +0100133 -Dmap.file.path=${MAP_FILE_PATH} \
Stephan Herrmann74cc41d2016-11-01 16:33:39 +0100134 -D_hasSaxon.jar=true"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100135
136ANT_OPTS="-Xmx1024m"
137export ANT_OPTS
138
139CMD="nice -n ${NICE} ant -f ${BUILDFILE} ${ANT_OPTIONS} ${MAIN_TARGET}"
140
Stephan Herrmann423ec262016-11-01 00:11:19 +0100141echo "Running $CMD"
142eval "$CMD" < /dev/null
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100143
144trap - INT
145
146