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