aboutsummaryrefslogtreecommitdiff
path: root/common/bin/test_builds.sh
blob: 911008020c9dd96414f6318955fa3453f94e246c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/bash

set -x
set -e

options="$*"
option="$1"

tmp=/tmp/test_builds.$$
rm -f -r ${tmp}
mkdir -p ${tmp}

errMessages=${tmp}/error_messages.txt

#######
# Error function
error() # message
{
   echo "ERROR: $1" | tee -a ${errMessages}
}
# Check errors
checkErrors()
{
    if [ -s ${errMessages} ] ; then
        cat ${errMessages}
	exit 1
    fi
}
#######

os="`uname -s`"
arch="`uname -p`"
make=make

if [ "${os}" = "SunOS" ] ; then
  make=gmake
  export J7="/opt/java/jdk1.7.0"
elif [ "${os}" = "Darwin" ] ; then
  export J7="/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home"
elif [ "${os}" = "Linux" -a "${arch}" = "x86_64" ] ; then
  export J7="/usr/lib/jvm/java-7-openjdk-amd64/"
else
  echo "What os/arch is this: ${os}/${arch}"
  exit 1
fi

# Must have a jdk7
if [ ! -d ${J7} ] ; then
  echo "No JDK7 found at: ${J7}"
  exit 1
fi

# What sources we use
fromroot="http://hg.openjdk.java.net/build-infra/jdk8"

# Where we do it
root="testbuilds"
mkdir -p ${root}

# Three areas, last three are cloned from first to insure sameness
t0=${root}/t0
t1=${root}/t1
t2=${root}/t2
t3=${root}/t3
repolist="${t0} ${t1} ${t2} ${t3}"

# Optional complete clobber
if [ "${option}" = "clobber" ] ; then
  for i in ${repolist} ; do
    rm -f -r ${i}
  done
fi

# Get top repos
if [ ! -d ${t0}/.hg ] ; then
  rm -f -r ${t0}
  hg clone ${fromroot} ${t0}
fi
for i in ${t1} ${t2} ${t3} ; do
  if [ ! -d ${i}/.hg ] ; then
    hg clone ${t0} ${i}
  fi
done

# Get repos updated
for i in ${repolist} ; do
  ( \
    set -e \
    && cd ${i} \
    && sh ./get_source.sh \
    || error "Cannot get source" \
  ) 2>&1 | tee ${i}.get_source.txt
  checkErrors
done

# Optional clean
if [ "${option}" = "clean" ] ; then
  for i in ${repolist} ; do
    rm -f -r ${i}/build
    rm -f -r ${i}/*/build
    rm -f -r ${i}/*/dist
  done
fi

# Check changes on working set files
for i in ${repolist} ; do
  ( \
    set -e \
    && cd ${i} \
    && sh ./make/scripts/hgforest.sh status \
    || error "Cannot check status" \
  ) 2>&1 | tee ${i}.hg.status.txt
  checkErrors
done

# Configure for build-infra building
for i in ${t1} ${t2} ; do
  ( \
    set -e \
    && cd ${i}/common/makefiles \
    && sh ../autoconf/configure --with-boot-jdk=${J7} \
    || error "Cannot configure" \
  ) 2>&1 | tee ${i}.config.txt
  checkErrors
done

# Do build-infra builds
for i in ${t1} ${t2} ; do
  ( \
    set -e \
    && cd ${i}/common/makefiles \
    && ${make}  \
      FULL_VERSION:=1.8.0-internal-b00 \
      JRE_RELEASE_VERSION:=1.8.0-internal-b00 \
      USER_RELEASE_SUFFIX:=compare \
      RELEASE:=1.8.0-internal \
      VERBOSE= \
      LIBARCH= \
         all images \
    || error "Cannot build" \
  ) 2>&1 | tee ${i}.build.txt
  checkErrors
done

# Compare build-infra builds
( \
  sh ${t0}/common/bin/compareimage.sh \
    ${t1}/build/*/images/j2sdk-image \
    ${t2}/build/*/images/j2sdk-image \
    || error "Cannot compare" \
) 2>&1 | tee ${root}/build-infra-comparison.txt
checkErrors

# Do old build
unset JAVA_HOME
export ALT_BOOTDIR="${J7}"
( \
  cd ${t3} \
  && ${make} FULL_VERSION='"1.8.0-internal" sanity \
  || error "Cannot sanity" \
) 2>&1 | tee ${t3}.sanity.txt
checkErrors
( \
  cd ${t3} \
  && ${make} \
      FULL_VERSION='"1.8.0-internal" \
      JRE_RELEASE_VERSION:=1.8.0-internal-b00 \
      USER_RELEASE_SUFFIX:=compare \
      RELEASE:=1.8.0-internal \
  || error "Cannot build old way" \
) 2>&1 | tee ${t3}.build.txt
checkErrors

# Compare old build to build-infra build 
( \
  sh ${t0}/common/bin/compareimage.sh \
    ${t3}/build/*/j2sdk-image \
    ${t1}/build/*/images/j2sdk-image \
    || error "Cannot compare" \
) 2>&1 | tee ${root}/build-comparison.txt
checkErrors

exit 0