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