common/bin/compare.sh

changeset 0
75a576e87639
child 1133
50aaf272884f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/bin/compare.sh	Wed Apr 27 01:39:08 2016 +0800
     1.3 @@ -0,0 +1,1411 @@
     1.4 +#!/bin/bash
     1.5 +#
     1.6 +# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 +#
     1.9 +# This code is free software; you can redistribute it and/or modify it
    1.10 +# under the terms of the GNU General Public License version 2 only, as
    1.11 +# published by the Free Software Foundation.
    1.12 +#
    1.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 +# version 2 for more details (a copy is included in the LICENSE file that
    1.17 +# accompanied this code).
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License version
    1.20 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 +#
    1.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 +# or visit www.oracle.com if you need additional information or have any
    1.25 +# questions.
    1.26 +#
    1.27 +
    1.28 +# This script is processed by configure before it's usable. It is run from 
    1.29 +# the root of the build directory.
    1.30 +
    1.31 +
    1.32 +##########################################################################################
    1.33 +
    1.34 +# Check that we are run via the wrapper generated by configure
    1.35 +if [ -z "$SRC_ROOT" ]; then
    1.36 +    echo "Error: You must run this script using build/[conf]/compare.sh"
    1.37 +    exit 1
    1.38 +fi
    1.39 +
    1.40 +if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
    1.41 +    FULLDUMP_CMD="$OTOOL -v -V -h -X -t -d"
    1.42 +    LDD_CMD="$OTOOL -L"
    1.43 +    DIS_CMD="$OTOOL -v -t"
    1.44 +    STAT_PRINT_SIZE="-f %z"
    1.45 +elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
    1.46 +    FULLDUMP_CMD="$DUMPBIN -all"
    1.47 +    LDD_CMD="$DUMPBIN -dependants | $GREP .dll"
    1.48 +    DIS_CMD="$DUMPBIN -disasm:nobytes"
    1.49 +    STAT_PRINT_SIZE="-c %s"
    1.50 +else
    1.51 +    FULLDUMP_CMD="$READELF -a"
    1.52 +    LDD_CMD="$LDD"
    1.53 +    DIS_CMD="$OBJDUMP -d"
    1.54 +    STAT_PRINT_SIZE="-c %s"
    1.55 +fi
    1.56 +
    1.57 +UNARCHIVE="$UNZIP -q"
    1.58 +
    1.59 +COMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/common/bin/compare_exceptions.sh.incl"
    1.60 +if [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then
    1.61 +    echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE"
    1.62 +    exit 1
    1.63 +fi
    1.64 +# Include exception definitions
    1.65 +. "$COMPARE_EXCEPTIONS_INCLUDE"
    1.66 +
    1.67 +##########################################################################################
    1.68 +# Compare text files and ignore specific differences:
    1.69 +#
    1.70 +#  * Timestamps in Java sources generated by idl2java
    1.71 +#  * Sorting order and cleanup style in .properties files
    1.72 +
    1.73 +diff_text() {
    1.74 +    OTHER_FILE=$1
    1.75 +    THIS_FILE=$2
    1.76 +
    1.77 +    SUFFIX="${THIS_FILE##*.}"
    1.78 +
    1.79 +    TMP=1
    1.80 +
    1.81 +    if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
    1.82 +        TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
    1.83 +            $GREP '^[<>]' | \
    1.84 +            $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
    1.85 +	         -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
    1.86 +    fi
    1.87 +    if test "x$SUFFIX" = "xjava"; then
    1.88 +        TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \
    1.89 +            $GREP '^[<>]' | \
    1.90 +            $SED -e '/[<>] \* from.*\.idl/d' \
    1.91 +                 -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
    1.92 +                 -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \
    1.93 +                 -e '/\/\/ Generated from input file.*/d' \
    1.94 +                 -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \
    1.95 +                 -e '/\/\/ java GenerateCharacter.*/d')
    1.96 +    fi
    1.97 +    # Ignore date strings in class files.
    1.98 +    # On Macosx the system sources for generated java classes produce different output on 
    1.99 +    # consequtive invokations seemingly randomly.
   1.100 +    # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
   1.101 +    if test "x$SUFFIX" = "xclass"; then
   1.102 +        # To improve performance when large diffs are found, do a rough filtering of classes
   1.103 +        # elibeble for these exceptions
   1.104 +        if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' \
   1.105 +	        -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
   1.106 +	        -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then
   1.107 +            $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
   1.108 +            $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
   1.109 +            TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
   1.110 +                $GREP '^[<>]' | \
   1.111 +                $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
   1.112 +		     -e '/[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}/d' \
   1.113 + 	             -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
   1.114 +	             -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
   1.115 +	             -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
   1.116 +        fi
   1.117 +    fi
   1.118 +    if test "x$SUFFIX" = "xproperties"; then
   1.119 +        # Run through nawk to add possibly missing newline at end of file.
   1.120 +        $CAT $OTHER_FILE | $NAWK '{ print }' > $OTHER_FILE.cleaned
   1.121 +# Disable this exception since we aren't changing the properties cleaning method yet.
   1.122 +#        $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
   1.123 +#            | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \
   1.124 +#  	    | $SED -e '/^#/d' -e '/^$/d' \
   1.125 +#            -e :a -e '/\\$/N; s/\\\n//; ta' \
   1.126 +#  	    -e 's/^[ \t]*//;s/[ \t]*$//' \
   1.127 +#	    -e 's/\\=/=/' | LC_ALL=C $SORT > $OTHER_FILE.cleaned
   1.128 +        TMP=$(LC_ALL=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
   1.129 +    fi
   1.130 +    if test -n "$TMP"; then
   1.131 +        echo Files $OTHER_FILE and $THIS_FILE differ
   1.132 +        return 1
   1.133 +    fi
   1.134 +
   1.135 +    return 0
   1.136 +}
   1.137 +
   1.138 +##########################################################################################
   1.139 +# Compare directory structure
   1.140 +
   1.141 +compare_dirs() {
   1.142 +    THIS_DIR=$1
   1.143 +    OTHER_DIR=$2
   1.144 +    WORK_DIR=$3
   1.145 +
   1.146 +    mkdir -p $WORK_DIR
   1.147 +
   1.148 +    (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other)
   1.149 +    (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this)
   1.150 +
   1.151 +    $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_other > $WORK_DIR/dirs_diff
   1.152 +    
   1.153 +    echo -n Directory structure...
   1.154 +    if [ -s $WORK_DIR/dirs_diff ]; then
   1.155 +        echo Differences found.
   1.156 +        REGRESSIONS=true
   1.157 +        # Differences in directories found.
   1.158 +        ONLY_OTHER=$($GREP '<' $WORK_DIR/dirs_diff)
   1.159 +        if [ "$ONLY_OTHER" ]; then
   1.160 +            echo Only in $OTHER
   1.161 +            $GREP '<' $WORK_DIR/dirs_diff | $SED 's|< ./|    |g'
   1.162 +        fi
   1.163 +        ONLY_THIS=$($GREP '>' $WORK_DIR/dirs_diff)
   1.164 +        if [ "$ONLY_THIS" ]; then
   1.165 +            echo Only in $THIS
   1.166 +            $GREP '>' $WORK_DIR/dirs_diff | $SED 's|> ./|    |g'
   1.167 +        fi
   1.168 +    else
   1.169 +        echo Identical!
   1.170 +    fi
   1.171 +}
   1.172 +
   1.173 +
   1.174 +##########################################################################################
   1.175 +# Compare file structure
   1.176 +
   1.177 +compare_files() {
   1.178 +    THIS_DIR=$1
   1.179 +    OTHER_DIR=$2
   1.180 +    WORK_DIR=$3
   1.181 +
   1.182 +    $MKDIR -p $WORK_DIR
   1.183 +
   1.184 +    (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other)
   1.185 +    (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this)
   1.186 +    
   1.187 +    $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff
   1.188 +
   1.189 +    echo -n File names...
   1.190 +    if [ -s $WORK_DIR/files_diff ]; then
   1.191 +        echo Differences found.
   1.192 +        REGRESSIONS=true
   1.193 +        # Differences in files found.
   1.194 +        ONLY_OTHER=$($GREP '<' $WORK_DIR/files_diff)
   1.195 +        if [ "$ONLY_OTHER" ]; then
   1.196 +            echo Only in $OTHER
   1.197 +            $GREP '<' $WORK_DIR/files_diff | $SED 's|< ./|    |g'
   1.198 +        fi
   1.199 +        ONLY_THIS=$($GREP '>' $WORK_DIR/files_diff)
   1.200 +        if [ "$ONLY_THIS" ]; then
   1.201 +            echo Only in $THIS
   1.202 +            $GREP '>' $WORK_DIR/files_diff | $SED 's|> ./|    |g'
   1.203 +        fi
   1.204 +    else
   1.205 +        echo Identical!
   1.206 +    fi
   1.207 +}
   1.208 +
   1.209 +
   1.210 +##########################################################################################
   1.211 +# Compare permissions
   1.212 +
   1.213 +compare_permissions() {
   1.214 +    THIS_DIR=$1
   1.215 +    OTHER_DIR=$2
   1.216 +    WORK_DIR=$3
   1.217 +
   1.218 +    mkdir -p $WORK_DIR
   1.219 +
   1.220 +    echo -n Permissions...
   1.221 +    found=""
   1.222 +    for f in `cd $OTHER_DIR && $FIND . -type f`
   1.223 +    do
   1.224 +        if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
   1.225 +        if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
   1.226 +        OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
   1.227 +        TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
   1.228 +        if [ "$OP" != "$TP" ]
   1.229 +        then
   1.230 +	    if [ -z "$found" ]; then echo ; found="yes"; fi
   1.231 +	    $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
   1.232 +        fi
   1.233 +    done
   1.234 +    if [ -z "$found" ]; then 
   1.235 +        echo "Identical!"
   1.236 +    else
   1.237 +        REGRESSIONS=true
   1.238 +    fi
   1.239 +}
   1.240 +
   1.241 +##########################################################################################
   1.242 +# Compare file command output
   1.243 +
   1.244 +compare_file_types() {
   1.245 +    THIS_DIR=$1
   1.246 +    OTHER_DIR=$2
   1.247 +    WORK_DIR=$3
   1.248 +
   1.249 +    $MKDIR -p $WORK_DIR
   1.250 +
   1.251 +    echo -n File types...
   1.252 +    found=""
   1.253 +    for f in `cd $OTHER_DIR && $FIND . ! -type d`
   1.254 +    do
   1.255 +        if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
   1.256 +        if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
   1.257 +        OF=`cd ${OTHER_DIR} && $FILE -h $f`
   1.258 +        TF=`cd ${THIS_DIR} && $FILE -h $f`
   1.259 +        if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]]
   1.260 +        then
   1.261 +	    if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
   1.262 +	    then
   1.263 +	        # the way we produces zip-files make it so that directories are stored in old file
   1.264 +	        # but not in new (only files with full-path)
   1.265 +	        # this makes file-5.09 report them as different
   1.266 +	        continue;
   1.267 +	    fi
   1.268 +        fi
   1.269 +        
   1.270 +        if [ "$OF" != "$TF" ]
   1.271 +        then
   1.272 +	    if [ -z "$found" ]; then echo ; found="yes"; fi
   1.273 +	    $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
   1.274 +        fi
   1.275 +    done
   1.276 +    if [ -z "$found" ]; then 
   1.277 +        echo "Identical!"
   1.278 +    else
   1.279 +        REGRESSIONS=true
   1.280 +    fi
   1.281 +}
   1.282 +
   1.283 +##########################################################################################
   1.284 +# Compare the rest of the files
   1.285 +
   1.286 +compare_general_files() {
   1.287 +    THIS_DIR=$1
   1.288 +    OTHER_DIR=$2
   1.289 +    WORK_DIR=$3
   1.290 +    
   1.291 +    GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
   1.292 +        ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
   1.293 +        ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
   1.294 +        ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
   1.295 +        ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
   1.296 +        | $GREP -v "./bin/"  | $SORT | $FILTER)
   1.297 +
   1.298 +    echo General files...
   1.299 +    for f in $GENERAL_FILES
   1.300 +    do
   1.301 +        if [ -e $OTHER_DIR/$f ]; then
   1.302 +            SUFFIX="${f##*.}"
   1.303 +            if [ "$(basename $f)" = "release" ]; then
   1.304 +                # Ignore differences in change numbers in release file.
   1.305 +                OTHER_FILE=$WORK_DIR/$f.other
   1.306 +                THIS_FILE=$WORK_DIR/$f.this
   1.307 +                $MKDIR -p $(dirname $OTHER_FILE)
   1.308 +                $MKDIR -p $(dirname $THIS_FILE)
   1.309 +                $CAT $OTHER_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $OTHER_FILE
   1.310 +                $CAT $THIS_DIR/$f  | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $THIS_FILE
   1.311 +            elif [ "x$SUFFIX" = "xhtml" ]; then
   1.312 +                # Ignore time stamps in docs files
   1.313 +                OTHER_FILE=$WORK_DIR/$f.other
   1.314 +                THIS_FILE=$WORK_DIR/$f.this
   1.315 +                $MKDIR -p $(dirname $OTHER_FILE)
   1.316 +                $MKDIR -p $(dirname $THIS_FILE)
   1.317 +                #Note that | doesn't work on mac sed.
   1.318 +                $CAT $OTHER_DIR/$f | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
   1.319 +                                          -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
   1.320 +                                          -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)/' \
   1.321 +                                          -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)/' \
   1.322 +                                          -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
   1.323 +                    > $OTHER_FILE
   1.324 +                $CAT $THIS_DIR/$f  | $SED -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
   1.325 +                                          -e 's/\(<meta name="date" content="\).*\(">\)/\1(removed)\2/' \
   1.326 +                                          -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)/' \
   1.327 +                                          -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)/' \
   1.328 +                                          -e 's/^\( from \).*\(\.idl\)$/\1(removed)\2/' \
   1.329 +                    > $THIS_FILE
   1.330 +            else
   1.331 +                OTHER_FILE=$OTHER_DIR/$f
   1.332 +                THIS_FILE=$THIS_DIR/$f
   1.333 +            fi
   1.334 +            DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1)
   1.335 +            if [ -n "$DIFF_OUT" ]; then
   1.336 +                echo $f
   1.337 +                REGRESSIONS=true
   1.338 +                if [ "$SHOW_DIFFS" = "true" ]; then
   1.339 +                    echo "$DIFF_OUT"
   1.340 +                fi
   1.341 +            fi
   1.342 +        fi
   1.343 +    done
   1.344 +
   1.345 +
   1.346 +}
   1.347 +
   1.348 +##########################################################################################
   1.349 +# Compare zip file
   1.350 +
   1.351 +compare_zip_file() {
   1.352 +    THIS_DIR=$1
   1.353 +    OTHER_DIR=$2
   1.354 +    WORK_DIR=$3
   1.355 +    ZIP_FILE=$4
   1.356 +    # Optionally provide different name for other zipfile
   1.357 +    OTHER_ZIP_FILE=$5
   1.358 +
   1.359 +    THIS_ZIP=$THIS_DIR/$ZIP_FILE
   1.360 +    if [ -n "$OTHER_ZIP_FILE" ]; then
   1.361 +        OTHER_ZIP=$OTHER_DIR/$OTHER_ZIP_FILE
   1.362 +    else
   1.363 +        OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
   1.364 +    fi
   1.365 +
   1.366 +    THIS_SUFFIX="${THIS_ZIP##*.}"
   1.367 +    OTHER_SUFFIX="${OTHER_ZIP##*.}"
   1.368 +    if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
   1.369 +        echo The files do not have the same suffix type!
   1.370 +        return 2
   1.371 +    fi
   1.372 +
   1.373 +    TYPE="$THIS_SUFFIX"
   1.374 +
   1.375 +    if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null
   1.376 +    then
   1.377 +        return 0
   1.378 +    fi
   1.379 +    # Not quite identical, the might still contain the same data.
   1.380 +    # Unpack the jar/zip files in temp dirs
   1.381 +    
   1.382 +    THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
   1.383 +    OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
   1.384 +    $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
   1.385 +    $MKDIR -p $THIS_UNZIPDIR
   1.386 +    $MKDIR -p $OTHER_UNZIPDIR
   1.387 +    (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
   1.388 +    (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
   1.389 +
   1.390 +    # Find all archives inside and unzip them as well to compare the contents rather than
   1.391 +    # the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
   1.392 +    EXCEPTIONS="pie.jar.pack.gz"
   1.393 +    for pack in $($FIND $THIS_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do
   1.394 +        ($UNPACK200 $pack $pack.jar)
   1.395 +        # Filter out the unzipped archives from the diff below.
   1.396 +        EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
   1.397 +    done
   1.398 +    for pack in $($FIND $OTHER_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do
   1.399 +        ($UNPACK200 $pack $pack.jar)
   1.400 +        EXCEPTIONS="$EXCEPTIONS $pack $pack.jar"
   1.401 +    done
   1.402 +    for zip in $($FIND $THIS_UNZIPDIR -name "*.jar" -o -name "*.zip"); do
   1.403 +        $MKDIR $zip.unzip
   1.404 +        (cd $zip.unzip && $UNARCHIVE $zip)
   1.405 +        EXCEPTIONS="$EXCEPTIONS $zip"
   1.406 +    done
   1.407 +    for zip in $($FIND $OTHER_UNZIPDIR -name "*.jar" -o -name "*.zip"); do
   1.408 +        $MKDIR $zip.unzip
   1.409 +        (cd $zip.unzip && $UNARCHIVE $zip)
   1.410 +        EXCEPTIONS="$EXCEPTIONS $zip"
   1.411 +    done
   1.412 +
   1.413 +    CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
   1.414 +    # On solaris, there is no -q option.
   1.415 +    if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
   1.416 +        LC_ALL=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \
   1.417 +            | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \
   1.418 +            > $CONTENTS_DIFF_FILE
   1.419 +    else
   1.420 +        LC_ALL=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
   1.421 +    fi
   1.422 +
   1.423 +    ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
   1.424 +    ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE)
   1.425 +
   1.426 +    return_value=0
   1.427 +
   1.428 +    if [ -n "$ONLY_OTHER" ]; then
   1.429 +        echo "        Only OTHER $ZIP_FILE contains:"
   1.430 +        echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR|            |"g | sed 's|: |/|g'
   1.431 +        return_value=1
   1.432 +    fi
   1.433 +
   1.434 +    if [ -n "$ONLY_THIS" ]; then
   1.435 +        echo "        Only THIS $ZIP_FILE contains:"
   1.436 +        echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR|            |"g | sed 's|: |/|g'
   1.437 +        return_value=1
   1.438 +    fi
   1.439 +
   1.440 +    if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
   1.441 +        DIFFING_FILES=$($GREP -e "differ$" -e "^diff " $CONTENTS_DIFF_FILE \
   1.442 +            | $CUT -f 3 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
   1.443 +    else
   1.444 +        DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
   1.445 +            | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
   1.446 +    fi
   1.447 +
   1.448 +    $RM -f $WORK_DIR/$ZIP_FILE.diffs
   1.449 +    for file in $DIFFING_FILES; do
   1.450 +	if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
   1.451 +            diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
   1.452 +	fi
   1.453 +    done
   1.454 +
   1.455 +    if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
   1.456 +        return_value=1
   1.457 +        echo "        Differing files in $ZIP_FILE"
   1.458 +        $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP differ | cut -f 2 -d ' ' | \
   1.459 +            $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
   1.460 +        $CAT $WORK_DIR/$ZIP_FILE.difflist
   1.461 +
   1.462 +        if [ -n "$SHOW_DIFFS" ]; then
   1.463 +            for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
   1.464 +                if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
   1.465 +                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
   1.466 +                elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
   1.467 +                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
   1.468 +                else
   1.469 +                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
   1.470 +                fi
   1.471 +            done
   1.472 +        fi
   1.473 +    fi
   1.474 +
   1.475 +    return $return_value
   1.476 +}
   1.477 +
   1.478 +
   1.479 +##########################################################################################
   1.480 +# Compare all zip files
   1.481 +
   1.482 +compare_all_zip_files() {
   1.483 +    THIS_DIR=$1
   1.484 +    OTHER_DIR=$2
   1.485 +    WORK_DIR=$3
   1.486 +
   1.487 +    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER )
   1.488 +
   1.489 +    if [ -n "$ZIPS" ]; then
   1.490 +        echo Zip files...
   1.491 +
   1.492 +        return_value=0
   1.493 +        for f in $ZIPS; do
   1.494 +            if [ -f "$OTHER_DIR/$f" ]; then
   1.495 +                compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
   1.496 +                if [ "$?" != "0" ]; then
   1.497 +                    return_value=1
   1.498 +                    REGRESSIONS=true
   1.499 +                fi
   1.500 +            fi
   1.501 +        done
   1.502 +    fi
   1.503 +
   1.504 +    return $return_value
   1.505 +}
   1.506 +
   1.507 +##########################################################################################
   1.508 +# Compare all jar files
   1.509 +
   1.510 +compare_all_jar_files() {
   1.511 +    THIS_DIR=$1
   1.512 +    OTHER_DIR=$2
   1.513 +    WORK_DIR=$3
   1.514 +
   1.515 +    # TODO filter?
   1.516 +    ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" | $SORT | $FILTER)
   1.517 +
   1.518 +    if [ -n "$ZIPS" ]; then
   1.519 +        echo Jar files...
   1.520 +
   1.521 +        return_value=0
   1.522 +        for f in $ZIPS; do
   1.523 +            if [ -f "$OTHER_DIR/$f" ]; then
   1.524 +                compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
   1.525 +                if [ "$?" != "0" ]; then
   1.526 +                    return_value=1
   1.527 +                    REGRESSIONS=true
   1.528 +                fi
   1.529 +            fi
   1.530 +        done
   1.531 +    fi
   1.532 +
   1.533 +    return $return_value
   1.534 +}
   1.535 +
   1.536 +##########################################################################################
   1.537 +# Compare binary (executable/library) file
   1.538 +
   1.539 +compare_bin_file() {
   1.540 +    THIS_DIR=$1
   1.541 +    OTHER_DIR=$2
   1.542 +    WORK_DIR=$3
   1.543 +    BIN_FILE=$4
   1.544 +
   1.545 +    THIS_FILE=$THIS_DIR/$BIN_FILE
   1.546 +    OTHER_FILE=$OTHER_DIR/$BIN_FILE
   1.547 +    NAME=$(basename $BIN_FILE)
   1.548 +    WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
   1.549 +    FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
   1.550 +
   1.551 +    $MKDIR -p $FILE_WORK_DIR
   1.552 +
   1.553 +    ORIG_THIS_FILE="$THIS_FILE"
   1.554 +    ORIG_OTHER_FILE="$OTHER_FILE"
   1.555 +
   1.556 +    if [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then
   1.557 +        THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME
   1.558 +        OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME
   1.559 +        $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other
   1.560 +        $CP $THIS_FILE $THIS_STRIPPED_FILE
   1.561 +        $CP $OTHER_FILE $OTHER_STRIPPED_FILE
   1.562 +        $STRIP $THIS_STRIPPED_FILE
   1.563 +        $STRIP $OTHER_STRIPPED_FILE
   1.564 +        THIS_FILE="$THIS_STRIPPED_FILE"
   1.565 +        OTHER_FILE="$OTHER_STRIPPED_FILE"
   1.566 +    fi
   1.567 +
   1.568 +    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
   1.569 +	unset _NT_SYMBOL_PATH
   1.570 +	# On windows we need to unzip the debug symbols, if present
   1.571 +	OTHER_FILE_BASE=${OTHER_FILE/.dll/}
   1.572 +	OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/}
   1.573 +	DIZ_NAME=$(basename $OTHER_FILE_BASE).diz
   1.574 +        # java.exe and java.dll diz files will have the same name. Have to
   1.575 +	# make sure java.exe gets the right one. This is only needed for 
   1.576 +	# OTHER since in the new build, all pdb files are left around.
   1.577 +	if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then
   1.578 +	    OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz"
   1.579 +	elif [ -f "${OTHER_FILE_BASE}.diz" ]; then
   1.580 +	    OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz
   1.581 +	else
   1.582 +            # Some files, jli.dll, appears twice in the image but only one of
   1.583 +	    # thme has a diz file next to it.
   1.584 +	    OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)"
   1.585 +	    if [ ! -f "$OTHER_DIZ_FILE" ]; then
   1.586 +		# As a last resort, look for diz file in the whole build output
   1.587 +		# dir.
   1.588 +		OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)"
   1.589 +	    fi
   1.590 +	fi
   1.591 +	if [ -n "$OTHER_DIZ_FILE" ]; then
   1.592 +	    $MKDIR -p $FILE_WORK_DIR/other
   1.593 +	    (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE)
   1.594 +	    export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other"
   1.595 +	fi
   1.596 +	THIS_FILE_BASE=${THIS_FILE/.dll/}
   1.597 +	THIS_FILE_BASE=${THIS_FILE_BASE/.exe/}
   1.598 +	if [ -f "${THIS_FILE/.dll/}.diz" ]; then
   1.599 +	    THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz
   1.600 +	else
   1.601 +	    THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)"
   1.602 +	    if [ ! -f "$THIS_DIZ_FILE" ]; then
   1.603 +		# As a last resort, look for diz file in the whole build output
   1.604 +		# dir.
   1.605 +		THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)"
   1.606 +	    fi
   1.607 +	fi
   1.608 +	if [ -n "$THIS_DIZ_FILE" ]; then
   1.609 +	    $MKDIR -p $FILE_WORK_DIR/this
   1.610 +	    (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE)
   1.611 +	    export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this"
   1.612 +	fi
   1.613 +    fi
   1.614 +
   1.615 +    if [ -z "$SKIP_BIN_DIFF" ]; then
   1.616 +        if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
   1.617 +        # The files were bytewise identical.
   1.618 +            if [ -n "$VERBOSE" ]; then
   1.619 +                echo "        :           :         :         :          : $BIN_FILE"
   1.620 +            fi
   1.621 +            return 0
   1.622 +        fi
   1.623 +        BIN_MSG=" diff "
   1.624 +        if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then
   1.625 +            DIFF_BIN=true
   1.626 +            if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then
   1.627 +                BIN_MSG="*$BIN_MSG*"
   1.628 +                REGRESSIONS=true
   1.629 +            else
   1.630 +                BIN_MSG=" $BIN_MSG "
   1.631 +            fi
   1.632 +        else
   1.633 +            BIN_MSG="($BIN_MSG)"
   1.634 +            DIFF_BIN=
   1.635 +        fi
   1.636 +    fi
   1.637 +
   1.638 +    if [ -n "$STAT" ]; then
   1.639 +        THIS_SIZE=$($STAT $STAT_PRINT_SIZE "$THIS_FILE")
   1.640 +        OTHER_SIZE=$($STAT $STAT_PRINT_SIZE "$OTHER_FILE")
   1.641 +    else
   1.642 +        THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }')
   1.643 +        OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }')
   1.644 +    fi
   1.645 +    if [ $THIS_SIZE -ne $OTHER_SIZE ]; then
   1.646 +        DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE)
   1.647 +        DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
   1.648 +        SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
   1.649 +        if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \
   1.650 +	    && [ "$DIFF_SIZE_REL" -lt 102 ]; then
   1.651 +            SIZE_MSG="($SIZE_MSG)"
   1.652 +            DIFF_SIZE=
   1.653 +        elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
   1.654 +	    && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
   1.655 +	    && [ "$DIFF_SIZE_NUM" = 512 ]; then
   1.656 +	    # On windows, size of binaries increase in 512 increments.
   1.657 +            SIZE_MSG="($SIZE_MSG)"
   1.658 +            DIFF_SIZE=
   1.659 +        elif [ "$OPENJDK_TARGET_OS" = "windows" ] \
   1.660 +	    && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \
   1.661 +	    && [ "$DIFF_SIZE_NUM" = -512 ]; then
   1.662 +	    # On windows, size of binaries increase in 512 increments.
   1.663 +            SIZE_MSG="($SIZE_MSG)"
   1.664 +            DIFF_SIZE=
   1.665 +        else
   1.666 +            if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
   1.667 +                DIFF_SIZE=true
   1.668 +                if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
   1.669 +                    SIZE_MSG="*$SIZE_MSG*"
   1.670 +                    REGRESSIONS=true
   1.671 +                else
   1.672 +                    SIZE_MSG=" $SIZE_MSG "
   1.673 +                fi
   1.674 +            else
   1.675 +                SIZE_MSG="($SIZE_MSG)"
   1.676 +                DIFF_SIZE=
   1.677 +            fi
   1.678 +        fi
   1.679 +    else
   1.680 +        SIZE_MSG="           "
   1.681 +        DIFF_SIZE=
   1.682 +        if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then
   1.683 +            SIZE_MSG="     !     "
   1.684 +        fi
   1.685 +    fi
   1.686 +
   1.687 +    if [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then
   1.688 +        SYM_SORT_CMD="sort"
   1.689 +    else
   1.690 +        SYM_SORT_CMD="cat"
   1.691 +    fi
   1.692 +
   1.693 +    # Check symbols
   1.694 +    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
   1.695 +        # The output from dumpbin on windows differs depending on if the debug symbol
   1.696 +        # files are still around at the location the binary is pointing too. Need
   1.697 +	# to filter out that extra information.
   1.698 +	$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
   1.699 +	$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
   1.700 +    elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
   1.701 +        # Some symbols get seemingly random 15 character prefixes. Filter them out.
   1.702 +        $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
   1.703 +	$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
   1.704 +    else
   1.705 +	$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
   1.706 +	$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
   1.707 +    fi
   1.708 +    
   1.709 +    LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
   1.710 +    if [ -s $WORK_FILE_BASE.symbols.diff ]; then
   1.711 +        SYM_MSG=" diff  "
   1.712 +        if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
   1.713 +            DIFF_SYM=true
   1.714 +            if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then
   1.715 +                SYM_MSG="*$SYM_MSG*"
   1.716 +                REGRESSIONS=true
   1.717 +            else
   1.718 +                SYM_MSG=" $SYM_MSG "
   1.719 +            fi
   1.720 +        else
   1.721 +            SYM_MSG="($SYM_MSG)"            
   1.722 +            DIFF_SYM=
   1.723 +        fi
   1.724 +    else
   1.725 +        SYM_MSG="         "
   1.726 +        DIFF_SYM=
   1.727 +        if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then
   1.728 +            SYM_MSG="    !    "
   1.729 +        fi
   1.730 +    fi
   1.731 +
   1.732 +    # Check dependencies
   1.733 +    if [ -n "$LDD_CMD" ]; then
   1.734 +	(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)
   1.735 +	(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)
   1.736 +	(cd $FILE_WORK_DIR && $RM -f $NAME)
   1.737 +	
   1.738 +	LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
   1.739 +	LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
   1.740 +	
   1.741 +	if [ -s $WORK_FILE_BASE.deps.diff ]; then
   1.742 +            if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
   1.743 +		DEP_MSG=" diff  "
   1.744 +            else
   1.745 +		DEP_MSG=" redun "
   1.746 +            fi
   1.747 +            if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
   1.748 +		DIFF_DEP=true
   1.749 +		if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
   1.750 +                    DEP_MSG="*$DEP_MSG*"
   1.751 +                    REGRESSIONS=true
   1.752 +		else
   1.753 +                    DEP_MSG=" $DEP_MSG "
   1.754 +		fi
   1.755 +            else
   1.756 +		DEP_MSG="($DEP_MSG)"
   1.757 +		DIFF_DEP=
   1.758 +            fi
   1.759 +	else
   1.760 +	    DEP_MSG="         "
   1.761 +	    DIFF_DEP=
   1.762 +            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
   1.763 +                DEP_MSG="     !      "
   1.764 +            fi
   1.765 +	fi
   1.766 +    else
   1.767 +	DEP_MSG="    -    "
   1.768 +    fi
   1.769 +    
   1.770 +    # Compare fulldump output
   1.771 +    if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then
   1.772 +        $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1
   1.773 +        $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1
   1.774 +        LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff
   1.775 +        
   1.776 +        if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
   1.777 +            ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}')
   1.778 +            ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
   1.779 +            if [[ "$ACCEPTED_ELF_DIFF" != *"$BIN_FILE"* ]]; then
   1.780 +                DIFF_ELF=true
   1.781 +                if [[ "$KNOWN_ELF_DIFF" != *"$BIN_FILE"* ]]; then
   1.782 +                    ELF_MSG="*$ELF_MSG*"
   1.783 +                    REGRESSIONS=true
   1.784 +                else
   1.785 +                    ELF_MSG=" $ELF_MSG "
   1.786 +                fi
   1.787 +            else
   1.788 +                ELF_MSG="($ELF_MSG)"
   1.789 +                DIFF_ELF=
   1.790 +            fi
   1.791 +        else
   1.792 +            ELF_MSG="          "
   1.793 +            DIFF_ELF=
   1.794 +            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
   1.795 +                ELF_MSG="    !    "
   1.796 +            fi
   1.797 +        fi
   1.798 +    fi
   1.799 +
   1.800 +    # Compare disassemble output
   1.801 +    if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then
   1.802 +	if [ -z "$DIS_DIFF_FILTER" ]; then
   1.803 +	    DIS_DIFF_FILTER="$CAT"
   1.804 +	fi
   1.805 +        $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1
   1.806 +        $DIS_CMD $THIS_FILE  | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this  2>&1
   1.807 +        
   1.808 +        LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
   1.809 +        
   1.810 +        if [ -s $WORK_FILE_BASE.dis.diff ]; then
   1.811 +            DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
   1.812 +            DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
   1.813 +            if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then
   1.814 +                DIFF_DIS=true
   1.815 +                if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then
   1.816 +                    DIS_MSG="*$DIS_MSG*"
   1.817 +                    REGRESSIONS=true
   1.818 +                else
   1.819 +                    DIS_MSG=" $DIS_MSG "
   1.820 +                fi
   1.821 +            else
   1.822 +                DIS_MSG="($DIS_MSG)"
   1.823 +                DIFF_DIS=
   1.824 +            fi
   1.825 +        else
   1.826 +            DIS_MSG="          "
   1.827 +            DIFF_DIS=
   1.828 +            if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
   1.829 +                DIS_MSG="    !    "
   1.830 +            fi
   1.831 +        fi
   1.832 +    fi
   1.833 +
   1.834 +
   1.835 +    if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_ELF$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then
   1.836 +        if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi
   1.837 +        if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi
   1.838 +        if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi
   1.839 +        if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi
   1.840 +        if [ -n "$ELF_MSG" ]; then echo -n "$ELF_MSG:"; fi
   1.841 +        if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi
   1.842 +        echo " $BIN_FILE"
   1.843 +        if [ "$SHOW_DIFFS" = "true" ]; then
   1.844 +            if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then
   1.845 +                echo "Symbols diff:"
   1.846 +                $CAT $WORK_FILE_BASE.symbols.diff
   1.847 +            fi
   1.848 +            if [ -s "$WORK_FILE_BASE.deps.diff" ]; then
   1.849 +                echo "Deps diff:"
   1.850 +                $CAT $WORK_FILE_BASE.deps.diff
   1.851 +            fi
   1.852 +            if [ -s "$WORK_FILE_BASE.fulldump.diff" ]; then
   1.853 +                echo "Fulldump diff:"
   1.854 +                $CAT $WORK_FILE_BASE.fulldump.diff
   1.855 +            fi
   1.856 +            if [ -s "$WORK_FILE_BASE.dis.diff" ]; then
   1.857 +                echo "Disassembly diff:"
   1.858 +                $CAT $WORK_FILE_BASE.dis.diff
   1.859 +            fi
   1.860 +        fi
   1.861 +        return 1
   1.862 +    fi
   1.863 +    return 0
   1.864 +}
   1.865 +
   1.866 +##########################################################################################
   1.867 +# Print binary diff header
   1.868 +
   1.869 +print_binary_diff_header() {
   1.870 +    if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi
   1.871 +    if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n "   Size    :"; fi
   1.872 +    if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi
   1.873 +    if [ -z "$SKIP_DEP_DIFF" ]; then echo -n "  Deps   :"; fi
   1.874 +    if [ -z "$SKIP_FULLDUMP_DIFF" ]; then echo -n " Fulldump :"; fi
   1.875 +    if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass   :"; fi
   1.876 +    echo
   1.877 +}
   1.878 +
   1.879 +##########################################################################################
   1.880 +# Compare all libraries
   1.881 +
   1.882 +compare_all_libs() {
   1.883 +    THIS_DIR=$1
   1.884 +    OTHER_DIR=$2
   1.885 +    WORK_DIR=$3
   1.886 +
   1.887 +    LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER)
   1.888 +
   1.889 +    if [ -n "$LIBS" ]; then
   1.890 +        echo Libraries...
   1.891 +        print_binary_diff_header
   1.892 +        for l in $LIBS; do
   1.893 +            if [ -f "$OTHER_DIR/$l" ]; then
   1.894 +                compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l
   1.895 +                if [ "$?" != "0" ]; then
   1.896 +                    return_value=1
   1.897 +                fi
   1.898 +            fi
   1.899 +        done
   1.900 +    fi
   1.901 +
   1.902 +    return $return_value
   1.903 +}
   1.904 +
   1.905 +##########################################################################################
   1.906 +# Compare all executables
   1.907 +
   1.908 +compare_all_execs() {
   1.909 +    THIS_DIR=$1
   1.910 +    OTHER_DIR=$2
   1.911 +    WORK_DIR=$3
   1.912 +
   1.913 +    if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
   1.914 +        EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER)
   1.915 +    else
   1.916 +        EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \
   1.917 +            \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \
   1.918 +            -o -name '*.jar' -o -name '*.diz' -o -name 'jcontrol' -o -name '*.properties' \
   1.919 +            -o -name '*.data' -o -name '*.bfc' -o -name '*.src' -o -name '*.txt' \
   1.920 +            -o -name '*.cfg' -o -name 'meta-index' -o -name '*.properties.ja' \
   1.921 +            -o -name 'classlist' \) | $SORT | $FILTER)
   1.922 +    fi
   1.923 +
   1.924 +    if [ -n "$EXECS" ]; then
   1.925 +        echo Executables...
   1.926 +        print_binary_diff_header
   1.927 +        for e in $EXECS; do
   1.928 +            if [ -f "$OTHER_DIR/$e" ]; then
   1.929 +                compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e
   1.930 +                if [ "$?" != "0" ]; then
   1.931 +                    return_value=1
   1.932 +                fi
   1.933 +            fi
   1.934 +        done
   1.935 +    fi
   1.936 +
   1.937 +    return $return_value
   1.938 +}
   1.939 +
   1.940 +##########################################################################################
   1.941 +# Initiate configuration
   1.942 +
   1.943 +COMPARE_ROOT=/tmp/cimages.$USER
   1.944 +$MKDIR -p $COMPARE_ROOT
   1.945 +if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
   1.946 +    if [ "$(uname -o)" = "Cygwin" ]; then
   1.947 +	COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
   1.948 +    fi
   1.949 +fi
   1.950 +
   1.951 +THIS="$( cd "$( dirname "$0" )" && pwd )"
   1.952 +echo "$THIS"
   1.953 +THIS_SCRIPT="$0"
   1.954 +
   1.955 +if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
   1.956 +    echo "bash ./compare.sh [OPTIONS] [FILTER]"
   1.957 +    echo ""
   1.958 +    echo "-all                Compare all files in all known ways"
   1.959 +    echo "-names              Compare the file names and directory structure"
   1.960 +    echo "-perms              Compare the permission bits on all files and directories"
   1.961 +    echo "-types              Compare the output of the file command on all files"
   1.962 +    echo "-general            Compare the files not convered by the specialized comparisons"
   1.963 +    echo "-zips               Compare the contents of all zip files"
   1.964 +    echo "-jars               Compare the contents of all jar files"
   1.965 +    echo "-libs               Compare all native libraries"
   1.966 +    echo "-execs              Compare all executables"
   1.967 +    echo "-v                  Verbose output, does not hide known differences"
   1.968 +    echo "-vv                 More verbose output, shows diff output of all comparisons"
   1.969 +    echo "-o [OTHER]          Compare with build in other directory. Will default to the old build directory"
   1.970 +    echo ""
   1.971 +    echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
   1.972 +    echo "Example:"
   1.973 +    echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
   1.974 +    echo ""
   1.975 +    echo "-2zips <file1> <file2> Compare two zip files only"
   1.976 +    echo ""
   1.977 +    exit 10
   1.978 +fi
   1.979 +
   1.980 +CMP_NAMES=false
   1.981 +CMP_PERMS=false
   1.982 +CMP_TYPES=false
   1.983 +CMP_GENERAL=false
   1.984 +CMP_ZIPS=false
   1.985 +CMP_JARS=false
   1.986 +CMP_LIBS=false
   1.987 +CMP_EXECS=false
   1.988 +
   1.989 +while [ -n "$1" ]; do
   1.990 +    case "$1" in
   1.991 +        -v)
   1.992 +            VERBOSE=true
   1.993 +            ;;
   1.994 +        -vv)
   1.995 +            VERBOSE=true
   1.996 +            SHOW_DIFFS=true
   1.997 +            ;;
   1.998 +        -o)
   1.999 +            OTHER="$2"
  1.1000 +            shift
  1.1001 +            ;;
  1.1002 +        -all)
  1.1003 +            CMP_NAMES=true
  1.1004 +            if [ "$OPENJDK_TARGET_OS" != "windows" ]; then
  1.1005 +                CMP_PERMS=true
  1.1006 +            fi
  1.1007 +            CMP_TYPES=true
  1.1008 +            CMP_GENERAL=true
  1.1009 +            CMP_ZIPS=true
  1.1010 +            CMP_JARS=true
  1.1011 +            CMP_LIBS=true
  1.1012 +            CMP_EXECS=true
  1.1013 +            ;;
  1.1014 +        -names)
  1.1015 +            CMP_NAMES=true
  1.1016 +            ;;
  1.1017 +        -perms)
  1.1018 +            CMP_PERMS=true
  1.1019 +            ;;
  1.1020 +        -types)
  1.1021 +            CMP_TYPES=true
  1.1022 +            ;;
  1.1023 +        -general)
  1.1024 +            CMP_GENERAL=true
  1.1025 +            ;;
  1.1026 +        -zips)
  1.1027 +            CMP_ZIPS=true
  1.1028 +            ;;
  1.1029 +        -jars)
  1.1030 +            CMP_JARS=true
  1.1031 +            ;;
  1.1032 +        -libs)
  1.1033 +            CMP_LIBS=true
  1.1034 +            ;;
  1.1035 +        -execs)
  1.1036 +            CMP_EXECS=true
  1.1037 +            ;;
  1.1038 +        -2zips)
  1.1039 +            CMP_2_ZIPS=true
  1.1040 +            THIS_FILE=$2
  1.1041 +            OTHER_FILE=$3
  1.1042 +            shift
  1.1043 +            shift
  1.1044 +            ;;
  1.1045 +        *)
  1.1046 +            CMP_NAMES=false
  1.1047 +            CMP_PERMS=false
  1.1048 +            CMP_TYPES=false
  1.1049 +            CMP_ZIPS=true
  1.1050 +            CMP_JARS=true
  1.1051 +            CMP_LIBS=true
  1.1052 +            CMP_EXECS=true
  1.1053 +            
  1.1054 +            if [ -z "$FILTER" ]; then
  1.1055 +                FILTER="$GREP"
  1.1056 +            fi
  1.1057 +            FILTER="$FILTER -e $1"
  1.1058 +            ;;
  1.1059 +    esac
  1.1060 +    shift
  1.1061 +done
  1.1062 +
  1.1063 +if [ "$CMP_2_ZIPS" = "true" ]; then
  1.1064 +    THIS_DIR="$(dirname $THIS_FILE)"
  1.1065 +    THIS_DIR="$(cd "$THIS_DIR" && pwd )"
  1.1066 +    OTHER_DIR="$(dirname $OTHER_FILE)"
  1.1067 +    OTHER_DIR="$(cd "$OTHER_DIR" && pwd )"
  1.1068 +    THIS_FILE_NAME="$(basename $THIS_FILE)"
  1.1069 +    OTHER_FILE_NAME="$(basename $OTHER_FILE)"
  1.1070 +    echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME
  1.1071 +    compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME
  1.1072 +    exit
  1.1073 +fi
  1.1074 +
  1.1075 +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
  1.1076 +    CMP_NAMES=true
  1.1077 +    CMP_PERMS=true
  1.1078 +    CMP_TYPES=true
  1.1079 +    CMP_GENERAL=true
  1.1080 +    CMP_ZIPS=true
  1.1081 +    CMP_JARS=true
  1.1082 +    CMP_LIBS=true
  1.1083 +    CMP_EXECS=true
  1.1084 +fi
  1.1085 +
  1.1086 +if [ -z "$FILTER" ]; then
  1.1087 +    FILTER="$CAT"
  1.1088 +fi
  1.1089 +
  1.1090 +if [ -z "$OTHER" ]; then
  1.1091 +    OTHER="$THIS/../$LEGACY_BUILD_DIR"
  1.1092 +    if [ -d "$OTHER" ]; then
  1.1093 +        OTHER="$( cd "$OTHER" && pwd )"
  1.1094 +    else
  1.1095 +        echo "Default old build directory does not exist:"
  1.1096 +        echo "$OTHER"
  1.1097 +        exit 1
  1.1098 +    fi
  1.1099 +    echo "Comparing to default old build:"
  1.1100 +    echo "$OTHER"
  1.1101 +    echo
  1.1102 +else
  1.1103 +    if [ ! -d "$OTHER" ]; then
  1.1104 +        echo "Other build directory does not exist:"
  1.1105 +        echo "$OTHER"
  1.1106 +        exit 1
  1.1107 +    fi
  1.1108 +    OTHER="$( cd "$OTHER" && pwd )"
  1.1109 +    echo "Comparing to:"
  1.1110 +    echo "$OTHER"
  1.1111 +    echo
  1.1112 +fi
  1.1113 +
  1.1114 +
  1.1115 +# Figure out the layout of the this build. Which kinds of images have been produced
  1.1116 +if [ -d "$THIS/install/j2sdk-image" ]; then
  1.1117 +    THIS_J2SDK="$THIS/install/j2sdk-image"
  1.1118 +    THIS_J2RE="$THIS/install/j2re-image"
  1.1119 +    echo "Selecting install images in this build"
  1.1120 +elif [ -d "$THIS/deploy/j2sdk-image" ]; then
  1.1121 +    THIS_J2SDK="$THIS/deploy/j2sdk-image"
  1.1122 +    THIS_J2RE="$THIS/deploy/j2re-image"
  1.1123 +    echo "Selecting deploy images in this build"
  1.1124 +elif [ -d "$THIS/images/j2sdk-image" ]; then
  1.1125 +    THIS_J2SDK="$THIS/images/j2sdk-image"
  1.1126 +    THIS_J2RE="$THIS/images/j2re-image"
  1.1127 +    echo "Selecting jdk images in this build"
  1.1128 +fi
  1.1129 +
  1.1130 +if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
  1.1131 +    if [ -d "$THIS/install/j2sdk-image" ]; then
  1.1132 +        # If there is an install image, prefer that, it's also overlay
  1.1133 +        THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
  1.1134 +        THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
  1.1135 +        echo "Selecting install overlay images in this build"
  1.1136 +    else
  1.1137 +        THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
  1.1138 +        THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
  1.1139 +        echo "Selecting jdk overlay images in this build"
  1.1140 +    fi
  1.1141 +fi
  1.1142 +
  1.1143 +if [ -d "$THIS/images/j2sdk-bundle" ]; then
  1.1144 +    THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
  1.1145 +    THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
  1.1146 +    echo "Selecting bundles in this build"
  1.1147 +fi
  1.1148 +
  1.1149 +# Figure out the layout of the other build (old or new, normal or overlay image)
  1.1150 +if [ -d "$OTHER/j2sdk-image" ]; then
  1.1151 +    if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
  1.1152 +        OTHER_J2SDK="$OTHER/j2sdk-image"
  1.1153 +        OTHER_J2RE="$OTHER/j2re-image"
  1.1154 +        echo "Selecting old-style images in other build"
  1.1155 +    else
  1.1156 +        OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
  1.1157 +        OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
  1.1158 +        echo "Selecting overlay images in other build"
  1.1159 +    fi
  1.1160 +elif [ -d "$OTHER/install/j2sdk-image" ]; then
  1.1161 +    OTHER_J2SDK="$OTHER/install/j2sdk-image"
  1.1162 +    OTHER_J2RE="$OTHER/install/j2re-image"
  1.1163 +    echo "Selecting install images in other build"
  1.1164 +elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
  1.1165 +    OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
  1.1166 +    OTHER_J2RE="$OTHER/deploy/j2re-image"
  1.1167 +    echo "Selecting deploy images in other build"
  1.1168 +elif [ -d "$OTHER/images/j2sdk-image" ]; then
  1.1169 +    OTHER_J2SDK="$OTHER/images/j2sdk-image"
  1.1170 +    OTHER_J2RE="$OTHER/images/j2re-image"
  1.1171 +    echo "Selecting jdk images in other build"
  1.1172 +fi
  1.1173 +
  1.1174 +if [ -d "$OTHER/j2sdk-bundle" ]; then
  1.1175 +    OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
  1.1176 +    OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
  1.1177 +    echo "Selecting bundles in other build"
  1.1178 +elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
  1.1179 +    OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
  1.1180 +    OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
  1.1181 +    echo "Selecting jdk bundles in other build"
  1.1182 +fi
  1.1183 +
  1.1184 +if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
  1.1185 +    if [ -z "$THIS_J2SDK_OVERLAY" ]; then
  1.1186 +        echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
  1.1187 +        exit 1
  1.1188 +    fi
  1.1189 +fi
  1.1190 +
  1.1191 +if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
  1.1192 +    echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
  1.1193 +    exit 1
  1.1194 +fi
  1.1195 +
  1.1196 +if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
  1.1197 +    echo "WARNING! OTHER build has bundles built while this build does not."
  1.1198 +    echo "Skipping bundle compare!"
  1.1199 +fi
  1.1200 +
  1.1201 +if [ -d "$THIS/docs" ]; then
  1.1202 +    THIS_DOCS="$THIS/docs"
  1.1203 +fi
  1.1204 +
  1.1205 +if [ -d "$OTHER/docs" ]; then
  1.1206 +    OTHER_DOCS="$OTHER/docs"
  1.1207 +fi
  1.1208 +
  1.1209 +if [ -z "$THIS_DOCS" ]; then
  1.1210 +    echo "WARNING! Docs haven't been built and won't be compared."
  1.1211 +fi
  1.1212 +
  1.1213 +if [ -z "$OTHER_DOCS" ]; then
  1.1214 +    echo "WARNING! Other build doesn't contain docs, skipping doc compare."
  1.1215 +fi
  1.1216 +
  1.1217 +if [ -d "$OTHER/images" ]; then
  1.1218 +    OTHER_SEC_DIR="$OTHER/images"
  1.1219 +else
  1.1220 +    OTHER_SEC_DIR="$OTHER/tmp"
  1.1221 +fi
  1.1222 +OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip"
  1.1223 +THIS_SEC_DIR="$THIS/images"
  1.1224 +THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip"
  1.1225 +if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
  1.1226 +    if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
  1.1227 +        JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip"
  1.1228 +    else
  1.1229 +        JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip"
  1.1230 +    fi
  1.1231 +    OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip"
  1.1232 +    OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN"
  1.1233 +    THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip"
  1.1234 +    THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
  1.1235 +fi
  1.1236 +
  1.1237 +##########################################################################################
  1.1238 +# Do the work
  1.1239 +
  1.1240 +if [ "$CMP_NAMES" = "true" ]; then
  1.1241 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1242 +        echo -n "J2SDK "
  1.1243 +        compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1244 +        echo -n "J2RE  "
  1.1245 +        compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
  1.1246 +        
  1.1247 +        echo -n "J2SDK "
  1.1248 +        compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1249 +        echo -n "J2RE  "
  1.1250 +        compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
  1.1251 +    fi
  1.1252 +    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
  1.1253 +        echo -n "J2SDK Overlay "
  1.1254 +        compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1255 +        echo -n "J2RE  Overlay "
  1.1256 +        compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
  1.1257 +        
  1.1258 +        echo -n "J2SDK Overlay "
  1.1259 +        compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1260 +        echo -n "J2RE  Overlay "
  1.1261 +        compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
  1.1262 +    fi
  1.1263 +    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
  1.1264 +        echo -n "J2SDK Bundle "
  1.1265 +        compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
  1.1266 +        echo -n "J2RE  Bundle "
  1.1267 +        compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
  1.1268 +        
  1.1269 +        echo -n "J2SDK Bundle "
  1.1270 +        compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
  1.1271 +        echo -n "J2RE  Bundle "
  1.1272 +        compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
  1.1273 +    fi
  1.1274 +    if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
  1.1275 +        echo -n "Docs "
  1.1276 +        compare_dirs $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
  1.1277 +        echo -n "Docs "
  1.1278 +        compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
  1.1279 +    fi
  1.1280 +fi
  1.1281 +
  1.1282 +if [ "$CMP_PERMS" = "true" ]; then
  1.1283 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1284 +        echo -n "J2SDK "
  1.1285 +        compare_permissions $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1286 +        echo -n "J2RE  "
  1.1287 +        compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
  1.1288 +    fi
  1.1289 +    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
  1.1290 +        echo -n "J2SDK Overlay "
  1.1291 +        compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1292 +        echo -n "J2RE  Overlay "
  1.1293 +        compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
  1.1294 +    fi
  1.1295 +    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
  1.1296 +        echo -n "J2SDK Bundle "
  1.1297 +        compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
  1.1298 +        echo -n "J2RE  Bundle "
  1.1299 +        compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
  1.1300 +    fi
  1.1301 +fi
  1.1302 +
  1.1303 +if [ "$CMP_TYPES" = "true" ]; then
  1.1304 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1305 +        echo -n "J2SDK "
  1.1306 +        compare_file_types $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1307 +        echo -n "J2RE  "
  1.1308 +        compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
  1.1309 +    fi
  1.1310 +    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
  1.1311 +        echo -n "J2SDK Overlay "
  1.1312 +        compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1313 +        echo -n "J2RE  Overlay "
  1.1314 +        compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
  1.1315 +    fi
  1.1316 +    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
  1.1317 +        echo -n "J2SDK Bundle "
  1.1318 +        compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
  1.1319 +        echo -n "J2RE  Bundle "
  1.1320 +        compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
  1.1321 +    fi
  1.1322 +fi
  1.1323 +
  1.1324 +if [ "$CMP_GENERAL" = "true" ]; then
  1.1325 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1326 +        echo -n "J2SDK "
  1.1327 +        compare_general_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1328 +        echo -n "J2RE  "
  1.1329 +        compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
  1.1330 +    fi
  1.1331 +    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
  1.1332 +        echo -n "J2SDK Overlay "
  1.1333 +        compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1334 +        echo -n "J2RE  Overlay "
  1.1335 +        compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
  1.1336 +    fi
  1.1337 +    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
  1.1338 +        echo -n "J2SDK Bundle "
  1.1339 +        compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
  1.1340 +        echo -n "J2RE  Bundle "
  1.1341 +        compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
  1.1342 +    fi
  1.1343 +    if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
  1.1344 +        echo -n "Docs "
  1.1345 +        compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs
  1.1346 +    fi
  1.1347 +fi
  1.1348 +
  1.1349 +if [ "$CMP_ZIPS" = "true" ]; then
  1.1350 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1351 +        compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1352 +    fi
  1.1353 +    if [ -n "$THIS_SEC_BIN" ] && [ -n "$OTHER_SEC_BIN" ]; then
  1.1354 +        if [ -n "$(echo $THIS_SEC_BIN | $FILTER)" ]; then
  1.1355 +            echo "sec-bin.zip..."
  1.1356 +            compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-bin.zip
  1.1357 +        fi
  1.1358 +    fi
  1.1359 +    if [ -n "$THIS_SEC_WINDOWS_BIN" ] && [ -n "$OTHER_SEC_WINDOWS_BIN" ]; then
  1.1360 +        if [ -n "$(echo $THIS_SEC_WINDOWS_BIN | $FILTER)" ]; then
  1.1361 +            echo "sec-windows-bin.zip..."
  1.1362 +            compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-windows-bin.zip
  1.1363 +        fi
  1.1364 +    fi
  1.1365 +    if [ -n "$THIS_JGSS_WINDOWS_BIN" ] && [ -n "$OTHER_JGSS_WINDOWS_BIN" ]; then
  1.1366 +        if [ -n "$(echo $THIS_JGSS_WINDOWS_BIN | $FILTER)" ]; then
  1.1367 +            echo "$JGSS_WINDOWS_BIN..."
  1.1368 +            compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin $JGSS_WINDOWS_BIN
  1.1369 +        fi
  1.1370 +    fi
  1.1371 +fi
  1.1372 +
  1.1373 +if [ "$CMP_JARS" = "true" ]; then
  1.1374 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1375 +        compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1376 +    fi
  1.1377 +fi
  1.1378 +
  1.1379 +if [ "$CMP_LIBS" = "true" ]; then
  1.1380 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1381 +        echo -n "J2SDK "
  1.1382 +        compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1383 +        if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
  1.1384 +            echo -n "J2RE  "
  1.1385 +            compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
  1.1386 +        fi
  1.1387 +    fi
  1.1388 +    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
  1.1389 +        echo -n "Bundle   "
  1.1390 +        compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1391 +    fi
  1.1392 +fi
  1.1393 +
  1.1394 +if [ "$CMP_EXECS" = "true" ]; then
  1.1395 +    if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
  1.1396 +        compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
  1.1397 +    fi
  1.1398 +    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
  1.1399 +        echo -n "Overlay "
  1.1400 +        compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
  1.1401 +    fi
  1.1402 +fi
  1.1403 +
  1.1404 +echo
  1.1405 +
  1.1406 +if [ -n "$REGRESSIONS" ]; then
  1.1407 +    echo "REGRESSIONS FOUND!"
  1.1408 +    echo
  1.1409 +    exit 1
  1.1410 +else
  1.1411 +    echo "No regressions found"
  1.1412 +    echo
  1.1413 +    exit 0
  1.1414 +fi

mercurial