Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 1 | #! /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 Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 21 | # SDK_QUALIFIER build qualifier of the base eclipse SDK |
Stephan Herrmann | a740be4 | 2019-04-13 18:00:14 +0200 | [diff] [blame] | 22 | # ECLIPSE_BOOT_TGZ archive file of the boot eclipse SDK build (full path) |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 23 | # 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 Herrmann | 434a084 | 2016-11-01 18:02:29 +0100 | [diff] [blame] | 26 | # 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 Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 28 | # ANT_PROFILE configure the ant process |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 29 | # 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 Herrmann | a740be4 | 2019-04-13 18:00:14 +0200 | [diff] [blame] | 38 | ## -Declipse-bot.tgz path of boot eclipse SDK |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 39 | ## -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 Herrmann | 434a084 | 2016-11-01 18:02:29 +0100 | [diff] [blame] | 44 | ## -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 Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 47 | # ============================================================================= |
| 48 | |
| 49 | usage() |
| 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 Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 57 | cleanup() |
| 58 | { |
Stephan Herrmann | 423ec26 | 2016-11-01 00:11:19 +0100 | [diff] [blame] | 59 | echo "cleanup(): Currently no cleanup is configured" |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | _prefix=`dirname $0` |
| 63 | _prefix=`readlink -f $_prefix` |
| 64 | . "${_prefix}/otdt_prerequisites-hipp.sh" |
| 65 | |
| 66 | echo "=== Sourced otdt_prerequisites-hipp.sh ===" |
| 67 | env |
| 68 | echo "=====================================" |
| 69 | |
| 70 | #LOCAL: log file: |
| 71 | OT_SUITE_LOG=$TMPDIR/ot-testsuite.log |
| 72 | |
| 73 | # LOCAL: the initial ant build file: |
| 74 | BUILDFILE="${_prefix}/run.xml" |
| 75 | |
| 76 | #LOCAL: main ant target: |
| 77 | MAIN_TARGET=${MAIN_TARGET:="ot-junit-all"} |
| 78 | |
| 79 | #LOCAL: should OTDT and tests be built? |
| 80 | DO_BUILD="true" |
| 81 | |
| 82 | #LOCAL: should the tests be run? |
| 83 | DO_RUN="true" |
| 84 | |
Stephan Herrmann | 434a084 | 2016-11-01 18:02:29 +0100 | [diff] [blame] | 85 | case ${MAIN_TARGET} in |
| 86 | "ot-junit-run") |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 87 | DO_BUILD="false" |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 88 | ;; |
Stephan Herrmann | 434a084 | 2016-11-01 18:02:29 +0100 | [diff] [blame] | 89 | "ot-compiler-build") |
| 90 | ;& |
| 91 | "ot-junit-build") |
| 92 | DO_RUN="false" |
| 93 | ;; |
| 94 | esac |
Stephan Herrmann | d9a8573 | 2016-11-01 16:32:04 +0100 | [diff] [blame] | 95 | |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 96 | # start working: |
| 97 | |
| 98 | test -d "$TMPDIR" || mkdir -p "$TMPDIR" |
| 99 | test -d "$OT_TESTSUITE_DIR" || mkdir -p "$OT_TESTSUITE_DIR" |
| 100 | cd "$OT_TESTSUITE_DIR" |
| 101 | |
| 102 | # cleanup previous: |
| 103 | if [ "$DO_BUILD" == "true" ] |
| 104 | then |
| 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 Herrmann | 434a084 | 2016-11-01 18:02:29 +0100 | [diff] [blame] | 111 | rm -rf ecj |
Stephan Herrmann | b6718c1 | 2016-11-01 13:13:07 +0100 | [diff] [blame] | 112 | else |
| 113 | rm -f test-root/eclipse/results/* |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 114 | fi |
| 115 | |
| 116 | # preload metadata for appending: |
| 117 | if [ -f "${METADATA}/content.xml" ] |
| 118 | then |
| 119 | mkdir -p metadata |
| 120 | cp ${METADATA}/*.xml metadata |
| 121 | fi |
| 122 | |
| 123 | trap "echo Aborting by SIGTERM; cleanup; exit 130" INT |
| 124 | |
| 125 | # Assemble the Ant call: |
| 126 | ANT_OPTIONS="${ANT_PROFILE} \ |
Stephan Herrmann | 5acccae | 2019-04-13 17:46:35 +0200 | [diff] [blame] | 127 | -Declipse-boot.tgz=${ECLIPSE_BOOT_TGZ} \ |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 128 | -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 Herrmann | e73f885 | 2016-11-01 00:23:59 +0100 | [diff] [blame] | 134 | -Dtest.tmpDir=${TEST_TMPDIR} \ |
Stephan Herrmann | cf1ce3f | 2016-11-01 01:04:19 +0100 | [diff] [blame] | 135 | -DfetchCacheLocation=${FETCH_CACHE_LOCATION} \ |
Stephan Herrmann | d9a8573 | 2016-11-01 16:32:04 +0100 | [diff] [blame] | 136 | -Dmap.file.path=${MAP_FILE_PATH} \ |
Stephan Herrmann | 74cc41d | 2016-11-01 16:33:39 +0100 | [diff] [blame] | 137 | -D_hasSaxon.jar=true" |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 138 | |
| 139 | ANT_OPTS="-Xmx1024m" |
| 140 | export ANT_OPTS |
| 141 | |
| 142 | CMD="nice -n ${NICE} ant -f ${BUILDFILE} ${ANT_OPTIONS} ${MAIN_TARGET}" |
| 143 | |
Stephan Herrmann | 423ec26 | 2016-11-01 00:11:19 +0100 | [diff] [blame] | 144 | echo "Running $CMD" |
| 145 | eval "$CMD" < /dev/null |
Stephan Herrmann | f80b55d | 2016-10-31 23:56:48 +0100 | [diff] [blame] | 146 | |
| 147 | trap - INT |
| 148 | |
| 149 | |