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