Fri, 01 Feb 2013 11:22:41 +0100
Merge
aoqi@0 | 1 | #!/bin/bash |
aoqi@0 | 2 | |
aoqi@0 | 3 | set -x |
aoqi@0 | 4 | set -e |
aoqi@0 | 5 | |
aoqi@0 | 6 | options="$*" |
aoqi@0 | 7 | option="$1" |
aoqi@0 | 8 | |
aoqi@0 | 9 | tmp=/tmp/test_builds.$$ |
aoqi@0 | 10 | rm -f -r ${tmp} |
aoqi@0 | 11 | mkdir -p ${tmp} |
aoqi@0 | 12 | |
aoqi@0 | 13 | errMessages=${tmp}/error_messages.txt |
aoqi@0 | 14 | |
aoqi@0 | 15 | ####### |
aoqi@0 | 16 | # Error function |
aoqi@0 | 17 | error() # message |
aoqi@0 | 18 | { |
aoqi@0 | 19 | echo "ERROR: $1" | tee -a ${errMessages} |
aoqi@0 | 20 | } |
aoqi@0 | 21 | # Check errors |
aoqi@0 | 22 | checkErrors() |
aoqi@0 | 23 | { |
aoqi@0 | 24 | if [ -s ${errMessages} ] ; then |
aoqi@0 | 25 | cat ${errMessages} |
aoqi@0 | 26 | exit 1 |
aoqi@0 | 27 | fi |
aoqi@0 | 28 | } |
aoqi@0 | 29 | ####### |
aoqi@0 | 30 | |
aoqi@0 | 31 | os="`uname -s`" |
aoqi@0 | 32 | arch="`uname -p`" |
aoqi@0 | 33 | make=make |
aoqi@0 | 34 | |
aoqi@0 | 35 | if [ "${os}" = "SunOS" ] ; then |
aoqi@0 | 36 | make=gmake |
aoqi@0 | 37 | export J7="/opt/java/jdk1.7.0" |
aoqi@0 | 38 | elif [ "${os}" = "Darwin" ] ; then |
aoqi@0 | 39 | export J7="/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home" |
aoqi@0 | 40 | elif [ "${os}" = "Linux" -a "${arch}" = "x86_64" ] ; then |
aoqi@0 | 41 | export J7="/usr/lib/jvm/java-7-openjdk-amd64/" |
aoqi@0 | 42 | else |
aoqi@0 | 43 | echo "What os/arch is this: ${os}/${arch}" |
aoqi@0 | 44 | exit 1 |
aoqi@0 | 45 | fi |
aoqi@0 | 46 | |
aoqi@0 | 47 | # Must have a jdk7 |
aoqi@0 | 48 | if [ ! -d ${J7} ] ; then |
aoqi@0 | 49 | echo "No JDK7 found at: ${J7}" |
aoqi@0 | 50 | exit 1 |
aoqi@0 | 51 | fi |
aoqi@0 | 52 | |
aoqi@0 | 53 | # What sources we use |
aoqi@0 | 54 | fromroot="http://hg.openjdk.java.net/build-infra/jdk8" |
aoqi@0 | 55 | |
aoqi@0 | 56 | # Where we do it |
aoqi@0 | 57 | root="testbuilds" |
aoqi@0 | 58 | mkdir -p ${root} |
aoqi@0 | 59 | |
aoqi@0 | 60 | # Three areas, last three are cloned from first to insure sameness |
aoqi@0 | 61 | t0=${root}/t0 |
aoqi@0 | 62 | t1=${root}/t1 |
aoqi@0 | 63 | t2=${root}/t2 |
aoqi@0 | 64 | t3=${root}/t3 |
aoqi@0 | 65 | repolist="${t0} ${t1} ${t2} ${t3}" |
aoqi@0 | 66 | |
aoqi@0 | 67 | # Optional complete clobber |
aoqi@0 | 68 | if [ "${option}" = "clobber" ] ; then |
aoqi@0 | 69 | for i in ${repolist} ; do |
aoqi@0 | 70 | rm -f -r ${i} |
aoqi@0 | 71 | done |
aoqi@0 | 72 | fi |
aoqi@0 | 73 | |
aoqi@0 | 74 | # Get top repos |
aoqi@0 | 75 | if [ ! -d ${t0}/.hg ] ; then |
aoqi@0 | 76 | rm -f -r ${t0} |
aoqi@0 | 77 | hg clone ${fromroot} ${t0} |
aoqi@0 | 78 | fi |
aoqi@0 | 79 | for i in ${t1} ${t2} ${t3} ; do |
aoqi@0 | 80 | if [ ! -d ${i}/.hg ] ; then |
aoqi@0 | 81 | hg clone ${t0} ${i} |
aoqi@0 | 82 | fi |
aoqi@0 | 83 | done |
aoqi@0 | 84 | |
aoqi@0 | 85 | # Get repos updated |
aoqi@0 | 86 | for i in ${repolist} ; do |
aoqi@0 | 87 | ( \ |
aoqi@0 | 88 | set -e \ |
aoqi@0 | 89 | && cd ${i} \ |
aoqi@0 | 90 | && sh ./get_source.sh \ |
aoqi@0 | 91 | || error "Cannot get source" \ |
aoqi@0 | 92 | ) 2>&1 | tee ${i}.get_source.txt |
aoqi@0 | 93 | checkErrors |
aoqi@0 | 94 | done |
aoqi@0 | 95 | |
aoqi@0 | 96 | # Optional clean |
aoqi@0 | 97 | if [ "${option}" = "clean" ] ; then |
aoqi@0 | 98 | for i in ${repolist} ; do |
aoqi@0 | 99 | rm -f -r ${i}/build |
aoqi@0 | 100 | rm -f -r ${i}/*/build |
aoqi@0 | 101 | rm -f -r ${i}/*/dist |
aoqi@0 | 102 | done |
aoqi@0 | 103 | fi |
aoqi@0 | 104 | |
aoqi@0 | 105 | # Check changes on working set files |
aoqi@0 | 106 | for i in ${repolist} ; do |
aoqi@0 | 107 | ( \ |
aoqi@0 | 108 | set -e \ |
aoqi@0 | 109 | && cd ${i} \ |
aoqi@0 | 110 | && sh ./make/scripts/hgforest.sh status \ |
aoqi@0 | 111 | || error "Cannot check status" \ |
aoqi@0 | 112 | ) 2>&1 | tee ${i}.hg.status.txt |
aoqi@0 | 113 | checkErrors |
aoqi@0 | 114 | done |
aoqi@0 | 115 | |
aoqi@0 | 116 | # Configure for build-infra building |
aoqi@0 | 117 | for i in ${t1} ${t2} ; do |
aoqi@0 | 118 | ( \ |
aoqi@0 | 119 | set -e \ |
aoqi@0 | 120 | && cd ${i}/common/makefiles \ |
aoqi@0 | 121 | && sh ../autoconf/configure --with-boot-jdk=${J7} \ |
aoqi@0 | 122 | || error "Cannot configure" \ |
aoqi@0 | 123 | ) 2>&1 | tee ${i}.config.txt |
aoqi@0 | 124 | checkErrors |
aoqi@0 | 125 | done |
aoqi@0 | 126 | |
aoqi@0 | 127 | # Do build-infra builds |
aoqi@0 | 128 | for i in ${t1} ${t2} ; do |
aoqi@0 | 129 | ( \ |
aoqi@0 | 130 | set -e \ |
aoqi@0 | 131 | && cd ${i}/common/makefiles \ |
aoqi@0 | 132 | && ${make} \ |
aoqi@0 | 133 | FULL_VERSION:=1.8.0-internal-b00 \ |
aoqi@0 | 134 | JRE_RELEASE_VERSION:=1.8.0-internal-b00 \ |
aoqi@0 | 135 | USER_RELEASE_SUFFIX:=compare \ |
aoqi@0 | 136 | RELEASE:=1.8.0-internal \ |
aoqi@0 | 137 | VERBOSE= \ |
aoqi@0 | 138 | LIBARCH= \ |
aoqi@0 | 139 | all images \ |
aoqi@0 | 140 | || error "Cannot build" \ |
aoqi@0 | 141 | ) 2>&1 | tee ${i}.build.txt |
aoqi@0 | 142 | checkErrors |
aoqi@0 | 143 | done |
aoqi@0 | 144 | |
aoqi@0 | 145 | # Compare build-infra builds |
aoqi@0 | 146 | ( \ |
aoqi@0 | 147 | sh ${t0}/common/bin/compareimage.sh \ |
aoqi@0 | 148 | ${t1}/build/*/images/j2sdk-image \ |
aoqi@0 | 149 | ${t2}/build/*/images/j2sdk-image \ |
aoqi@0 | 150 | || error "Cannot compare" \ |
aoqi@0 | 151 | ) 2>&1 | tee ${root}/build-infra-comparison.txt |
aoqi@0 | 152 | checkErrors |
aoqi@0 | 153 | |
aoqi@0 | 154 | # Do old build |
aoqi@0 | 155 | unset JAVA_HOME |
aoqi@0 | 156 | export ALT_BOOTDIR="${J7}" |
aoqi@0 | 157 | ( \ |
aoqi@0 | 158 | cd ${t3} \ |
aoqi@0 | 159 | && ${make} FULL_VERSION='"1.8.0-internal" sanity \ |
aoqi@0 | 160 | || error "Cannot sanity" \ |
aoqi@0 | 161 | ) 2>&1 | tee ${t3}.sanity.txt |
aoqi@0 | 162 | checkErrors |
aoqi@0 | 163 | ( \ |
aoqi@0 | 164 | cd ${t3} \ |
aoqi@0 | 165 | && ${make} \ |
aoqi@0 | 166 | FULL_VERSION='"1.8.0-internal" \ |
aoqi@0 | 167 | JRE_RELEASE_VERSION:=1.8.0-internal-b00 \ |
aoqi@0 | 168 | USER_RELEASE_SUFFIX:=compare \ |
aoqi@0 | 169 | RELEASE:=1.8.0-internal \ |
aoqi@0 | 170 | || error "Cannot build old way" \ |
aoqi@0 | 171 | ) 2>&1 | tee ${t3}.build.txt |
aoqi@0 | 172 | checkErrors |
aoqi@0 | 173 | |
aoqi@0 | 174 | # Compare old build to build-infra build |
aoqi@0 | 175 | ( \ |
aoqi@0 | 176 | sh ${t0}/common/bin/compareimage.sh \ |
aoqi@0 | 177 | ${t3}/build/*/j2sdk-image \ |
aoqi@0 | 178 | ${t1}/build/*/images/j2sdk-image \ |
aoqi@0 | 179 | || error "Cannot compare" \ |
aoqi@0 | 180 | ) 2>&1 | tee ${root}/build-comparison.txt |
aoqi@0 | 181 | checkErrors |
aoqi@0 | 182 | |
aoqi@0 | 183 | exit 0 |
aoqi@0 | 184 |