common/bin/compare.sh

Mon, 16 Apr 2018 00:48:00 -0700

author
kevinw
date
Mon, 16 Apr 2018 00:48:00 -0700
changeset 2215
7a73b8b4ac8a
parent 912
a667caba1e84
child 2316
64a3eeabf6e5
permissions
-rw-r--r--

8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
Reviewed-by: erikj, ihse

ohair@494 1 #!/bin/bash
ohair@494 2 #
katleman@685 3 # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
ohair@494 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@494 5 #
ohair@494 6 # This code is free software; you can redistribute it and/or modify it
ohair@494 7 # under the terms of the GNU General Public License version 2 only, as
ohair@494 8 # published by the Free Software Foundation.
ohair@494 9 #
ohair@494 10 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@494 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@494 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@494 13 # version 2 for more details (a copy is included in the LICENSE file that
ohair@494 14 # accompanied this code).
ohair@494 15 #
ohair@494 16 # You should have received a copy of the GNU General Public License version
ohair@494 17 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@494 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@494 19 #
ohair@494 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@494 21 # or visit www.oracle.com if you need additional information or have any
ohair@494 22 # questions.
ohair@494 23 #
ohair@494 24
ohair@494 25 # This script is processed by configure before it's usable. It is run from
ohair@494 26 # the root of the build directory.
ohair@494 27
ohair@494 28
ohair@494 29 ##########################################################################################
ohair@494 30
ohair@494 31 # Check that we are run via the wrapper generated by configure
ohair@494 32 if [ -z "$SRC_ROOT" ]; then
ohair@494 33 echo "Error: You must run this script using build/[conf]/compare.sh"
ohair@494 34 exit 1
ohair@494 35 fi
ohair@494 36
ohair@494 37 if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
ohair@494 38 FULLDUMP_CMD="$OTOOL -v -V -h -X -t -d"
ohair@494 39 LDD_CMD="$OTOOL -L"
ohair@494 40 DIS_CMD="$OTOOL -v -t"
ohair@494 41 STAT_PRINT_SIZE="-f %z"
ohair@494 42 elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
ohair@494 43 FULLDUMP_CMD="$DUMPBIN -all"
ohair@494 44 LDD_CMD="$DUMPBIN -dependants | $GREP .dll"
ohair@494 45 DIS_CMD="$DUMPBIN -disasm:nobytes"
ohair@494 46 STAT_PRINT_SIZE="-c %s"
ohair@494 47 else
ohair@494 48 FULLDUMP_CMD="$READELF -a"
ohair@494 49 LDD_CMD="$LDD"
ohair@494 50 DIS_CMD="$OBJDUMP -d"
ohair@494 51 STAT_PRINT_SIZE="-c %s"
ohair@494 52 fi
ohair@494 53
ohair@494 54 UNARCHIVE="$UNZIP -q"
ohair@494 55
ohair@494 56 COMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/common/bin/compare_exceptions.sh.incl"
ohair@494 57 if [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
ohair@494 58 echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE"
ohair@494 59 exit 1
ohair@494 60 fi
ohair@494 61 # Include exception definitions
ohair@494 62 . "$COMPARE_EXCEPTIONS_INCLUDE"
ohair@494 63
ohair@494 64 ##########################################################################################
ohair@494 65 # Compare text files and ignore specific differences:
ohair@494 66 #
ohair@494 67 # * Timestamps in Java sources generated by idl2java
ohair@494 68 # * Sorting order and cleanup style in .properties files
ohair@494 69
ohair@494 70 diff_text() {
ohair@494 71 OTHER_FILE=$1
ohair@494 72 THIS_FILE=$2
ohair@494 73
ohair@494 74 SUFFIX="${THIS_FILE##*.}"
ohair@494 75
ohair@494 76 TMP=1
ohair@494 77
ohair@494 78 if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
ihse@808 79 TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
ohair@494 80 $GREP '^[<>]' | \
ohair@494 81 $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
ohair@494 82 -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
ohair@494 83 fi
ohair@494 84 if test "x$SUFFIX" = "xjava"; then
ihse@808 85 TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
ohair@494 86 $GREP '^[<>]' | \
ohair@494 87 $SED -e '/[<>] \* from.*\.idl/d' \
ohair@494 88 -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
ohair@494 89 -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \
ohair@494 90 -e '/\/\/ Generated from input file.*/d' \
ohair@494 91 -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \
ohair@494 92 -e '/\/\/ java GenerateCharacter.*/d')
ohair@494 93 fi
ohair@494 94 # Ignore date strings in class files.
ohair@494 95 # On Macosx the system sources for generated java classes produce different output on
ohair@494 96 # consequtive invokations seemingly randomly.
ohair@494 97 # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
ohair@494 98 if test "x$SUFFIX" = "xclass"; then
ohair@494 99 # To improve performance when large diffs are found, do a rough filtering of classes
ohair@494 100 # elibeble for these exceptions
erikj@564 101 if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
erikj@564 102 -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
erikj@564 103 -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
ohair@494 104 $JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap
ohair@494 105 $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
ohair@494 106 TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
ohair@494 107 $GREP '^[<>]' | \
ohair@494 108 $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
erikj@564 109 -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
ohair@494 110 -e '/[<>].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
ohair@494 111 -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
ohair@494 112 -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
ohair@494 113 fi
ohair@494 114 fi
ohair@494 115 if test "x$SUFFIX" = "xproperties"; then
erikj@565 116 # Run through nawk to add possibly missing newline at end of file.
kevinw@2215 117 $CAT $OTHER_FILE | $NAWK '{ print }' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
erikj@565 118 # Disable this exception since we aren't changing the properties cleaning method yet.
erikj@565 119 # $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
erikj@565 120 # | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
erikj@565 121 # | $SED -e '/^#/d' -e '/^$/d' \
erikj@565 122 # -e :a -e '/\\$/N; s/\\\n//; ta' \
erikj@565 123 # -e 's/^[ \t]*//;s/[ \t]*$//' \
ihse@808 124 # -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
ihse@808 125 TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
ohair@494 126 fi
ohair@494 127 if test -n "$TMP"; then
ohair@494 128 echo Files $OTHER_FILE and $THIS_FILE differ
ohair@494 129 return 1
ohair@494 130 fi
ohair@494 131
ohair@494 132 return 0
ohair@494 133 }
ohair@494 134
ohair@494 135 ##########################################################################################
ohair@494 136 # Compare directory structure
ohair@494 137
ohair@494 138 compare_dirs() {
ohair@494 139 THIS_DIR=$1
ohair@494 140 OTHER_DIR=$2
ohair@494 141 WORK_DIR=$3
ohair@494 142
ohair@494 143 mkdir -p $WORK_DIR
ohair@494 144
ohair@494 145 (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other)
ohair@494 146 (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
ohair@494 147
ohair@494 148 $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_other > $WORK_DIR/dirs_diff
ohair@494 149
ohair@494 150 echo -n Directory structure...
ohair@494 151 if [ -s $WORK_DIR/dirs_diff ]; then
ohair@494 152 echo Differences found.
ohair@494 153 REGRESSIONS=true
ohair@494 154 # Differences in directories found.
ohair@494 155 ONLY_OTHER=$($GREP '<' $WORK_DIR/dirs_diff)
ohair@494 156 if [ "$ONLY_OTHER" ]; then
ohair@494 157 echo Only in $OTHER
ohair@494 158 $GREP '<' $WORK_DIR/dirs_diff | $SED 's|< ./| |g'
ohair@494 159 fi
ohair@494 160 ONLY_THIS=$($GREP '>' $WORK_DIR/dirs_diff)
ohair@494 161 if [ "$ONLY_THIS" ]; then
ohair@494 162 echo Only in $THIS
ohair@494 163 $GREP '>' $WORK_DIR/dirs_diff | $SED 's|> ./| |g'
ohair@494 164 fi
ohair@494 165 else
ohair@494 166 echo Identical!
ohair@494 167 fi
ohair@494 168 }
ohair@494 169
ohair@494 170
ohair@494 171 ##########################################################################################
ohair@494 172 # Compare file structure
ohair@494 173
ohair@494 174 compare_files() {
ohair@494 175 THIS_DIR=$1
ohair@494 176 OTHER_DIR=$2
ohair@494 177 WORK_DIR=$3
ohair@494 178
ohair@494 179 $MKDIR -p $WORK_DIR
ohair@494 180
ohair@494 181 (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other)
ohair@494 182 (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this)
ohair@494 183
ohair@494 184 $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff
ohair@494 185
ohair@494 186 echo -n File names...
ohair@494 187 if [ -s $WORK_DIR/files_diff ]; then
ohair@494 188 echo Differences found.
ohair@494 189 REGRESSIONS=true
ohair@494 190 # Differences in files found.
ohair@494 191 ONLY_OTHER=$($GREP '<' $WORK_DIR/files_diff)
ohair@494 192 if [ "$ONLY_OTHER" ]; then
ohair@494 193 echo Only in $OTHER
ohair@494 194 $GREP '<' $WORK_DIR/files_diff | $SED 's|< ./| |g'
ohair@494 195 fi
ohair@494 196 ONLY_THIS=$($GREP '>' $WORK_DIR/files_diff)
ohair@494 197 if [ "$ONLY_THIS" ]; then
ohair@494 198 echo Only in $THIS
ohair@494 199 $GREP '>' $WORK_DIR/files_diff | $SED 's|> ./| |g'
ohair@494 200 fi
ohair@494 201 else
ohair@494 202 echo Identical!
ohair@494 203 fi
ohair@494 204 }
ohair@494 205
ohair@494 206
ohair@494 207 ##########################################################################################
ohair@494 208 # Compare permissions
ohair@494 209
ohair@494 210 compare_permissions() {
ohair@494 211 THIS_DIR=$1
ohair@494 212 OTHER_DIR=$2
ohair@494 213 WORK_DIR=$3
ohair@494 214
ohair@494 215 mkdir -p $WORK_DIR
ohair@494 216
ohair@494 217 echo -n Permissions...
ohair@494 218 found=""
ohair@494 219 for f in `cd $OTHER_DIR && $FIND . -type f`
ohair@494 220 do
ohair@494 221 if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
ohair@494 222 if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
ohair@494 223 OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
ohair@494 224 TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
ohair@494 225 if [ "$OP" != "$TP" ]
ohair@494 226 then
ohair@494 227 if [ -z "$found" ]; then echo ; found="yes"; fi
ohair@494 228 $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
ohair@494 229 fi
ohair@494 230 done
ohair@494 231 if [ -z "$found" ]; then
ohair@494 232 echo "Identical!"
ohair@494 233 else
ohair@494 234 REGRESSIONS=true
ohair@494 235 fi
ohair@494 236 }
ohair@494 237
ohair@494 238 ##########################################################################################
ohair@494 239 # Compare file command output
ohair@494 240
ohair@494 241 compare_file_types() {
ohair@494 242 THIS_DIR=$1
ohair@494 243 OTHER_DIR=$2
ohair@494 244 WORK_DIR=$3
ohair@494 245
ohair@494 246 $MKDIR -p $WORK_DIR
ohair@494 247
ohair@494 248 echo -n File types...
ohair@494 249 found=""
ohair@494 250 for f in `cd $OTHER_DIR && $FIND . ! -type d`
ohair@494 251 do
ohair@494 252 if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
ohair@494 253 if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
ohair@494 254 OF=`cd ${OTHER_DIR} && $FILE -h $f`
ohair@494 255 TF=`cd ${THIS_DIR} && $FILE -h $f`
ohair@494 256 if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
ohair@494 257 then
ohair@494 258 if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
ohair@494 259 then
ohair@494 260 # the way we produces zip-files make it so that directories are stored in old file
ohair@494 261 # but not in new (only files with full-path)
ohair@494 262 # this makes file-5.09 report them as different
ohair@494 263 continue;
ohair@494 264 fi
ohair@494 265 fi
ohair@494 266
ohair@494 267 if [ "$OF" != "$TF" ]
ohair@494 268 then
ohair@494 269 if [ -z "$found" ]; then echo ; found="yes"; fi
ohair@494 270 $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
ohair@494 271 fi
ohair@494 272 done
ohair@494 273 if [ -z "$found" ]; then
ohair@494 274 echo "Identical!"
ohair@494 275 else
ohair@494 276 REGRESSIONS=true
ohair@494 277 fi
ohair@494 278 }
ohair@494 279
ohair@494 280 ##########################################################################################
ohair@494 281 # Compare the rest of the files
ohair@494 282
ohair@494 283 compare_general_files() {
ohair@494 284 THIS_DIR=$1
ohair@494 285 OTHER_DIR=$2
ohair@494 286 WORK_DIR=$3
ohair@494 287
ohair@494 288 GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
ohair@494 289 ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
ohair@494 290 ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
ohair@494 291 ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
tbell@510 292 ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
ohair@494 293 | $GREP -v "./bin/" | $SORT | $FILTER)
ohair@494 294
ohair@494 295 echo General files...
ohair@494 296 for f in $GENERAL_FILES
ohair@494 297 do
ohair@494 298 if [ -e $OTHER_DIR/$f ]; then
erikj@518 299 SUFFIX="${f##*.}"
ohair@494 300 if [ "$(basename $f)" = "release" ]; then
ohair@494 301 # Ignore differences in change numbers in release file.
ohair@494 302 OTHER_FILE=$WORK_DIR/$f.other
ohair@494 303 THIS_FILE=$WORK_DIR/$f.this
ohair@494 304 $MKDIR -p $(dirname $OTHER_FILE)
ohair@494 305 $MKDIR -p $(dirname $THIS_FILE)
ohair@494 306 $CAT $OTHER_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $OTHER_FILE
ohair@494 307 $CAT $THIS_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $THIS_FILE
erikj@518 308 elif [ "x$SUFFIX" = "xhtml" ]; then
erikj@518 309 # Ignore time stamps in docs files
erikj@518 310 OTHER_FILE=$WORK_DIR/$f.other
erikj@518 311 THIS_FILE=$WORK_DIR/$f.this
erikj@518 312 $MKDIR -p $(dirname $OTHER_FILE)
erikj@518 313 $MKDIR -p $(dirname $THIS_FILE)
erikj@564 314 #Note that | doesn't work on mac sed.
erikj@518 315 $CAT $OTHER_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
erikj@518 316 -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
erikj@564 317 -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
erikj@564 318 -e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
erikj@518 319 -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
erikj@518 320 > $OTHER_FILE
erikj@518 321 $CAT $THIS_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
erikj@518 322 -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
erikj@564 323 -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [12][0-9]* [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/(removed)/' \
erikj@564 324 -e 's/[A-Z][a-z]* [A-Z][a-z]* [0-9][0-9] [0-9][0-9:]* [A-Z][A-Z]* [12][0-9]*/(removed)/' \
erikj@518 325 -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
erikj@518 326 > $THIS_FILE
ohair@494 327 else
ohair@494 328 OTHER_FILE=$OTHER_DIR/$f
ohair@494 329 THIS_FILE=$THIS_DIR/$f
ohair@494 330 fi
ohair@494 331 DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1)
ohair@494 332 if [ -n "$DIFF_OUT" ]; then
ohair@494 333 echo $f
ohair@494 334 REGRESSIONS=true
ohair@494 335 if [ "$SHOW_DIFFS" = "true" ]; then
ohair@494 336 echo "$DIFF_OUT"
ohair@494 337 fi
ohair@494 338 fi
ohair@494 339 fi
ohair@494 340 done
ohair@494 341
ohair@494 342
ohair@494 343 }
ohair@494 344
ohair@494 345 ##########################################################################################
ohair@494 346 # Compare zip file
ohair@494 347
ohair@494 348 compare_zip_file() {
ohair@494 349 THIS_DIR=$1
ohair@494 350 OTHER_DIR=$2
ohair@494 351 WORK_DIR=$3
ohair@494 352 ZIP_FILE=$4
erikj@601 353 # Optionally provide different name for other zipfile
erikj@601 354 OTHER_ZIP_FILE=$5
ohair@494 355
ohair@494 356 THIS_ZIP=$THIS_DIR/$ZIP_FILE
erikj@601 357 if [ -n "$OTHER_ZIP_FILE" ]; then
erikj@601 358 OTHER_ZIP=$OTHER_DIR/$OTHER_ZIP_FILE
erikj@601 359 else
erikj@601 360 OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
erikj@601 361 fi
ohair@494 362
ohair@494 363 THIS_SUFFIX="${THIS_ZIP##*.}"
ohair@494 364 OTHER_SUFFIX="${OTHER_ZIP##*.}"
ohair@494 365 if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
ohair@494 366 echo The files do not have the same suffix type!
ohair@494 367 return 2
ohair@494 368 fi
ohair@494 369
ohair@494 370 TYPE="$THIS_SUFFIX"
ohair@494 371
ohair@494 372 if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null
ohair@494 373 then
ohair@494 374 return 0
ohair@494 375 fi
ohair@494 376 # Not quite identical, the might still contain the same data.
ohair@494 377 # Unpack the jar/zip files in temp dirs
ohair@494 378
ohair@494 379 THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
ohair@494 380 OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
ohair@494 381 $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
ohair@494 382 $MKDIR -p $THIS_UNZIPDIR
ohair@494 383 $MKDIR -p $OTHER_UNZIPDIR
ohair@494 384 (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
ohair@494 385 (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
ohair@494 386
erikj@502 387 # Find all archives inside and unzip them as well to compare the contents rather than
erikj@564 388 # the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
erikj@564 389 EXCEPTIONS="pie.jar.pack.gz"
erikj@564 390 for pack in $($FIND $THIS_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do
erikj@502 391 ($UNPACK200 $pack $pack.jar)
erikj@502 392 # Filter out the unzipped archives from the diff below.
erikj@502 393 EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
erikj@502 394 done
erikj@564 395 for pack in $($FIND $OTHER_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do
erikj@502 396 ($UNPACK200 $pack $pack.jar)
erikj@502 397 EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
erikj@502 398 done
erikj@502 399 for zip in $($FIND $THIS_UNZIPDIR -name "*.jar" -o -name "*.zip"); do
erikj@502 400 $MKDIR $zip.unzip
erikj@502 401 (cd $zip.unzip && $UNARCHIVE $zip)
erikj@502 402 EXCEPTIONS="$EXCEPTIONS $zip"
erikj@502 403 done
erikj@502 404 for zip in $($FIND $OTHER_UNZIPDIR -name "*.jar" -o -name "*.zip"); do
erikj@502 405 $MKDIR $zip.unzip
erikj@502 406 (cd $zip.unzip && $UNARCHIVE $zip)
erikj@502 407 EXCEPTIONS="$EXCEPTIONS $zip"
erikj@502 408 done
erikj@502 409
ohair@494 410 CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
ohair@494 411 # On solaris, there is no -q option.
ohair@494 412 if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
ihse@808 413 LC_ALL=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
ohair@494 414 | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
ohair@494 415 > $CONTENTS_DIFF_FILE
ohair@494 416 else
ihse@808 417 LC_ALL=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
ohair@494 418 fi
ohair@494 419
ohair@494 420 ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
ohair@494 421 ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE)
ohair@494 422
ohair@494 423 return_value=0
ohair@494 424
ohair@494 425 if [ -n "$ONLY_OTHER" ]; then
ohair@494 426 echo " Only OTHER $ZIP_FILE contains:"
ohair@494 427 echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR| |"g | sed 's|: |/|g'
ohair@494 428 return_value=1
ohair@494 429 fi
ohair@494 430
ohair@494 431 if [ -n "$ONLY_THIS" ]; then
ohair@494 432 echo " Only THIS $ZIP_FILE contains:"
ohair@494 433 echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR| |"g | sed 's|: |/|g'
ohair@494 434 return_value=1
ohair@494 435 fi
ohair@494 436
ohair@494 437 if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
ohair@494 438 DIFFING_FILES=$($GREP -e "differ$" -e "^diff " $CONTENTS_DIFF_FILE \
ohair@494 439 | $CUT -f 3 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
ohair@494 440 else
ohair@494 441 DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
ohair@494 442 | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
ohair@494 443 fi
ohair@494 444
ohair@494 445 $RM -f $WORK_DIR/$ZIP_FILE.diffs
ohair@494 446 for file in $DIFFING_FILES; do
erikj@502 447 if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
ohair@494 448 diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
ohair@494 449 fi
ohair@494 450 done
ohair@494 451
ohair@494 452 if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
ohair@494 453 return_value=1
ohair@494 454 echo " Differing files in $ZIP_FILE"
ohair@494 455 $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP differ | cut -f 2 -d ' ' | \
ohair@494 456 $SED "s|$OTHER_UNZIPDIR| |g" > $WORK_DIR/$ZIP_FILE.difflist
ohair@494 457 $CAT $WORK_DIR/$ZIP_FILE.difflist
ohair@494 458
ohair@494 459 if [ -n "$SHOW_DIFFS" ]; then
ohair@494 460 for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
ohair@494 461 if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
ihse@808 462 LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
ohair@494 463 elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
ihse@808 464 LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
ohair@494 465 else
ihse@808 466 LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
ohair@494 467 fi
ohair@494 468 done
ohair@494 469 fi
ohair@494 470 fi
ohair@494 471
ohair@494 472 return $return_value
ohair@494 473 }
ohair@494 474
ohair@494 475
ohair@494 476 ##########################################################################################
ohair@494 477 # Compare all zip files
ohair@494 478
ohair@494 479 compare_all_zip_files() {
ohair@494 480 THIS_DIR=$1
ohair@494 481 OTHER_DIR=$2
ohair@494 482 WORK_DIR=$3
ohair@494 483
ohair@494 484 ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER )
ohair@494 485
ohair@494 486 if [ -n "$ZIPS" ]; then
ohair@494 487 echo Zip files...
ohair@494 488
ohair@494 489 return_value=0
ohair@494 490 for f in $ZIPS; do
ohair@494 491 if [ -f "$OTHER_DIR/$f" ]; then
ohair@494 492 compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
ohair@494 493 if [ "$?" != "0" ]; then
ohair@494 494 return_value=1
ohair@494 495 REGRESSIONS=true
ohair@494 496 fi
ohair@494 497 fi
ohair@494 498 done
ohair@494 499 fi
ohair@494 500
ohair@494 501 return $return_value
ohair@494 502 }
ohair@494 503
ohair@494 504 ##########################################################################################
ohair@494 505 # Compare all jar files
ohair@494 506
ohair@494 507 compare_all_jar_files() {
ohair@494 508 THIS_DIR=$1
ohair@494 509 OTHER_DIR=$2
ohair@494 510 WORK_DIR=$3
ohair@494 511
ohair@494 512 # TODO filter?
ohair@494 513 ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" | $SORT | $FILTER)
ohair@494 514
ohair@494 515 if [ -n "$ZIPS" ]; then
ohair@494 516 echo Jar files...
ohair@494 517
ohair@494 518 return_value=0
ohair@494 519 for f in $ZIPS; do
ohair@494 520 if [ -f "$OTHER_DIR/$f" ]; then
ohair@494 521 compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
ohair@494 522 if [ "$?" != "0" ]; then
ohair@494 523 return_value=1
ohair@494 524 REGRESSIONS=true
ohair@494 525 fi
ohair@494 526 fi
ohair@494 527 done
ohair@494 528 fi
ohair@494 529
ohair@494 530 return $return_value
ohair@494 531 }
ohair@494 532
ohair@494 533 ##########################################################################################
ohair@494 534 # Compare binary (executable/library) file
ohair@494 535
ohair@494 536 compare_bin_file() {
ohair@494 537 THIS_DIR=$1
ohair@494 538 OTHER_DIR=$2
ohair@494 539 WORK_DIR=$3
ohair@494 540 BIN_FILE=$4
ohair@494 541
ohair@494 542 THIS_FILE=$THIS_DIR/$BIN_FILE
ohair@494 543 OTHER_FILE=$OTHER_DIR/$BIN_FILE
ohair@494 544 NAME=$(basename $BIN_FILE)
ohair@494 545 WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
ohair@494 546 FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
ohair@494 547
ohair@494 548 $MKDIR -p $FILE_WORK_DIR
ohair@494 549
ohair@494 550 ORIG_THIS_FILE="$THIS_FILE"
ohair@494 551 ORIG_OTHER_FILE="$OTHER_FILE"
ohair@494 552
ohair@494 553 if [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then
ohair@494 554 THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME
ohair@494 555 OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME
ohair@494 556 $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other
ohair@494 557 $CP $THIS_FILE $THIS_STRIPPED_FILE
ohair@494 558 $CP $OTHER_FILE $OTHER_STRIPPED_FILE
ohair@494 559 $STRIP $THIS_STRIPPED_FILE
ohair@494 560 $STRIP $OTHER_STRIPPED_FILE
ohair@494 561 THIS_FILE="$THIS_STRIPPED_FILE"
ohair@494 562 OTHER_FILE="$OTHER_STRIPPED_FILE"
ohair@494 563 fi
ohair@494 564
ohair@494 565 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
ohair@494 566 unset _NT_SYMBOL_PATH
ohair@494 567 # On windows we need to unzip the debug symbols, if present
ohair@494 568 OTHER_FILE_BASE=${OTHER_FILE/.dll/}
ohair@494 569 OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
ohair@494 570 DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
ohair@494 571 # java.exe and java.dll diz files will have the same name. Have to
ohair@494 572 # make sure java.exe gets the right one. This is only needed for
ohair@494 573 # OTHER since in the new build, all pdb files are left around.
ohair@494 574 if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
ohair@494 575 OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
ohair@494 576 elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
ohair@494 577 OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
ohair@494 578 else
ohair@494 579 # Some files, jli.dll, appears twice in the image but only one of
ohair@494 580 # thme has a diz file next to it.
ohair@494 581 OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
ohair@494 582 if [ ! -f "$OTHER_DIZ_FILE" ]; then
ohair@494 583 # As a last resort, look for diz file in the whole build output
ohair@494 584 # dir.
ohair@494 585 OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
ohair@494 586 fi
ohair@494 587 fi
ohair@494 588 if [ -n "$OTHER_DIZ_FILE" ]; then
ohair@494 589 $MKDIR -p $FILE_WORK_DIR/other
ohair@494 590 (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
ohair@494 591 export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
ohair@494 592 fi
ohair@494 593 THIS_FILE_BASE=${THIS_FILE/.dll/}
ohair@494 594 THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
ohair@494 595 if [ -f "${THIS_FILE/.dll/}.diz" ]; then
ohair@494 596 THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
ohair@494 597 else
ohair@494 598 THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
ohair@494 599 if [ ! -f "$THIS_DIZ_FILE" ]; then
ohair@494 600 # As a last resort, look for diz file in the whole build output
ohair@494 601 # dir.
ohair@494 602 THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
ohair@494 603 fi
ohair@494 604 fi
ohair@494 605 if [ -n "$THIS_DIZ_FILE" ]; then
ohair@494 606 $MKDIR -p $FILE_WORK_DIR/this
ohair@494 607 (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
ohair@494 608 export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
ohair@494 609 fi
ohair@494 610 fi
ohair@494 611
ohair@494 612 if [ -z "$SKIP_BIN_DIFF" ]; then
ohair@494 613 if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
ohair@494 614 # The files were bytewise identical.
ohair@494 615 if [ -n "$VERBOSE" ]; then
ohair@494 616 echo " : : : : : $BIN_FILE"
ohair@494 617 fi
ohair@494 618 return 0
ohair@494 619 fi
ohair@494 620 BIN_MSG=" diff "
ohair@494 621 if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 622 DIFF_BIN=true
ohair@494 623 if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 624 BIN_MSG="*$BIN_MSG*"
ohair@494 625 REGRESSIONS=true
ohair@494 626 else
ohair@494 627 BIN_MSG=" $BIN_MSG "
ohair@494 628 fi
ohair@494 629 else
ohair@494 630 BIN_MSG="($BIN_MSG)"
ohair@494 631 DIFF_BIN=
ohair@494 632 fi
ohair@494 633 fi
ohair@494 634
ohair@494 635 if [ -n "$STAT" ]; then
ohair@494 636 THIS_SIZE=$($STAT $STAT_PRINT_SIZE "$THIS_FILE")
ohair@494 637 OTHER_SIZE=$($STAT $STAT_PRINT_SIZE "$OTHER_FILE")
ohair@494 638 else
ohair@494 639 THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }')
ohair@494 640 OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }')
ohair@494 641 fi
ohair@494 642 if [ $THIS_SIZE -ne $OTHER_SIZE ]; then
ohair@494 643 DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE)
ohair@494 644 DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
ohair@494 645 SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
tbell@510 646 if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \
tbell@510 647 && [ "$DIFF_SIZE_REL" -lt 102 ]; then
ohair@494 648 SIZE_MSG="($SIZE_MSG)"
ohair@494 649 DIFF_SIZE=
tbell@510 650 elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
tbell@510 651 && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
tbell@510 652 && [ "$DIFF_SIZE_NUM" = 512 ]; then
tbell@510 653 # On windows, size of binaries increase in 512 increments.
tbell@510 654 SIZE_MSG="($SIZE_MSG)"
tbell@510 655 DIFF_SIZE=
tbell@510 656 elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
tbell@510 657 && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
tbell@510 658 && [ "$DIFF_SIZE_NUM" = -512 ]; then
ohair@494 659 # On windows, size of binaries increase in 512 increments.
ohair@494 660 SIZE_MSG="($SIZE_MSG)"
ohair@494 661 DIFF_SIZE=
ohair@494 662 else
ohair@494 663 if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 664 DIFF_SIZE=true
ohair@494 665 if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 666 SIZE_MSG="*$SIZE_MSG*"
ohair@494 667 REGRESSIONS=true
ohair@494 668 else
ohair@494 669 SIZE_MSG=" $SIZE_MSG "
ohair@494 670 fi
ohair@494 671 else
ohair@494 672 SIZE_MSG="($SIZE_MSG)"
ohair@494 673 DIFF_SIZE=
ohair@494 674 fi
ohair@494 675 fi
ohair@494 676 else
ohair@494 677 SIZE_MSG=" "
ohair@494 678 DIFF_SIZE=
ohair@494 679 if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then
ohair@494 680 SIZE_MSG=" ! "
ohair@494 681 fi
ohair@494 682 fi
ohair@494 683
ohair@494 684 if [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then
ohair@494 685 SYM_SORT_CMD="sort"
ohair@494 686 else
ohair@494 687 SYM_SORT_CMD="cat"
ohair@494 688 fi
ohair@494 689
ohair@494 690 # Check symbols
ohair@494 691 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
ohair@494 692 # The output from dumpbin on windows differs depending on if the debug symbol
ohair@494 693 # files are still around at the location the binary is pointing too. Need
ohair@494 694 # to filter out that extra information.
ohair@494 695 $DUMPBIN -exports $OTHER_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
ohair@494 696 $DUMPBIN -exports $THIS_FILE | $GREP -E '^ +[0-9A-F]+ +[0-9A-F]+ [0-9A-F]+' | sed 's/ = .*//g' | cut -c27- | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
ohair@494 697 elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
ohair@494 698 # Some symbols get seemingly random 15 character prefixes. Filter them out.
ohair@494 699 $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
ohair@494 700 $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SED 's/^\([a-zA-Z] [\.\$]\)[a-zA-Z0-9_\$]\{15,15\}\./\1./g' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
ohair@494 701 else
ohair@494 702 $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
ohair@494 703 $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
ohair@494 704 fi
ohair@494 705
ihse@808 706 LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
ohair@494 707 if [ -s $WORK_FILE_BASE.symbols.diff ]; then
ohair@494 708 SYM_MSG=" diff "
ohair@494 709 if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 710 DIFF_SYM=true
ohair@494 711 if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 712 SYM_MSG="*$SYM_MSG*"
ohair@494 713 REGRESSIONS=true
ohair@494 714 else
ohair@494 715 SYM_MSG=" $SYM_MSG "
ohair@494 716 fi
ohair@494 717 else
ohair@494 718 SYM_MSG="($SYM_MSG)"
ohair@494 719 DIFF_SYM=
ohair@494 720 fi
ohair@494 721 else
ohair@494 722 SYM_MSG=" "
ohair@494 723 DIFF_SYM=
ohair@494 724 if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then
ohair@494 725 SYM_MSG=" ! "
ohair@494 726 fi
ohair@494 727 fi
ohair@494 728
ohair@494 729 # Check dependencies
ohair@494 730 if [ -n "$LDD_CMD" ]; then
erikj@502 731 (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
erikj@502 732 (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
ohair@494 733 (cd $FILE_WORK_DIR && $RM -f $NAME)
ohair@494 734
ihse@808 735 LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
ihse@808 736 LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
ohair@494 737
ohair@494 738 if [ -s $WORK_FILE_BASE.deps.diff ]; then
ohair@494 739 if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
ohair@494 740 DEP_MSG=" diff "
ohair@494 741 else
ohair@494 742 DEP_MSG=" redun "
ohair@494 743 fi
ohair@494 744 if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 745 DIFF_DEP=true
ohair@494 746 if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 747 DEP_MSG="*$DEP_MSG*"
ohair@494 748 REGRESSIONS=true
ohair@494 749 else
ohair@494 750 DEP_MSG=" $DEP_MSG "
ohair@494 751 fi
ohair@494 752 else
ohair@494 753 DEP_MSG="($DEP_MSG)"
ohair@494 754 DIFF_DEP=
ohair@494 755 fi
ohair@494 756 else
ohair@494 757 DEP_MSG=" "
ohair@494 758 DIFF_DEP=
ohair@494 759 if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
ohair@494 760 DEP_MSG=" ! "
ohair@494 761 fi
ohair@494 762 fi
ohair@494 763 else
ohair@494 764 DEP_MSG=" - "
ohair@494 765 fi
ohair@494 766
ohair@494 767 # Compare fulldump output
ohair@494 768 if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then
ohair@494 769 $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1
ohair@494 770 $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1
ihse@808 771 LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
ohair@494 772
ohair@494 773 if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
ohair@494 774 ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}')
ohair@494 775 ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
ohair@494 776 if [[ "$ACCEPTED_ELF_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 777 DIFF_ELF=true
ohair@494 778 if [[ "$KNOWN_ELF_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 779 ELF_MSG="*$ELF_MSG*"
ohair@494 780 REGRESSIONS=true
ohair@494 781 else
ohair@494 782 ELF_MSG=" $ELF_MSG "
ohair@494 783 fi
ohair@494 784 else
ohair@494 785 ELF_MSG="($ELF_MSG)"
ohair@494 786 DIFF_ELF=
ohair@494 787 fi
ohair@494 788 else
ohair@494 789 ELF_MSG=" "
ohair@494 790 DIFF_ELF=
ohair@494 791 if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
ohair@494 792 ELF_MSG=" ! "
ohair@494 793 fi
ohair@494 794 fi
ohair@494 795 fi
ohair@494 796
ohair@494 797 # Compare disassemble output
ohair@494 798 if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then
ohair@494 799 if [ -z "$DIS_DIFF_FILTER" ]; then
ohair@494 800 DIS_DIFF_FILTER="$CAT"
ohair@494 801 fi
ohair@494 802 $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1
ohair@494 803 $DIS_CMD $THIS_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this 2>&1
ohair@494 804
ihse@808 805 LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
ohair@494 806
ohair@494 807 if [ -s $WORK_FILE_BASE.dis.diff ]; then
ohair@494 808 DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
ohair@494 809 DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
ohair@494 810 if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 811 DIFF_DIS=true
ohair@494 812 if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then
ohair@494 813 DIS_MSG="*$DIS_MSG*"
ohair@494 814 REGRESSIONS=true
ohair@494 815 else
ohair@494 816 DIS_MSG=" $DIS_MSG "
ohair@494 817 fi
ohair@494 818 else
ohair@494 819 DIS_MSG="($DIS_MSG)"
ohair@494 820 DIFF_DIS=
ohair@494 821 fi
ohair@494 822 else
ohair@494 823 DIS_MSG=" "
ohair@494 824 DIFF_DIS=
ohair@494 825 if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
ohair@494 826 DIS_MSG=" ! "
ohair@494 827 fi
ohair@494 828 fi
ohair@494 829 fi
ohair@494 830
ohair@494 831
ohair@494 832 if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_ELF$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then
ohair@494 833 if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi
ohair@494 834 if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi
ohair@494 835 if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi
ohair@494 836 if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi
ohair@494 837 if [ -n "$ELF_MSG" ]; then echo -n "$ELF_MSG:"; fi
ohair@494 838 if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi
ohair@494 839 echo " $BIN_FILE"
ohair@494 840 if [ "$SHOW_DIFFS" = "true" ]; then
ohair@494 841 if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then
ohair@494 842 echo "Symbols diff:"
ohair@494 843 $CAT $WORK_FILE_BASE.symbols.diff
ohair@494 844 fi
ohair@494 845 if [ -s "$WORK_FILE_BASE.deps.diff" ]; then
ohair@494 846 echo "Deps diff:"
ohair@494 847 $CAT $WORK_FILE_BASE.deps.diff
ohair@494 848 fi
ohair@494 849 if [ -s "$WORK_FILE_BASE.fulldump.diff" ]; then
ohair@494 850 echo "Fulldump diff:"
ohair@494 851 $CAT $WORK_FILE_BASE.fulldump.diff
ohair@494 852 fi
ohair@494 853 if [ -s "$WORK_FILE_BASE.dis.diff" ]; then
ohair@494 854 echo "Disassembly diff:"
ohair@494 855 $CAT $WORK_FILE_BASE.dis.diff
ohair@494 856 fi
ohair@494 857 fi
ohair@494 858 return 1
ohair@494 859 fi
ohair@494 860 return 0
ohair@494 861 }
ohair@494 862
ohair@494 863 ##########################################################################################
ohair@494 864 # Print binary diff header
ohair@494 865
ohair@494 866 print_binary_diff_header() {
ohair@494 867 if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi
ohair@494 868 if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n " Size :"; fi
ohair@494 869 if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi
ohair@494 870 if [ -z "$SKIP_DEP_DIFF" ]; then echo -n " Deps :"; fi
ohair@494 871 if [ -z "$SKIP_FULLDUMP_DIFF" ]; then echo -n " Fulldump :"; fi
ohair@494 872 if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass :"; fi
ohair@494 873 echo
ohair@494 874 }
ohair@494 875
ohair@494 876 ##########################################################################################
ohair@494 877 # Compare all libraries
ohair@494 878
ohair@494 879 compare_all_libs() {
ohair@494 880 THIS_DIR=$1
ohair@494 881 OTHER_DIR=$2
ohair@494 882 WORK_DIR=$3
ohair@494 883
tbell@510 884 LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER)
ohair@494 885
ohair@494 886 if [ -n "$LIBS" ]; then
ohair@494 887 echo Libraries...
ohair@494 888 print_binary_diff_header
ohair@494 889 for l in $LIBS; do
ohair@494 890 if [ -f "$OTHER_DIR/$l" ]; then
ohair@494 891 compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l
ohair@494 892 if [ "$?" != "0" ]; then
ohair@494 893 return_value=1
ohair@494 894 fi
ohair@494 895 fi
ohair@494 896 done
ohair@494 897 fi
ohair@494 898
ohair@494 899 return $return_value
ohair@494 900 }
ohair@494 901
ohair@494 902 ##########################################################################################
ohair@494 903 # Compare all executables
ohair@494 904
ohair@494 905 compare_all_execs() {
ohair@494 906 THIS_DIR=$1
ohair@494 907 OTHER_DIR=$2
ohair@494 908 WORK_DIR=$3
ohair@494 909
ohair@494 910 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
ohair@494 911 EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER)
ohair@494 912 else
erikj@502 913 EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \
erikj@502 914 \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \
erikj@502 915 -o -name '*.jar' -o -name '*.diz' -o -name 'jcontrol' -o -name '*.properties' \
erikj@502 916 -o -name '*.data' -o -name '*.bfc' -o -name '*.src' -o -name '*.txt' \
erikj@502 917 -o -name '*.cfg' -o -name 'meta-index' -o -name '*.properties.ja' \
erikj@502 918 -o -name 'classlist' \) | $SORT | $FILTER)
ohair@494 919 fi
ohair@494 920
ohair@494 921 if [ -n "$EXECS" ]; then
ohair@494 922 echo Executables...
ohair@494 923 print_binary_diff_header
ohair@494 924 for e in $EXECS; do
ohair@494 925 if [ -f "$OTHER_DIR/$e" ]; then
ohair@494 926 compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e
ohair@494 927 if [ "$?" != "0" ]; then
ohair@494 928 return_value=1
ohair@494 929 fi
ohair@494 930 fi
ohair@494 931 done
ohair@494 932 fi
ohair@494 933
ohair@494 934 return $return_value
ohair@494 935 }
ohair@494 936
ohair@494 937 ##########################################################################################
ohair@494 938 # Initiate configuration
ohair@494 939
ohair@494 940 COMPARE_ROOT=/tmp/cimages.$USER
ohair@494 941 $MKDIR -p $COMPARE_ROOT
ohair@494 942 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
ohair@494 943 if [ "$(uname -o)" = "Cygwin" ]; then
ohair@494 944 COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
ohair@494 945 fi
ohair@494 946 fi
ohair@494 947
ohair@494 948 THIS="$( cd "$( dirname "$0" )" && pwd )"
ohair@494 949 echo "$THIS"
ohair@494 950 THIS_SCRIPT="$0"
ohair@494 951
ohair@494 952 if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
ohair@494 953 echo "bash ./compare.sh [OPTIONS] [FILTER]"
ohair@494 954 echo ""
ohair@494 955 echo "-all Compare all files in all known ways"
ohair@494 956 echo "-names Compare the file names and directory structure"
ohair@494 957 echo "-perms Compare the permission bits on all files and directories"
ohair@494 958 echo "-types Compare the output of the file command on all files"
ohair@494 959 echo "-general Compare the files not convered by the specialized comparisons"
ohair@494 960 echo "-zips Compare the contents of all zip files"
ohair@494 961 echo "-jars Compare the contents of all jar files"
ohair@494 962 echo "-libs Compare all native libraries"
ohair@494 963 echo "-execs Compare all executables"
ohair@494 964 echo "-v Verbose output, does not hide known differences"
ohair@494 965 echo "-vv More verbose output, shows diff output of all comparisons"
ohair@494 966 echo "-o [OTHER] Compare with build in other directory. Will default to the old build directory"
ohair@494 967 echo ""
ohair@494 968 echo "[FILTER] List filenames in the image to compare, works for jars, zips, libs and execs"
ohair@494 969 echo "Example:"
ohair@494 970 echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
erikj@601 971 echo ""
erikj@601 972 echo "-2zips <file1> <file2> Compare two zip files only"
erikj@601 973 echo ""
ohair@494 974 exit 10
ohair@494 975 fi
ohair@494 976
ohair@494 977 CMP_NAMES=false
ohair@494 978 CMP_PERMS=false
ohair@494 979 CMP_TYPES=false
ohair@494 980 CMP_GENERAL=false
ohair@494 981 CMP_ZIPS=false
ohair@494 982 CMP_JARS=false
ohair@494 983 CMP_LIBS=false
ohair@494 984 CMP_EXECS=false
ohair@494 985
ohair@494 986 while [ -n "$1" ]; do
ohair@494 987 case "$1" in
ohair@494 988 -v)
ohair@494 989 VERBOSE=true
ohair@494 990 ;;
ohair@494 991 -vv)
ohair@494 992 VERBOSE=true
ohair@494 993 SHOW_DIFFS=true
ohair@494 994 ;;
ohair@494 995 -o)
ohair@494 996 OTHER="$2"
ohair@494 997 shift
ohair@494 998 ;;
ohair@494 999 -all)
ohair@494 1000 CMP_NAMES=true
ohair@494 1001 if [ "$OPENJDK_TARGET_OS" != "windows" ]; then
ohair@494 1002 CMP_PERMS=true
ohair@494 1003 fi
ohair@494 1004 CMP_TYPES=true
ohair@494 1005 CMP_GENERAL=true
ohair@494 1006 CMP_ZIPS=true
ohair@494 1007 CMP_JARS=true
ohair@494 1008 CMP_LIBS=true
ohair@494 1009 CMP_EXECS=true
ohair@494 1010 ;;
ohair@494 1011 -names)
ohair@494 1012 CMP_NAMES=true
ohair@494 1013 ;;
ohair@494 1014 -perms)
ohair@494 1015 CMP_PERMS=true
ohair@494 1016 ;;
ohair@494 1017 -types)
ohair@494 1018 CMP_TYPES=true
ohair@494 1019 ;;
ohair@494 1020 -general)
ohair@494 1021 CMP_GENERAL=true
ohair@494 1022 ;;
ohair@494 1023 -zips)
ohair@494 1024 CMP_ZIPS=true
ohair@494 1025 ;;
ohair@494 1026 -jars)
ohair@494 1027 CMP_JARS=true
ohair@494 1028 ;;
ohair@494 1029 -libs)
ohair@494 1030 CMP_LIBS=true
ohair@494 1031 ;;
ohair@494 1032 -execs)
ohair@494 1033 CMP_EXECS=true
ohair@494 1034 ;;
erikj@601 1035 -2zips)
erikj@601 1036 CMP_2_ZIPS=true
erikj@601 1037 THIS_FILE=$2
erikj@601 1038 OTHER_FILE=$3
erikj@601 1039 shift
erikj@601 1040 shift
erikj@601 1041 ;;
ohair@494 1042 *)
ohair@494 1043 CMP_NAMES=false
ohair@494 1044 CMP_PERMS=false
ohair@494 1045 CMP_TYPES=false
ohair@494 1046 CMP_ZIPS=true
ohair@494 1047 CMP_JARS=true
ohair@494 1048 CMP_LIBS=true
ohair@494 1049 CMP_EXECS=true
ohair@494 1050
ohair@494 1051 if [ -z "$FILTER" ]; then
ohair@494 1052 FILTER="$GREP"
ohair@494 1053 fi
ohair@494 1054 FILTER="$FILTER -e $1"
ohair@494 1055 ;;
ohair@494 1056 esac
ohair@494 1057 shift
ohair@494 1058 done
ohair@494 1059
erikj@601 1060 if [ "$CMP_2_ZIPS" = "true" ]; then
erikj@601 1061 THIS_DIR="$(dirname $THIS_FILE)"
erikj@601 1062 THIS_DIR="$(cd "$THIS_DIR" && pwd )"
erikj@601 1063 OTHER_DIR="$(dirname $OTHER_FILE)"
erikj@601 1064 OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
erikj@601 1065 THIS_FILE_NAME="$(basename $THIS_FILE)"
erikj@601 1066 OTHER_FILE_NAME="$(basename $OTHER_FILE)"
erikj@601 1067 echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
erikj@601 1068 compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME
erikj@601 1069 exit
erikj@601 1070 fi
erikj@601 1071
ohair@494 1072 if [ "$CMP_NAMES" = "false" ] && [ "$CMP_TYPES" = "false" ] && [ "$CMP_PERMS" = "false" ] && [ "$CMP_GENERAL" = "false" ] && [ "$CMP_ZIPS" = "false" ] && [ "$CMP_JARS" = "false" ] && [ "$CMP_LIBS" = "false" ] && [ "$CMP_EXECS" = "false" ]; then
ohair@494 1073 CMP_NAMES=true
ohair@494 1074 CMP_PERMS=true
ohair@494 1075 CMP_TYPES=true
ohair@494 1076 CMP_GENERAL=true
ohair@494 1077 CMP_ZIPS=true
ohair@494 1078 CMP_JARS=true
ohair@494 1079 CMP_LIBS=true
ohair@494 1080 CMP_EXECS=true
ohair@494 1081 fi
ohair@494 1082
ohair@494 1083 if [ -z "$FILTER" ]; then
ohair@494 1084 FILTER="$CAT"
ohair@494 1085 fi
ohair@494 1086
ohair@494 1087 if [ -z "$OTHER" ]; then
ohair@494 1088 OTHER="$THIS/../$LEGACY_BUILD_DIR"
ohair@494 1089 if [ -d "$OTHER" ]; then
ohair@494 1090 OTHER="$( cd "$OTHER" && pwd )"
ohair@494 1091 else
ohair@494 1092 echo "Default old build directory does not exist:"
ohair@494 1093 echo "$OTHER"
ohair@494 1094 exit 1
ohair@494 1095 fi
ohair@494 1096 echo "Comparing to default old build:"
ohair@494 1097 echo "$OTHER"
ohair@494 1098 echo
ohair@494 1099 else
ohair@494 1100 if [ ! -d "$OTHER" ]; then
ohair@494 1101 echo "Other build directory does not exist:"
ohair@494 1102 echo "$OTHER"
ohair@494 1103 exit 1
ohair@494 1104 fi
ohair@494 1105 OTHER="$( cd "$OTHER" && pwd )"
ohair@494 1106 echo "Comparing to:"
ohair@494 1107 echo "$OTHER"
ohair@494 1108 echo
ohair@494 1109 fi
ohair@494 1110
ohair@494 1111
ohair@494 1112 # Figure out the layout of the this build. Which kinds of images have been produced
erikj@564 1113 if [ -d "$THIS/install/j2sdk-image" ]; then
erikj@564 1114 THIS_J2SDK="$THIS/install/j2sdk-image"
erikj@564 1115 THIS_J2RE="$THIS/install/j2re-image"
ihse@912 1116 echo "Selecting install images in this build"
erikj@564 1117 elif [ -d "$THIS/deploy/j2sdk-image" ]; then
ohair@494 1118 THIS_J2SDK="$THIS/deploy/j2sdk-image"
ohair@494 1119 THIS_J2RE="$THIS/deploy/j2re-image"
ihse@912 1120 echo "Selecting deploy images in this build"
ohair@494 1121 elif [ -d "$THIS/images/j2sdk-image" ]; then
ohair@494 1122 THIS_J2SDK="$THIS/images/j2sdk-image"
ohair@494 1123 THIS_J2RE="$THIS/images/j2re-image"
ihse@912 1124 echo "Selecting jdk images in this build"
ohair@494 1125 fi
erikj@564 1126
ohair@494 1127 if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
erikj@564 1128 if [ -d "$THIS/install/j2sdk-image" ]; then
erikj@564 1129 # If there is an install image, prefer that, it's also overlay
erikj@564 1130 THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
erikj@564 1131 THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
ihse@912 1132 echo "Selecting install overlay images in this build"
erikj@564 1133 else
erikj@564 1134 THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
erikj@564 1135 THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
ihse@912 1136 echo "Selecting jdk overlay images in this build"
erikj@564 1137 fi
ohair@494 1138 fi
ohair@494 1139
ohair@494 1140 if [ -d "$THIS/images/j2sdk-bundle" ]; then
ohair@494 1141 THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
ohair@494 1142 THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
ihse@912 1143 echo "Selecting bundles in this build"
ohair@494 1144 fi
ohair@494 1145
ohair@494 1146 # Figure out the layout of the other build (old or new, normal or overlay image)
ohair@494 1147 if [ -d "$OTHER/j2sdk-image" ]; then
ohair@494 1148 if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
ohair@494 1149 OTHER_J2SDK="$OTHER/j2sdk-image"
ohair@494 1150 OTHER_J2RE="$OTHER/j2re-image"
ihse@912 1151 echo "Selecting old-style images in other build"
ohair@494 1152 else
ohair@494 1153 OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
ohair@494 1154 OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
ihse@912 1155 echo "Selecting overlay images in other build"
ohair@494 1156 fi
ihse@912 1157 elif [ -d "$OTHER/install/j2sdk-image" ]; then
ihse@912 1158 OTHER_J2SDK="$OTHER/install/j2sdk-image"
ihse@912 1159 OTHER_J2RE="$OTHER/install/j2re-image"
ihse@912 1160 echo "Selecting install images in other build"
ihse@912 1161 elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
ihse@912 1162 OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
ihse@912 1163 OTHER_J2RE="$OTHER/deploy/j2re-image"
ihse@912 1164 echo "Selecting deploy images in other build"
erikj@564 1165 elif [ -d "$OTHER/images/j2sdk-image" ]; then
erikj@564 1166 OTHER_J2SDK="$OTHER/images/j2sdk-image"
erikj@564 1167 OTHER_J2RE="$OTHER/images/j2re-image"
ihse@912 1168 echo "Selecting jdk images in other build"
ohair@494 1169 fi
ohair@494 1170
ohair@494 1171 if [ -d "$OTHER/j2sdk-bundle" ]; then
ohair@494 1172 OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
ohair@494 1173 OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
ihse@912 1174 echo "Selecting bundles in other build"
ohair@494 1175 elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
ohair@494 1176 OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
ohair@494 1177 OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
ihse@912 1178 echo "Selecting jdk bundles in other build"
ohair@494 1179 fi
ohair@494 1180
ohair@494 1181 if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
ohair@494 1182 if [ -z "$THIS_J2SDK_OVERLAY" ]; then
ohair@494 1183 echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
ohair@494 1184 exit 1
ohair@494 1185 fi
ohair@494 1186 fi
ohair@494 1187
ohair@494 1188 if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
ohair@494 1189 echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
ohair@494 1190 exit 1
ohair@494 1191 fi
ohair@494 1192
ohair@494 1193 if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
ohair@494 1194 echo "WARNING! OTHER build has bundles built while this build does not."
ohair@494 1195 echo "Skipping bundle compare!"
ohair@494 1196 fi
ohair@494 1197
erikj@518 1198 if [ -d "$THIS/docs" ]; then
erikj@518 1199 THIS_DOCS="$THIS/docs"
erikj@518 1200 fi
erikj@518 1201
erikj@518 1202 if [ -d "$OTHER/docs" ]; then
erikj@518 1203 OTHER_DOCS="$OTHER/docs"
erikj@518 1204 fi
erikj@518 1205
erikj@518 1206 if [ -z "$THIS_DOCS" ]; then
erikj@518 1207 echo "WARNING! Docs haven't been built and won't be compared."
erikj@518 1208 fi
erikj@518 1209
erikj@518 1210 if [ -z "$OTHER_DOCS" ]; then
erikj@518 1211 echo "WARNING! Other build doesn't contain docs, skipping doc compare."
erikj@518 1212 fi
erikj@518 1213
erikj@569 1214 if [ -d "$OTHER/images" ]; then
erikj@569 1215 OTHER_SEC_DIR="$OTHER/images"
erikj@568 1216 else
erikj@569 1217 OTHER_SEC_DIR="$OTHER/tmp"
erikj@568 1218 fi
erikj@569 1219 OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
erikj@569 1220 THIS_SEC_DIR="$THIS/images"
erikj@569 1221 THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
erikj@569 1222 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
erikj@569 1223 if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
erikj@569 1224 JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
erikj@569 1225 else
erikj@569 1226 JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
erikj@569 1227 fi
erikj@569 1228 OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
erikj@569 1229 OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
erikj@569 1230 THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
erikj@569 1231 THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
erikj@569 1232 fi
erikj@568 1233
ohair@494 1234 ##########################################################################################
ohair@494 1235 # Do the work
ohair@494 1236
ohair@494 1237 if [ "$CMP_NAMES" = "true" ]; then
ohair@494 1238 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1239 echo -n "J2SDK "
ohair@494 1240 compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1241 echo -n "J2RE "
ohair@494 1242 compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
ohair@494 1243
ohair@494 1244 echo -n "J2SDK "
ohair@494 1245 compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1246 echo -n "J2RE "
ohair@494 1247 compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
ohair@494 1248 fi
ohair@494 1249 if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
ohair@494 1250 echo -n "J2SDK Overlay "
ohair@494 1251 compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1252 echo -n "J2RE Overlay "
ohair@494 1253 compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
ohair@494 1254
ohair@494 1255 echo -n "J2SDK Overlay "
ohair@494 1256 compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1257 echo -n "J2RE Overlay "
ohair@494 1258 compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
ohair@494 1259 fi
ohair@494 1260 if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
ohair@494 1261 echo -n "J2SDK Bundle "
ohair@494 1262 compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
ohair@494 1263 echo -n "J2RE Bundle "
ohair@494 1264 compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
ohair@494 1265
ohair@494 1266 echo -n "J2SDK Bundle "
ohair@494 1267 compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
ohair@494 1268 echo -n "J2RE Bundle "
ohair@494 1269 compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
ohair@494 1270 fi
erikj@518 1271 if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
erikj@518 1272 echo -n "Docs "
erikj@518 1273 compare_dirs $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
erikj@518 1274 echo -n "Docs "
erikj@518 1275 compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
erikj@518 1276 fi
ohair@494 1277 fi
ohair@494 1278
ohair@494 1279 if [ "$CMP_PERMS" = "true" ]; then
ohair@494 1280 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1281 echo -n "J2SDK "
ohair@494 1282 compare_permissions $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1283 echo -n "J2RE "
ohair@494 1284 compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
ohair@494 1285 fi
ohair@494 1286 if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
ohair@494 1287 echo -n "J2SDK Overlay "
ohair@494 1288 compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1289 echo -n "J2RE Overlay "
ohair@494 1290 compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
ohair@494 1291 fi
ohair@494 1292 if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
ohair@494 1293 echo -n "J2SDK Bundle "
ohair@494 1294 compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
ohair@494 1295 echo -n "J2RE Bundle "
ohair@494 1296 compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
ohair@494 1297 fi
ohair@494 1298 fi
ohair@494 1299
ohair@494 1300 if [ "$CMP_TYPES" = "true" ]; then
ohair@494 1301 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1302 echo -n "J2SDK "
ohair@494 1303 compare_file_types $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1304 echo -n "J2RE "
ohair@494 1305 compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
ohair@494 1306 fi
ohair@494 1307 if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
ohair@494 1308 echo -n "J2SDK Overlay "
ohair@494 1309 compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1310 echo -n "J2RE Overlay "
ohair@494 1311 compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
ohair@494 1312 fi
ohair@494 1313 if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
ohair@494 1314 echo -n "J2SDK Bundle "
ohair@494 1315 compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
ohair@494 1316 echo -n "J2RE Bundle "
ohair@494 1317 compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
ohair@494 1318 fi
ohair@494 1319 fi
ohair@494 1320
ohair@494 1321 if [ "$CMP_GENERAL" = "true" ]; then
ohair@494 1322 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1323 echo -n "J2SDK "
ohair@494 1324 compare_general_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1325 echo -n "J2RE "
ohair@494 1326 compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
ohair@494 1327 fi
ohair@494 1328 if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
ohair@494 1329 echo -n "J2SDK Overlay "
ohair@494 1330 compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1331 echo -n "J2RE Overlay "
ohair@494 1332 compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
ohair@494 1333 fi
ohair@494 1334 if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
ohair@494 1335 echo -n "J2SDK Bundle "
ohair@494 1336 compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
ohair@494 1337 echo -n "J2RE Bundle "
ohair@494 1338 compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
ohair@494 1339 fi
erikj@518 1340 if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
erikj@518 1341 echo -n "Docs "
erikj@518 1342 compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
erikj@518 1343 fi
ohair@494 1344 fi
ohair@494 1345
ohair@494 1346 if [ "$CMP_ZIPS" = "true" ]; then
ohair@494 1347 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1348 compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1349 fi
erikj@568 1350 if [ -n "$THIS_SEC_BIN" ] && [ -n "$OTHER_SEC_BIN" ]; then
erikj@568 1351 if [ -n "$(echo $THIS_SEC_BIN | $FILTER)" ]; then
erikj@568 1352 echo "sec-bin.zip..."
erikj@574 1353 compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-bin.zip
erikj@574 1354 fi
erikj@574 1355 fi
erikj@574 1356 if [ -n "$THIS_SEC_WINDOWS_BIN" ] && [ -n "$OTHER_SEC_WINDOWS_BIN" ]; then
erikj@574 1357 if [ -n "$(echo $THIS_SEC_WINDOWS_BIN | $FILTER)" ]; then
erikj@574 1358 echo "sec-windows-bin.zip..."
erikj@574 1359 compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-windows-bin.zip
erikj@574 1360 fi
erikj@574 1361 fi
erikj@574 1362 if [ -n "$THIS_JGSS_WINDOWS_BIN" ] && [ -n "$OTHER_JGSS_WINDOWS_BIN" ]; then
erikj@574 1363 if [ -n "$(echo $THIS_JGSS_WINDOWS_BIN | $FILTER)" ]; then
erikj@574 1364 echo "$JGSS_WINDOWS_BIN..."
erikj@574 1365 compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin $JGSS_WINDOWS_BIN
erikj@568 1366 fi
erikj@568 1367 fi
ohair@494 1368 fi
ohair@494 1369
ohair@494 1370 if [ "$CMP_JARS" = "true" ]; then
ohair@494 1371 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1372 compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1373 fi
ohair@494 1374 fi
ohair@494 1375
ohair@494 1376 if [ "$CMP_LIBS" = "true" ]; then
ohair@494 1377 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
tbell@510 1378 echo -n "J2SDK "
ohair@494 1379 compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
tbell@510 1380 if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
tbell@510 1381 echo -n "J2RE "
tbell@510 1382 compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
tbell@510 1383 fi
ohair@494 1384 fi
ohair@494 1385 if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
ohair@494 1386 echo -n "Bundle "
ohair@494 1387 compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1388 fi
ohair@494 1389 fi
ohair@494 1390
ohair@494 1391 if [ "$CMP_EXECS" = "true" ]; then
ohair@494 1392 if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
ohair@494 1393 compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
ohair@494 1394 fi
ohair@494 1395 if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
ohair@494 1396 echo -n "Overlay "
ohair@494 1397 compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
ohair@494 1398 fi
ohair@494 1399 fi
ohair@494 1400
ohair@494 1401 echo
ohair@494 1402
ohair@494 1403 if [ -n "$REGRESSIONS" ]; then
ohair@494 1404 echo "REGRESSIONS FOUND!"
ohair@494 1405 echo
ohair@494 1406 exit 1
ohair@494 1407 else
ohair@494 1408 echo "No regressions found"
ohair@494 1409 echo
ohair@494 1410 exit 0
ohair@494 1411 fi

mercurial