blob: 3622e1374c689eab4d5c0e7f6d75a6a5653e96bf [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
Stephan Herrmanna740be42019-04-13 18:00:14 +020022# ECLIPSE_BOOT_TGZ archive file of the boot eclipse SDK build (full path)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010023# ECLIPSE_SDK_TGZ archive file of the base eclipse SDK build (full path)
24# ECLIPSE_TESTLIB_ZIP archive file of the eclipse test framework (full path)
25# PUBLISHED_UPDATES directory of previously published plugins&features
Stephan Herrmann434a0842016-11-01 18:02:29 +010026# FETCH_CACHE_LOCATION git working area holding caches for fetch
27# MAP_FILE_PATH path to the otdt.map file (original location of otdt.map.in)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010028# ANT_PROFILE configure the ant process
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010029# NICE niceness value for nice -n ${NICE}
30# =============================================================================
31# OUTPUT: Variables passed to the toplevel ant script
32# -----------------------------------------------------------------------------
33## As Environment Variables:
34## ANT_OPTS configure Ant
35## As Ant Arguments (from ANT_PROFILE):
36## -verbose configure Ant
37## As Java Properties:
Stephan Herrmanna740be42019-04-13 18:00:14 +020038## -Declipse-bot.tgz path of boot eclipse SDK
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010039## -Declipse-app.tgz path of eclipse SDK
40## -Declipse.tests.zip path of eclipse test framework
41## -Dpublished.updates path to previously published things
42## -Ddo.build.all true|false: should OTDT and tests be built?
43## -Ddo.run.tests true|false: should test be run?
Stephan Herrmann434a0842016-11-01 18:02:29 +010044## -DfetchCacheLocation git working area holding caches for fetch
45## -Dmap.file.path path to the otdt.map file (original location of otdt.map.in)
46## -D_hasSaxon.jar to prevent copying of saxon8.jar (was needed on build.eclipse.org)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010047# =============================================================================
48
49usage()
50{
51 echo "Usage:"
52 echo "$0 [-b|-nobuild]"
53 echo " -b: build OTDT only, no testing."
54 echo " -nobuild: don't build OTDT, directly invoke testing."
55}
56
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010057cleanup()
58{
Stephan Herrmann423ec262016-11-01 00:11:19 +010059 echo "cleanup(): Currently no cleanup is configured"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010060}
61
62_prefix=`dirname $0`
63_prefix=`readlink -f $_prefix`
64. "${_prefix}/otdt_prerequisites-hipp.sh"
65
66echo "=== Sourced otdt_prerequisites-hipp.sh ==="
67env
68echo "====================================="
69
70#LOCAL: log file:
71OT_SUITE_LOG=$TMPDIR/ot-testsuite.log
72
73# LOCAL: the initial ant build file:
74BUILDFILE="${_prefix}/run.xml"
75
76#LOCAL: main ant target:
77MAIN_TARGET=${MAIN_TARGET:="ot-junit-all"}
78
79#LOCAL: should OTDT and tests be built?
80DO_BUILD="true"
81
82#LOCAL: should the tests be run?
83DO_RUN="true"
84
Stephan Herrmann434a0842016-11-01 18:02:29 +010085case ${MAIN_TARGET} in
86 "ot-junit-run")
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010087 DO_BUILD="false"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010088 ;;
Stephan Herrmann434a0842016-11-01 18:02:29 +010089 "ot-compiler-build")
90 ;&
91 "ot-junit-build")
92 DO_RUN="false"
93 ;;
94esac
Stephan Herrmannd9a85732016-11-01 16:32:04 +010095
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010096# start working:
97
98test -d "$TMPDIR" || mkdir -p "$TMPDIR"
99test -d "$OT_TESTSUITE_DIR" || mkdir -p "$OT_TESTSUITE_DIR"
100cd "$OT_TESTSUITE_DIR"
101
102# cleanup previous:
103if [ "$DO_BUILD" == "true" ]
104then
105 rm -rf build-root
106 rm -rf test-root
107 rm -rf updateSite
108 rm -rf updateSiteTests
109 rm -rf updateSiteCompiler
110 rm -rf metadata
Stephan Herrmann434a0842016-11-01 18:02:29 +0100111 rm -rf ecj
Stephan Herrmannb6718c12016-11-01 13:13:07 +0100112else
113 rm -f test-root/eclipse/results/*
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100114fi
115
116# preload metadata for appending:
117if [ -f "${METADATA}/content.xml" ]
118then
119 mkdir -p metadata
120 cp ${METADATA}/*.xml metadata
121fi
122
123trap "echo Aborting by SIGTERM; cleanup; exit 130" INT
124
125# Assemble the Ant call:
126ANT_OPTIONS="${ANT_PROFILE} \
Stephan Herrmann5acccae2019-04-13 17:46:35 +0200127 -Declipse-boot.tgz=${ECLIPSE_BOOT_TGZ} \
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100128 -Declipse-app.tgz=${ECLIPSE_SDK_TGZ} \
129 -Declipse.tests.zip=${ECLIPSE_TESTLIB_ZIP} \
130 -Declipse.sdk.qualifier=${SDK_QUALIFIER} \
131 -Dpublished.updates=${PUBLISHED_UPDATES} \
132 -Ddo.run.tests=${DO_RUN} \
133 -Ddo.build.all=${DO_BUILD} \
Stephan Herrmanne73f8852016-11-01 00:23:59 +0100134 -Dtest.tmpDir=${TEST_TMPDIR} \
Stephan Herrmanncf1ce3f2016-11-01 01:04:19 +0100135 -DfetchCacheLocation=${FETCH_CACHE_LOCATION} \
Stephan Herrmannd9a85732016-11-01 16:32:04 +0100136 -Dmap.file.path=${MAP_FILE_PATH} \
Stephan Herrmann74cc41d2016-11-01 16:33:39 +0100137 -D_hasSaxon.jar=true"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100138
139ANT_OPTS="-Xmx1024m"
140export ANT_OPTS
141
142CMD="nice -n ${NICE} ant -f ${BUILDFILE} ${ANT_OPTIONS} ${MAIN_TARGET}"
143
Stephan Herrmann423ec262016-11-01 00:11:19 +0100144echo "Running $CMD"
145eval "$CMD" < /dev/null
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100146
147trap - INT
148
149