compare.sh revision 1961:f900d5afd9c8
162590Sitojun#!/bin/bash 2122615Sume# 362590Sitojun# Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. 455505Sshin# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 555505Sshin# 655505Sshin# This code is free software; you can redistribute it and/or modify it 755505Sshin# under the terms of the GNU General Public License version 2 only, as 855505Sshin# published by the Free Software Foundation. 955505Sshin# 1055505Sshin# This code is distributed in the hope that it will be useful, but WITHOUT 1155505Sshin# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1255505Sshin# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1355505Sshin# version 2 for more details (a copy is included in the LICENSE file that 1455505Sshin# accompanied this code). 1555505Sshin# 1655505Sshin# You should have received a copy of the GNU General Public License version 1755505Sshin# 2 along with this work; if not, write to the Free Software Foundation, 1855505Sshin# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1955505Sshin# 2055505Sshin# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2155505Sshin# or visit www.oracle.com if you need additional information or have any 2255505Sshin# questions. 2355505Sshin# 2455505Sshin 2555505Sshin# This script is processed by configure before it's usable. It is run from 2655505Sshin# the root of the build directory. 2755505Sshin 2855505Sshin 2955505Sshin################################################################################ 3055505Sshin 3155505Sshin# Check that we are run via the wrapper generated by configure 3255505Sshinif [ -z "$SRC_ROOT" ]; then 3355505Sshin echo "Error: You must run this script using build/[conf]/compare.sh" 3455505Sshin exit 1 3555505Sshinfi 3655505Sshin 3755505Sshinif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then 3855505Sshin FULLDUMP_CMD="$OTOOL -v -V -h -X -d" 3955505Sshin LDD_CMD="$OTOOL -L" 4055505Sshin DIS_CMD="$OTOOL -v -V -t" 4155505Sshin STAT_PRINT_SIZE="-f %z" 4255505Sshinelif [ "$OPENJDK_TARGET_OS" = "windows" ]; then 4355505Sshin FULLDUMP_CMD="$DUMPBIN -all" 4455505Sshin LDD_CMD="$DUMPBIN -dependants | $GREP .dll" 4555505Sshin DIS_CMD="$DUMPBIN -disasm:nobytes" 4655505Sshin STAT_PRINT_SIZE="-c %s" 4755505Sshinelif [ "$OPENJDK_TARGET_OS" = "aix" ]; then 4855505Sshin FULLDUMP_CMD="dump -h -r -t -n -X64" 4955505Sshin LDD_CMD="$LDD" 5055505Sshin DIS_CMD="$OBJDUMP -d" 5155505Sshin STAT_PRINT_SIZE="-c %s" 5255505Sshinelse 5355505Sshin FULLDUMP_CMD="$READELF -a" 5455505Sshin LDD_CMD="$LDD" 5555505Sshin DIS_CMD="$OBJDUMP -d" 5655505Sshin STAT_PRINT_SIZE="-c %s" 5755505Sshinfi 5855505Sshin 5955505SshinCOMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/common/bin/compare_exceptions.sh.incl" 6055505Sshinif [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then 6155505Sshin echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE" 6255505Sshin exit 1 6355505Sshinfi 6455505Sshin# Include exception definitions 6555505Sshin. "$COMPARE_EXCEPTIONS_INCLUDE" 6655505Sshin 6755505Sshin################################################################################ 6855505Sshin# Compare text files and ignore specific differences: 6955505Sshin# 7055505Sshin# * Timestamps in Java sources generated by idl2java 7155505Sshin# * Sorting order and cleanup style in .properties files 7255505Sshin 7355505Sshindiff_text() { 7455505Sshin OTHER_FILE=$1 7555505Sshin THIS_FILE=$2 7655505Sshin 7755505Sshin SUFFIX="${THIS_FILE##*.}" 7855505Sshin 7955505Sshin TMP=1 8055505Sshin 8155505Sshin if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then 82253999Shrs # Filter out date string, ant version and java version differences. 8378064Sume TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ 8455505Sshin $GREP '^[<>]' | \ 8555505Sshin $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \ 8655505Sshin -e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \ 8755505Sshin -e '/[<>] [Corpatin]*)/d' \ 8855505Sshin -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d') 8955505Sshin fi 9055505Sshin if test "x$SUFFIX" = "xjava"; then 9155505Sshin TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ 9255505Sshin $GREP '^[<>]' | \ 9355505Sshin $SED -e '/[<>] \* from.*\.idl/d' \ 9455505Sshin -e '/[<>] .*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \ 9555505Sshin -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \ 9655505Sshin -e '/\/\/ Generated from input file.*/d' \ 9755505Sshin -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \ 9855505Sshin -e '/\/\/ java GenerateCharacter.*/d') 9955505Sshin fi 100265778Smelifaro # Ignore date strings in class files. 10155505Sshin # Anonymous lambda classes get randomly assigned counters in their names. 10255505Sshin if test "x$SUFFIX" = "xclass"; then 10355505Sshin # To improve performance when large diffs are found, do a rough filtering of classes 10455505Sshin # elibeble for these exceptions 10555505Sshin if $GREP -R -e '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}' \ 10655505Sshin -e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then 10755505Sshin $JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap 10855505Sshin $JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap 10955505Sshin TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \ 11055505Sshin $GREP '^[<>]' | \ 11155505Sshin $SED -e '/[<>].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d' \ 11255505Sshin -e '/[<>].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d') 113186119Sqingli fi 114186119Sqingli fi 115196866Sbz if test "x$SUFFIX" = "xproperties"; then 116186119Sqingli # Filter out date string differences. 117186119Sqingli TMP=$(LC_ALL=C $DIFF $OTHER_FILE $THIS_FILE | \ 118100650Sjmallett $GREP '^[<>]' | \ 11962590Sitojun $SED -e '/[<>].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d') 12062590Sitojun fi 12162590Sitojun if test "x$SUFFIX" = "xhtml"; then 12262590Sitojun # Some javadoc versions do not put quotes around font size 12362590Sitojun HTML_FILTER="$SED \ 12455505Sshin -e 's/<font size=-1>/<font size=\"-1\">/g'" 12562590Sitojun $CAT $THIS_FILE | eval "$HTML_FILTER" > $THIS_FILE.filtered 12662590Sitojun $CAT $OTHER_FILE | eval "$HTML_FILTER" > $OTHER_FILE.filtered 12762590Sitojun TMP=$(LC_ALL=C $DIFF $OTHER_FILE.filtered $THIS_FILE.filtered | \ 12855505Sshin $GREP '^[<>]' | \ 129173412Skevlo $SED -e '/[<>] <!-- Generated by javadoc .* on .* -->/d' \ 130265778Smelifaro -e '/[<>] <meta name="date" content=".*">/d' ) 131173412Skevlo fi 132173412Skevlo if test -n "$TMP"; then 133173412Skevlo echo Files $OTHER_FILE and $THIS_FILE differ 134173412Skevlo return 1 135259176Sae fi 136173412Skevlo 137173412Skevlo return 0 138173412Skevlo} 139173412Skevlo 140173412Skevlo################################################################################ 141173412Skevlo# Compare directory structure 142173412Skevlo 143173412Skevlocompare_dirs() { 144173412Skevlo THIS_DIR=$1 145173412Skevlo OTHER_DIR=$2 146173412Skevlo WORK_DIR=$3 14762590Sitojun 148173412Skevlo mkdir -p $WORK_DIR 149173412Skevlo 15062590Sitojun (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other) 151173412Skevlo (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this) 152253999Shrs 15355505Sshin $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_this > $WORK_DIR/dirs_diff 154122615Sume 15578064Sume echo -n Directory structure... 15678064Sume if [ -s $WORK_DIR/dirs_diff ]; then 15778064Sume echo Differences found. 15878064Sume REGRESSIONS=true 15978064Sume # Differences in directories found. 16078064Sume ONLY_OTHER=$($GREP '<' $WORK_DIR/dirs_diff) 161122615Sume if [ "$ONLY_OTHER" ]; then 16278064Sume echo Only in $OTHER 163122615Sume $GREP '<' $WORK_DIR/dirs_diff | $SED 's|< ./| |g' 164122615Sume fi 165122615Sume ONLY_THIS=$($GREP '>' $WORK_DIR/dirs_diff) 16655505Sshin if [ "$ONLY_THIS" ]; then 167259169Sae echo Only in $THIS 16855505Sshin $GREP '>' $WORK_DIR/dirs_diff | $SED 's|> ./| |g' 16955505Sshin fi 17055505Sshin else 17155505Sshin echo Identical! 17255505Sshin fi 173122615Sume} 174121156Sume 17555505Sshin 17655505Sshin################################################################################ 177122615Sume# Compare file structure 178122615Sume 179122615Sumecompare_files() { 180122615Sume THIS_DIR=$1 181122615Sume OTHER_DIR=$2 182122615Sume WORK_DIR=$3 183122615Sume 184122615Sume $MKDIR -p $WORK_DIR 185122615Sume 186122615Sume (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other) 187122615Sume (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this) 188122615Sume 189122615Sume $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff 19055505Sshin 19155505Sshin echo -n File names... 192122615Sume if [ -s $WORK_DIR/files_diff ]; then 193265778Smelifaro echo Differences found. 194265778Smelifaro REGRESSIONS=true 195122615Sume # Differences in files found. 19655505Sshin ONLY_OTHER=$($GREP '<' $WORK_DIR/files_diff) 197122615Sume if [ "$ONLY_OTHER" ]; then 198122615Sume echo Only in $OTHER 199122615Sume $GREP '<' $WORK_DIR/files_diff | $SED 's|< ./| |g' 200122615Sume fi 201122615Sume ONLY_THIS=$($GREP '>' $WORK_DIR/files_diff) 20255505Sshin if [ "$ONLY_THIS" ]; then 20355505Sshin echo Only in $THIS 20455505Sshin $GREP '>' $WORK_DIR/files_diff | $SED 's|> ./| |g' 20555505Sshin fi 20655505Sshin else 20755505Sshin echo Identical! 20855505Sshin fi 209122615Sume} 210122615Sume 211122615Sume 212122615Sume################################################################################ 213122615Sume# Compare permissions 21455505Sshin 215122615Sumecompare_permissions() { 21655505Sshin THIS_DIR=$1 217122615Sume OTHER_DIR=$2 218122615Sume WORK_DIR=$3 21955505Sshin 22055505Sshin mkdir -p $WORK_DIR 22155505Sshin 22255505Sshin echo -n Permissions... 22355505Sshin found="" 22455505Sshin for f in `cd $OTHER_DIR && $FIND . -type f` 22555505Sshin do 22655505Sshin if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi 227122615Sume if [ ! -f ${THIS_DIR}/$f ]; then continue; fi 228122615Sume OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'` 229122615Sume TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'` 230122615Sume if [ "$OP" != "$TP" ] 23155505Sshin then 232122615Sume if [ -z "$found" ]; then echo ; found="yes"; fi 233122615Sume $PRINTF "\tother: ${OP} this: ${TP}\t$f\n" 234122615Sume fi 235122615Sume done 236122615Sume if [ -z "$found" ]; then 237122615Sume echo "Identical!" 238122615Sume else 239122615Sume REGRESSIONS=true 240122615Sume fi 241122615Sume} 242122615Sume 243122615Sume################################################################################ 244122615Sume# Compare file command output 245122615Sume 246122615Sumecompare_file_types() { 247122615Sume THIS_DIR=$1 248122615Sume OTHER_DIR=$2 249122615Sume WORK_DIR=$3 250122615Sume 251122615Sume $MKDIR -p $WORK_DIR 252122615Sume 253122615Sume echo -n File types... 254122615Sume found="" 255122615Sume for f in `cd $OTHER_DIR && $FIND . ! -type d` 256122615Sume do 257122615Sume if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi 258122615Sume if [ ! -f ${THIS_DIR}/$f ]; then continue; fi 259122615Sume OF=`cd ${OTHER_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` 260122615Sume TF=`cd ${THIS_DIR} && $FILE -h $f | $SED 's/BuildID[^,]*//g'` 261122615Sume if [ "$OF" != "$TF" ] 262122615Sume then 263122615Sume if [ "`echo $OF | $GREP -c 'Zip archive data'`" -gt 0 ] \ 264122615Sume && [ "`echo $TF | $GREP -c 'Zip archive data'`" -gt 0 ] 265122615Sume then 26655505Sshin # the way we produce zip-files make it so that directories are stored in 267122615Sume # old file but not in new (only files with full-path) this makes file 268122615Sume # report them as different 269122615Sume continue 270122615Sume else 271122615Sume if [ -z "$found" ]; then echo ; found="yes"; fi 272122615Sume $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n" 273122615Sume fi 274122615Sume fi 275122615Sume done 27655505Sshin if [ -z "$found" ]; then 277122615Sume echo "Identical!" 278122615Sume else 27955505Sshin REGRESSIONS=true 28055505Sshin fi 28155505Sshin} 282122615Sume 283122615Sume################################################################################ 284122615Sume# Compare the rest of the files 285122615Sume 286122615Sumecompare_general_files() { 28755505Sshin THIS_DIR=$1 288122615Sume OTHER_DIR=$2 289122615Sume WORK_DIR=$3 290122615Sume 291122615Sume GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" \ 292122615Sume ! -name "*.zip" ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \ 293122615Sume ! -name "modules" ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \ 29455505Sshin ! -name "*.cpl" ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \ 295122615Sume ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" ! -name "*.jmod" \ 296122615Sume ! -name "*.obj" ! -name "*.o" ! -name "JavaControlPanelHelper" \ 297122615Sume ! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \ 298122615Sume ! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \ 299122615Sume ! -name "finish_installation" ! -name "Sparkle" \ 300122615Sume | $GREP -v "./bin/" | $SORT | $FILTER) 30155505Sshin 302122615Sume echo Other files with binary differences... 303122615Sume for f in $GENERAL_FILES 304122615Sume do 305122615Sume if [ -e $OTHER_DIR/$f ]; then 306122615Sume SUFFIX="${f##*.}" 307122615Sume if [ "$(basename $f)" = "release" ]; then 308122615Sume # Ignore differences in change numbers in release file. 309122615Sume OTHER_FILE=$WORK_DIR/$f.other 31055505Sshin THIS_FILE=$WORK_DIR/$f.this 31155505Sshin $MKDIR -p $(dirname $OTHER_FILE) 31255505Sshin $MKDIR -p $(dirname $THIS_FILE) 31355505Sshin RELEASE_FILTER="$SED \ 31455505Sshin -e 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' \ 31555505Sshin -e 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}/<DATE>/g' 31655505Sshin " 317265778Smelifaro $CAT $OTHER_DIR/$f | eval "$RELEASE_FILTER" > $OTHER_FILE 318259169Sae $CAT $THIS_DIR/$f | eval "$RELEASE_FILTER" > $THIS_FILE 31955505Sshin elif [ "x$SUFFIX" = "xhtml" ]; then 32055505Sshin # Ignore time stamps in docs files 32155505Sshin OTHER_FILE=$WORK_DIR/$f.other 322265778Smelifaro THIS_FILE=$WORK_DIR/$f.this 32355505Sshin $MKDIR -p $(dirname $OTHER_FILE) $(dirname $THIS_FILE) 324265778Smelifaro # Older versions of compare might have left soft links with 325265778Smelifaro # these names. 32655505Sshin $RM $OTHER_FILE $THIS_FILE 32755505Sshin #Note that | doesn't work on mac sed. 32855505Sshin HTML_FILTER="$SED \ 32955505Sshin -e 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}/<DATE>/g' \ 33055505Sshin -e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \ 33155505Sshin -e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [0-9]\{4\} [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/<DATE>/' 332167260Skevlo " 333265778Smelifaro $CAT $OTHER_DIR/$f | eval "$HTML_FILTER" > $OTHER_FILE 334265778Smelifaro $CAT $THIS_DIR/$f | eval "$HTML_FILTER" > $THIS_FILE 335265778Smelifaro else 336265778Smelifaro OTHER_FILE=$OTHER_DIR/$f 337265778Smelifaro THIS_FILE=$THIS_DIR/$f 338122615Sume fi 339122615Sume DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1) 34055505Sshin if [ -n "$DIFF_OUT" ]; then 341265778Smelifaro echo $f 34255505Sshin REGRESSIONS=true 34355505Sshin if [ "$SHOW_DIFFS" = "true" ]; then 34455505Sshin echo "$DIFF_OUT" 34555505Sshin fi 34655505Sshin fi 34755505Sshin fi 34855505Sshin done 34955505Sshin 35055505Sshin 35155505Sshin} 35255505Sshin 35355505Sshin################################################################################ 35455505Sshin# Compare zip file 35555505Sshin 35655505Sshincompare_zip_file() { 35755505Sshin THIS_DIR=$1 358121156Sume OTHER_DIR=$2 359121156Sume WORK_DIR=$3 36055505Sshin ZIP_FILE=$4 36155505Sshin # Optionally provide different name for other zipfile 36255505Sshin OTHER_ZIP_FILE=$5 36355505Sshin 36462590Sitojun THIS_ZIP=$THIS_DIR/$ZIP_FILE 36555505Sshin if [ -n "$OTHER_ZIP_FILE" ]; then 36655505Sshin OTHER_ZIP=$OTHER_DIR/$OTHER_ZIP_FILE 367253999Shrs else 368253999Shrs OTHER_ZIP=$OTHER_DIR/$ZIP_FILE 36955505Sshin fi 37055505Sshin 37155505Sshin THIS_SUFFIX="${THIS_ZIP##*.}" 37255505Sshin OTHER_SUFFIX="${OTHER_ZIP##*.}" 37355505Sshin if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then 37455505Sshin echo "The files do not have the same suffix type! ($THIS_SUFFIX != $OTHER_SUFFIX)" 37555505Sshin return 2 37655505Sshin fi 37755505Sshin 378259169Sae TYPE="$THIS_SUFFIX" 37955505Sshin 38055505Sshin if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null 38155505Sshin then 38255505Sshin return 0 38355505Sshin fi 38455505Sshin # Not quite identical, the might still contain the same data. 38555505Sshin # Unpack the jar/zip files in temp dirs 38655505Sshin 38755505Sshin THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this 38855505Sshin OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other 38955505Sshin $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR 39055505Sshin $MKDIR -p $THIS_UNZIPDIR 39155505Sshin $MKDIR -p $OTHER_UNZIPDIR 39255505Sshin if [ "$TYPE" = "jar" || "$TYPE" = "war" || "$TYPE" = "zip" || "$TYPE" = "jmod"] 39355505Sshin then 39455505Sshin (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP) 39555505Sshin (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP) 39655505Sshin else 39755505Sshin (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP) 39855505Sshin (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP) 39955505Sshin fi 40055505Sshin 40155505Sshin # Find all archives inside and unzip them as well to compare the contents rather than 40255505Sshin # the archives. pie.jar.pack.gz i app3.war is corrupt, skip it. 403243903Shrs EXCEPTIONS="pie.jar.pack.gz" 404243903Shrs for pack in $($FIND $THIS_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do 40555505Sshin ($UNPACK200 $pack $pack.jar) 40655505Sshin # Filter out the unzipped archives from the diff below. 40755505Sshin EXCEPTIONS="$EXCEPTIONS $pack $pack.jar" 40855505Sshin done 40955505Sshin for pack in $($FIND $OTHER_UNZIPDIR \( -name "*.pack" -o -name "*.pack.gz" \) -a ! -name pie.jar.pack.gz); do 41055505Sshin ($UNPACK200 $pack $pack.jar) 411253999Shrs EXCEPTIONS="$EXCEPTIONS $pack $pack.jar" 412121156Sume done 413253999Shrs for zip in $($FIND $THIS_UNZIPDIR -name "*.jar" -o -name "*.zip"); do 414253970Shrs $MKDIR $zip.unzip 41562590Sitojun (cd $zip.unzip && $UNARCHIVE $zip) 41662590Sitojun EXCEPTIONS="$EXCEPTIONS $zip" 41755505Sshin done 41855505Sshin for zip in $($FIND $OTHER_UNZIPDIR -name "*.jar" -o -name "*.zip"); do 41955505Sshin $MKDIR $zip.unzip 420121156Sume (cd $zip.unzip && $UNARCHIVE $zip) 421121156Sume EXCEPTIONS="$EXCEPTIONS $zip" 42255505Sshin done 42355505Sshin 424259171Sae CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff 42555505Sshin # On solaris, there is no -q option. 42655505Sshin if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then 427122615Sume LC_ALL=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \ 428122615Sume | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \ 429122615Sume > $CONTENTS_DIFF_FILE 430122615Sume else 431210936Sjhb LC_ALL=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE 432122615Sume fi 433122615Sume 43455505Sshin ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE) 43562590Sitojun ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE) 43662590Sitojun 43755505Sshin return_value=0 43862590Sitojun 43955505Sshin if [ -n "$ONLY_OTHER" ]; then 44055505Sshin echo " Only OTHER $ZIP_FILE contains:" 44155505Sshin echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR| |"g | sed 's|: |/|g' 44255505Sshin return_value=1 44355505Sshin fi 44455505Sshin 44555505Sshin if [ -n "$ONLY_THIS" ]; then 44655505Sshin echo " Only THIS $ZIP_FILE contains:" 44755505Sshin echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR| |"g | sed 's|: |/|g' 44855505Sshin return_value=1 44955505Sshin fi 45055505Sshin 45155505Sshin if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then 45255505Sshin DIFFING_FILES=$($GREP -e 'differ$' -e '^diff ' $CONTENTS_DIFF_FILE \ 453259169Sae | $SED -e 's/^Files //g' -e 's/diff -r //g' | $CUT -f 1 -d ' ' \ 45455505Sshin | $SED "s|$OTHER_UNZIPDIR/||g") 45555505Sshin else 45655505Sshin DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \ 45755505Sshin | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g") 45855505Sshin fi 45955505Sshin 46055505Sshin $RM -f $WORK_DIR/$ZIP_FILE.diffs 46155505Sshin for file in $DIFFING_FILES; do 46255505Sshin if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then 46355505Sshin diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs 46455505Sshin fi 465121156Sume done 46655505Sshin 46755505Sshin if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then 46855505Sshin return_value=1 469259176Sae echo " Differing files in $ZIP_FILE" 470259176Sae $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP 'differ$' | cut -f 2 -d ' ' | \ 471259176Sae $SED "s|$OTHER_UNZIPDIR| |g" > $WORK_DIR/$ZIP_FILE.difflist 47255505Sshin $CAT $WORK_DIR/$ZIP_FILE.difflist 47355505Sshin 474121156Sume if [ -n "$SHOW_DIFFS" ]; then 475121156Sume for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do 47655505Sshin if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then 47755505Sshin LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap 47855505Sshin elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then 47955505Sshin LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i 48055505Sshin else 48155505Sshin LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i 48255505Sshin fi 48355505Sshin done 48455505Sshin fi 485259169Sae fi 48655505Sshin 48755505Sshin return $return_value 48855505Sshin} 489186119Sqingli 49055505Sshin 49155505Sshin################################################################################ 49255505Sshin# Compare all zip files 49355505Sshin 49455505Sshincompare_all_zip_files() { 49555505Sshin THIS_DIR=$1 49655505Sshin OTHER_DIR=$2 49755505Sshin WORK_DIR=$3 49855505Sshin 49955505Sshin ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER ) 50055505Sshin 50155505Sshin if [ -n "$ZIPS" ]; then 502121156Sume echo Zip files... 50355505Sshin 50455505Sshin return_value=0 50555505Sshin for f in $ZIPS; do 506243903Shrs if [ -f "$OTHER_DIR/$f" ]; then 507243903Shrs compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f 50855505Sshin if [ "$?" != "0" ]; then 509121156Sume return_value=1 510121156Sume REGRESSIONS=true 51155505Sshin fi 51255505Sshin fi 513259171Sae done 51455505Sshin fi 51555505Sshin 51662590Sitojun return $return_value 51778064Sume} 51855505Sshin 51962590Sitojun################################################################################ 52062590Sitojun# Compare all jar files 52155505Sshin 52262590Sitojuncompare_all_jar_files() { 52355505Sshin THIS_DIR=$1 52455505Sshin OTHER_DIR=$2 52555505Sshin WORK_DIR=$3 52655505Sshin 52755505Sshin # TODO filter? 528186119Sqingli ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \ 529186119Sqingli -o -name "modules" -o -name "*.jmod" | $SORT | $FILTER) 530186119Sqingli 531186119Sqingli if [ -n "$ZIPS" ]; then 532186119Sqingli echo Jar files... 533186500Sqingli 53455505Sshin return_value=0 535243903Shrs for f in $ZIPS; do 536243903Shrs if [ -f "$OTHER_DIR/$f" ]; then 537121156Sume compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f 538121156Sume if [ "$?" != "0" ]; then 53955505Sshin return_value=1 54055505Sshin REGRESSIONS=true 54155505Sshin fi 54255505Sshin fi 54355505Sshin done 54455505Sshin fi 545122615Sume 54678064Sume return $return_value 54778064Sume} 54878064Sume 54955505Sshin################################################################################ 55055505Sshin# Compare binary (executable/library) file 55155505Sshin 55255505Sshincompare_bin_file() { 553259176Sae THIS_DIR=$1 55455505Sshin OTHER_DIR=$2 55555505Sshin WORK_DIR=$3 55655505Sshin BIN_FILE=$4 55762590Sitojun OTHER_BIN_FILE=$5 55855505Sshin 55955505Sshin THIS_FILE=$THIS_DIR/$BIN_FILE 56055505Sshin if [ -n "$OTHER_BIN_FILE" ]; then 56155505Sshin OTHER_FILE=$OTHER_DIR/$OTHER_BIN_FILE 56255505Sshin else 563253999Shrs OTHER_FILE=$OTHER_DIR/$BIN_FILE 56455505Sshin fi 56578064Sume NAME=$(basename $BIN_FILE) 56678064Sume WORK_FILE_BASE=$WORK_DIR/$BIN_FILE 56762590Sitojun FILE_WORK_DIR=$(dirname $WORK_FILE_BASE) 56878064Sume 56955505Sshin $MKDIR -p $FILE_WORK_DIR 57055505Sshin 57166865Ssumikawa # Make soft links to original files from work dir to facilitate debugging 572122615Sume $LN -f -s $THIS_FILE $WORK_FILE_BASE.this 57378064Sume $LN -f -s $OTHER_FILE $WORK_FILE_BASE.other 574122615Sume 57555505Sshin ORIG_THIS_FILE="$THIS_FILE" 57655505Sshin ORIG_OTHER_FILE="$OTHER_FILE" 57755505Sshin 57855505Sshin if [ "$STRIP_ALL" = "true" ] || [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then 57955505Sshin THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME 58055505Sshin OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME 58155505Sshin $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other 582186119Sqingli $CP $THIS_FILE $THIS_STRIPPED_FILE 58355505Sshin $CP $OTHER_FILE $OTHER_STRIPPED_FILE 584186119Sqingli $STRIP $THIS_STRIPPED_FILE 585186119Sqingli $STRIP $OTHER_STRIPPED_FILE 586186119Sqingli THIS_FILE="$THIS_STRIPPED_FILE" 58755505Sshin OTHER_FILE="$OTHER_STRIPPED_FILE" 58855505Sshin fi 58955505Sshin 59055505Sshin if [ "$OPENJDK_TARGET_OS" = "windows" ]; then 591121156Sume unset _NT_SYMBOL_PATH 59255505Sshin # On windows we need to unzip the debug symbols, if present 59355505Sshin OTHER_FILE_BASE=${OTHER_FILE/.dll/} 59455505Sshin OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} 59555505Sshin OTHER_FILE_BASE=${OTHER_FILE_BASE/.cpl/} 59655505Sshin DIZ_NAME=$(basename $OTHER_FILE_BASE).diz 59755505Sshin # Some .exe files have the same name as a .dll file. Make sure the exe 59855505Sshin # files get the right debug symbols. 59955505Sshin if [ "$NAME" = "java.exe" ] \ 60055505Sshin && [ -f "$OTHER/support/native/java.base/java_objs/java.diz" ]; then 60155505Sshin OTHER_DIZ_FILE="$OTHER/support/native/java.base/java_objs/java.diz" 60255505Sshin elif [ "$NAME" = "jimage.exe" ] \ 603259171Sae && [ -f "$OTHER/support/native/jdk.dev/jimage_objs/jimage.diz" ]; then 60478064Sume OTHER_DIZ_FILE="$OTHER/support/native/jdk.dev/jimage_objs/jimage.diz" 60578064Sume elif [ "$NAME" = "javacpl.exe" ] \ 60678064Sume && [ -f "$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then 60778064Sume OTHER_DIZ_FILE="$OTHER/support/native/jdk.plugin/javacpl/javacpl.diz" 60878064Sume elif [ -f "${OTHER_FILE_BASE}.diz" ]; then 60978064Sume OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz 61078064Sume else 61178064Sume # Some files, jli.dll, appears twice in the image but only one of 612121156Sume # thme has a diz file next to it. 61378064Sume OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" 61478064Sume if [ ! -f "$OTHER_DIZ_FILE" ]; then 61578064Sume # As a last resort, look for diz file in the whole build output 61678064Sume # dir. 61778064Sume OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" 61878064Sume fi 61978064Sume fi 62078064Sume if [ -n "$OTHER_DIZ_FILE" ]; then 621122615Sume $MKDIR -p $FILE_WORK_DIR/other 622122615Sume (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) 623122615Sume export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" 62455505Sshin fi 625259176Sae 626259176Sae THIS_FILE_BASE=${THIS_FILE/.dll/} 627259176Sae THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} 62855505Sshin THIS_FILE_BASE=${THIS_FILE_BASE/.cpl/} 62955505Sshin # Some .exe files have the same name as a .dll file. Make sure the exe 63055505Sshin # files get the right debug symbols. 63155505Sshin if [ "$NAME" = "java.exe" ] \ 63255505Sshin && [ -f "$THIS/support/native/java.base/java_objs/java.diz" ]; then 63355505Sshin THIS_DIZ_FILE="$THIS/support/native/java.base/java_objs/java.diz" 63455505Sshin elif [ "$NAME" = "jimage.exe" ] \ 63555505Sshin && [ -f "$THIS/support/native/jdk.dev/jimage_objs/jimage.diz" ]; then 63655505Sshin THIS_DIZ_FILE="$THIS/support/native/jdk.dev/jimage_objs/jimage.diz" 63755505Sshin elif [ "$NAME" = "javacpl.exe" ] \ 63855505Sshin && [ -f "$THIS/support/native/jdk.plugin/javacpl/javacpl.diz" ]; then 639121156Sume THIS_DIZ_FILE="$THIS/support/native/jdk.plugin/javacpl/javacpl.diz" 640122615Sume elif [ -f "${THIS_FILE_BASE}.diz" ]; then 64181366Ssumikawa THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz 64281366Ssumikawa else 64381366Ssumikawa THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" 644122615Sume if [ ! -f "$THIS_DIZ_FILE" ]; then 645122615Sume # As a last resort, look for diz file in the whole build output 646122615Sume # dir. 64781366Ssumikawa THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" 64866865Ssumikawa fi 64981366Ssumikawa fi 65066865Ssumikawa if [ -n "$THIS_DIZ_FILE" ]; then 65166865Ssumikawa $MKDIR -p $FILE_WORK_DIR/this 652253999Shrs (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) 65355505Sshin export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" 654253970Shrs fi 65555505Sshin fi 65678064Sume 65778064Sume if [ -z "$SKIP_BIN_DIFF" ]; then 65878064Sume if cmp $OTHER_FILE $THIS_FILE > /dev/null; then 65978064Sume # The files were bytewise identical. 66078064Sume if [ -n "$VERBOSE" ]; then 66178064Sume echo " : : : : : : $BIN_FILE" 66278064Sume fi 66378064Sume return 0 66478064Sume fi 66578064Sume BIN_MSG=" diff " 66678064Sume if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then 66778064Sume DIFF_BIN=true 66855505Sshin if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then 66978064Sume BIN_MSG="*$BIN_MSG*" 67078064Sume REGRESSIONS=true 67155505Sshin else 67255505Sshin BIN_MSG=" $BIN_MSG " 67362590Sitojun fi 67455505Sshin else 675253970Shrs BIN_MSG="($BIN_MSG)" 67655505Sshin DIFF_BIN= 677253970Shrs fi 67878064Sume fi 67955505Sshin 68055505Sshin if [ -n "$STAT" ]; then 68155505Sshin THIS_SIZE=$($STAT $STAT_PRINT_SIZE "$THIS_FILE") 68255505Sshin OTHER_SIZE=$($STAT $STAT_PRINT_SIZE "$OTHER_FILE") 683121156Sume else 684121156Sume THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }') 68555505Sshin OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }') 68655505Sshin fi 68778064Sume if [ $THIS_SIZE -ne $OTHER_SIZE ]; then 688121156Sume DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE) 68955505Sshin DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE) 69055505Sshin SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM) 69178064Sume if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \ 692121156Sume && [ "$DIFF_SIZE_REL" -lt 102 ]; then 69355505Sshin SIZE_MSG="($SIZE_MSG)" 69455505Sshin DIFF_SIZE= 695121156Sume elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ 69655505Sshin && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ 69755505Sshin && [ "$DIFF_SIZE_NUM" = 512 ]; then 698121156Sume # On windows, size of binaries increase in 512 increments. 69955505Sshin SIZE_MSG="($SIZE_MSG)" 70055505Sshin DIFF_SIZE= 701121156Sume elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ 70255505Sshin && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ 70355505Sshin && [ "$DIFF_SIZE_NUM" = -512 ]; then 704121156Sume # On windows, size of binaries increase in 512 increments. 70555505Sshin SIZE_MSG="($SIZE_MSG)" 70655505Sshin DIFF_SIZE= 707121156Sume else 70855505Sshin if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then 70955505Sshin DIFF_SIZE=true 71055505Sshin if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then 71155505Sshin SIZE_MSG="*$SIZE_MSG*" 71255505Sshin REGRESSIONS=true 71355505Sshin else 71478064Sume SIZE_MSG=" $SIZE_MSG " 71555505Sshin fi 71655505Sshin else 71755505Sshin SIZE_MSG="($SIZE_MSG)" 71855505Sshin DIFF_SIZE= 71962590Sitojun fi 72062590Sitojun fi 72162590Sitojun else 72262590Sitojun SIZE_MSG=" " 72362590Sitojun DIFF_SIZE= 724121156Sume if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then 725121156Sume SIZE_MSG=" ! " 72662590Sitojun fi 72762590Sitojun fi 728121156Sume 729122615Sume if [ "$SORT_ALL_SYMBOLS" = "true" ] || [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then 73062590Sitojun SYM_SORT_CMD="sort" 731121156Sume else 732121156Sume SYM_SORT_CMD="cat" 733121156Sume fi 734121156Sume 735122615Sume # Check symbols 736122615Sume if [ "$OPENJDK_TARGET_OS" = "windows" ]; then 737122615Sume # The output from dumpbin on windows differs depending on if the debug symbol 738122615Sume # files are still around at the location the binary is pointing too. Need 739122615Sume # to filter out that extra information. 74055505Sshin $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 741122615Sume $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 74255505Sshin elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then 74355505Sshin # Some symbols get seemingly random 15 character prefixes. Filter them out. 744122615Sume $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 74555505Sshin $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 74655505Sshin elif [ "$OPENJDK_TARGET_OS" = "aix" ]; then 74755505Sshin $OBJDUMP -T $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other 74878064Sume $OBJDUMP -T $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this 74978064Sume elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then 75055505Sshin $NM -j $ORIG_OTHER_FILE 2> /dev/null | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other 75155505Sshin $NM -j $ORIG_THIS_FILE 2> /dev/null | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this 75255505Sshin else 753125675Ssumikawa $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 75455505Sshin $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 75555505Sshin fi 75655505Sshin 75755505Sshin LC_ALL=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff 75855505Sshin if [ -s $WORK_FILE_BASE.symbols.diff ]; then 75955505Sshin SYM_MSG=" diff " 760259169Sae if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then 76155505Sshin DIFF_SYM=true 76255505Sshin if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then 76355505Sshin SYM_MSG="*$SYM_MSG*" 76455505Sshin REGRESSIONS=true 76555505Sshin else 76655505Sshin SYM_MSG=" $SYM_MSG " 76755505Sshin fi 76855505Sshin else 76955505Sshin SYM_MSG="($SYM_MSG)" 77055505Sshin DIFF_SYM= 77155505Sshin fi 77262590Sitojun else 77362590Sitojun SYM_MSG=" " 77455505Sshin DIFF_SYM= 77555505Sshin if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then 77655505Sshin SYM_MSG=" ! " 77755505Sshin fi 77855505Sshin fi 77955505Sshin 78055505Sshin # Check dependencies 78155505Sshin if [ -n "$LDD_CMD" ]; then 78255505Sshin (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) 783217140Sdelphij (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) 78455505Sshin (cd $FILE_WORK_DIR && $RM -f $NAME) 785121156Sume 786219819Sjeff LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff 78755505Sshin LC_ALL=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq 788219819Sjeff 789217140Sdelphij if [ -s $WORK_FILE_BASE.deps.diff ]; then 790217140Sdelphij if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then 791219819Sjeff DEP_MSG=" diff " 792219819Sjeff else 793219819Sjeff DEP_MSG=" redun " 794219819Sjeff fi 795121156Sume if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then 79655505Sshin DIFF_DEP=true 797121156Sume if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then 79855505Sshin DEP_MSG="*$DEP_MSG*" 79955505Sshin REGRESSIONS=true 80055505Sshin else 801259169Sae DEP_MSG=" $DEP_MSG " 80255505Sshin fi 80355505Sshin else 80455505Sshin DEP_MSG="($DEP_MSG)" 80555505Sshin DIFF_DEP= 806121156Sume fi 80755505Sshin else 80855505Sshin DEP_MSG=" " 80955505Sshin DIFF_DEP= 81055505Sshin if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then 811121156Sume DEP_MSG=" ! " 81255505Sshin fi 81355505Sshin fi 81455505Sshin else 81555505Sshin DEP_MSG=" - " 81655505Sshin fi 81755505Sshin 81855505Sshin # Some linux compilers add a unique Build ID 819122615Sume if [ "$OPENJDK_TARGET_OS" = "linux" ]; then 820122615Sume BUILD_ID_FILTER="$SED -r 's/(Build ID:) [0-9a-f]{40}/\1/'" 82178064Sume else 822122615Sume BUILD_ID_FILTER="$CAT" 823122615Sume fi 824122615Sume 82562590Sitojun # Compare fulldump output 826122615Sume if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then 82762590Sitojun if [ -z "$FULLDUMP_DIFF_FILTER" ]; then 828122615Sume FULLDUMP_DIFF_FILTER="$CAT" 82955505Sshin fi 83055505Sshin $FULLDUMP_CMD $OTHER_FILE | eval "$BUILD_ID_FILTER" | eval "$FULLDUMP_DIFF_FILTER" \ 83155505Sshin > $WORK_FILE_BASE.fulldump.other 2>&1 83255505Sshin $FULLDUMP_CMD $THIS_FILE | eval "$BUILD_ID_FILTER" | eval "$FULLDUMP_DIFF_FILTER" \ 833259169Sae > $WORK_FILE_BASE.fulldump.this 2>&1 83455505Sshin 83555505Sshin LC_ALL=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \ 83655505Sshin > $WORK_FILE_BASE.fulldump.diff 83755505Sshin 83855505Sshin if [ -s $WORK_FILE_BASE.fulldump.diff ]; then 83955505Sshin FULLDUMP_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}') 84055505Sshin FULLDUMP_MSG=$($PRINTF "%8d" $FULLDUMP_DIFF_SIZE) 84155505Sshin if [[ "$ACCEPTED_FULLDUMP_DIFF" != *"$BIN_FILE"* ]]; then 84255505Sshin DIFF_FULLDUMP=true 84355505Sshin if [[ "$KNOWN_FULLDUMP_DIFF" != *"$BIN_FILE"* ]]; then 84455505Sshin FULLDUMP_MSG="*$FULLDUMP_MSG*" 84555505Sshin REGRESSIONS=true 84655505Sshin else 84755505Sshin FULLDUMP_MSG=" $FULLDUMP_MSG " 84855505Sshin fi 84955505Sshin else 85055505Sshin FULLDUMP_MSG="($FULLDUMP_MSG)" 85155505Sshin DIFF_FULLDUMP= 85255505Sshin fi 85355505Sshin else 854122615Sume FULLDUMP_MSG=" " 855122615Sume DIFF_FULLDUMP= 856122615Sume if [[ "$KNOWN_FULLDUMP_DIFF $ACCEPTED_FULLDUMP_DIFF" = *"$BIN_FILE"* ]]; then 857122615Sume FULLDUMP_MSG=" ! " 858186500Sqingli fi 859151473Ssuz fi 86062590Sitojun fi 86162590Sitojun 862124241Ssuz # Compare disassemble output 86362590Sitojun if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then 864151473Ssuz # By default we filter out differences that include references to symbols. 86555505Sshin # To get a raw diff with the complete disassembly, set 86655505Sshin # DIS_DIFF_FILTER="$CAT" 86755505Sshin if [ -z "$DIS_DIFF_FILTER" ]; then 86855505Sshin DIS_DIFF_FILTER="$GREP -v ' # .* <.*>$' | $SED -r -e 's/(\b|x)([0-9a-fA-F]+)(\b|:|>)/X/g'" 86955505Sshin fi 87055505Sshin if [ "$OPENJDK_TARGET_OS" = "windows" ]; then 87155505Sshin DIS_GREP_ARG=-a 872151473Ssuz else 87362590Sitojun DIS_GREP_ARG= 87455505Sshin fi 875151473Ssuz $DIS_CMD $OTHER_FILE | $GREP $DIS_GREP_ARG -v $NAME \ 87655505Sshin | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.other 2>&1 87755505Sshin $DIS_CMD $THIS_FILE | $GREP $DIS_GREP_ARG -v $NAME \ 87855505Sshin | eval "$DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1 87955505Sshin 88055505Sshin LC_ALL=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff 88155505Sshin 88255505Sshin if [ -s $WORK_FILE_BASE.dis.diff ]; then 88355505Sshin DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}') 884121156Sume DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE) 885121156Sume if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then 88655505Sshin DIFF_DIS=true 88755505Sshin if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then 88855505Sshin DIS_MSG="*$DIS_MSG*" 88955505Sshin REGRESSIONS=true 89055505Sshin else 89155505Sshin DIS_MSG=" $DIS_MSG " 89255505Sshin fi 89355505Sshin else 89455505Sshin DIS_MSG="($DIS_MSG)" 89555505Sshin DIFF_DIS= 89655505Sshin fi 89755505Sshin else 898259169Sae DIS_MSG=" " 89955505Sshin DIFF_DIS= 90055505Sshin if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then 90162590Sitojun DIS_MSG=" ! " 90262590Sitojun fi 90378064Sume fi 90478064Sume fi 90578064Sume 90655505Sshin 90755505Sshin if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_FULLDUMP$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then 908121156Sume if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi 909121156Sume if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi 91055505Sshin if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi 91155505Sshin if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi 912121156Sume if [ -n "$FULLDUMP_MSG" ]; then echo -n "$FULLDUMP_MSG:"; fi 91355505Sshin if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi 914121156Sume echo " $BIN_FILE" 915121156Sume if [ "$SHOW_DIFFS" = "true" ]; then 916122615Sume if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then 91762590Sitojun echo "Symbols diff:" 91862590Sitojun $CAT $WORK_FILE_BASE.symbols.diff 919122615Sume fi 92062590Sitojun if [ -s "$WORK_FILE_BASE.deps.diff" ]; then 92162590Sitojun echo "Deps diff:" 92262590Sitojun $CAT $WORK_FILE_BASE.deps.diff 92362590Sitojun fi 92462590Sitojun if [ -s "$WORK_FILE_BASE.fulldump.diff" ]; then 92562590Sitojun echo "Fulldump diff:" 92662590Sitojun $CAT $WORK_FILE_BASE.fulldump.diff 92762590Sitojun fi 92862590Sitojun if [ -s "$WORK_FILE_BASE.dis.diff" ]; then 92962590Sitojun echo "Disassembly diff:" 93062590Sitojun $CAT $WORK_FILE_BASE.dis.diff 93162590Sitojun fi 93262590Sitojun fi 93362590Sitojun return 1 93462590Sitojun fi 93562590Sitojun return 0 93662590Sitojun} 937151468Ssuz 938151468Ssuz################################################################################ 939151468Ssuz# Print binary diff header 940151468Ssuz 941151468Ssuzprint_binary_diff_header() { 942151468Ssuz if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi 943151468Ssuz if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n " Size :"; fi 944151468Ssuz if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi 945151468Ssuz if [ -z "$SKIP_DEP_DIFF" ]; then echo -n " Deps :"; fi 946151468Ssuz if [ -z "$SKIP_FULLDUMP_DIFF" ]; then echo -n " Fulldump :"; fi 947151468Ssuz if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass :"; fi 948151468Ssuz echo 949151468Ssuz} 950151468Ssuz 951151468Ssuz################################################################################ 952151468Ssuz# Compare all libraries 953151468Ssuz 954151468Ssuzcompare_all_libs() { 955151468Ssuz THIS_DIR=$1 956151468Ssuz OTHER_DIR=$2 957151468Ssuz WORK_DIR=$3 958151474Ssuz 95962590Sitojun LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' \ 960118498Sume -o -name '*.dll' -o -name '*.obj' -o -name '*.o' -o -name '*.a' \ 961118498Sume -o -name '*.cpl' \) | $SORT | $FILTER) 962118498Sume 963197138Shrs if [ -n "$LIBS" ]; then 964197138Shrs echo Libraries... 965197138Shrs print_binary_diff_header 966245230Sume for l in $LIBS; do 967245230Sume if [ -f "$OTHER_DIR/$l" ]; then 968245230Sume compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l 969151468Ssuz if [ "$?" != "0" ]; then 970151468Ssuz return_value=1 971151468Ssuz fi 97262590Sitojun fi 97362590Sitojun done 974151468Ssuz fi 975151468Ssuz 976121156Sume return $return_value 97762590Sitojun} 97862590Sitojun 979151468Ssuz################################################################################ 98062590Sitojun# Compare all executables 98162590Sitojun 982121162Sumecompare_all_execs() { 983121162Sume THIS_DIR=$1 984121162Sume OTHER_DIR=$2 985121162Sume WORK_DIR=$3 986121162Sume 987151468Ssuz if [ "$OPENJDK_TARGET_OS" = "windows" ]; then 988151468Ssuz EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER) 989151468Ssuz else 990151468Ssuz EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \ 99155505Sshin \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \ 992121471Sume -o -name '*.jar' -o -name '*.diz' -o -name 'jcontrol' -o -name '*.properties' \ 99355505Sshin -o -name '*.data' -o -name '*.bfc' -o -name '*.src' -o -name '*.txt' \ 99455505Sshin -o -name '*.cfg' -o -name 'meta-index' -o -name '*.properties.ja' \ 995121156Sume -o -name '*.xml' -o -name '*.html' -o -name '*.png' -o -name 'README' \ 99655505Sshin -o -name '*.zip' -o -name '*.jimage' -o -name '*.java' -o -name '*.mf' \ 99762590Sitojun -o -name '*.jpg' -o -name '*.wsdl' -o -name '*.js' -o -name '*.sh' \ 99878064Sume -o -name '*.bat' -o -name '*LICENSE' -o -name '*.d' -o -name '*store' \ 99978064Sume -o -name 'blacklist' -o -name '*certs' -o -name '*.ttf' \ 100078064Sume -o -name '*.jfc' -o -name '*.dat' -o -name 'release' -o -name '*.dir'\ 100178064Sume -o -name '*.sym' -o -name '*.idl' -o -name '*.h' -o -name '*.access' \ 100278064Sume -o -name '*.template' -o -name '*.policy' -o -name '*.security' \ 100378064Sume -o -name 'COPYRIGHT' -o -name '*.1' \ 100478064Sume -o -name 'classlist' \) | $SORT | $FILTER) 1005121156Sume fi 100678064Sume 100778064Sume if [ -n "$EXECS" ]; then 100878064Sume echo Executables... 100978064Sume print_binary_diff_header 101078064Sume for e in $EXECS; do 101178064Sume if [ -f "$OTHER_DIR/$e" ]; then 101278064Sume compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e 101378064Sume if [ "$?" != "0" ]; then 101478064Sume return_value=1 101578064Sume fi 101678064Sume fi 101778064Sume done 1018151472Ssuz fi 1019151472Ssuz 102078064Sume return $return_value 102178064Sume} 102278064Sume 102378064Sume################################################################################ 102478064Sume# Initiate configuration 102578064Sume 102662590SitojunTHIS="$SCRIPT_DIR" 102762590Sitojunecho "$THIS" 1028151474SsuzTHIS_SCRIPT="$0" 1029151474Ssuz 1030151474Ssuzif [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then 1031151474Ssuz echo "bash ./compare.sh [OPTIONS] [FILTER]" 1032118498Sume echo "" 1033118498Sume echo "-all Compare all files in all known ways" 1034118498Sume echo "-names Compare the file names and directory structure" 1035118498Sume echo "-perms Compare the permission bits on all files and directories" 1036118498Sume echo "-types Compare the output of the file command on all files" 1037118498Sume echo "-general Compare the files not convered by the specialized comparisons" 1038197138Shrs echo "-zips Compare the contents of all zip files" 1039197138Shrs echo "-jars Compare the contents of all jar files" 1040197138Shrs echo "-libs Compare all native libraries" 1041197138Shrs echo "-execs Compare all executables" 1042245230Sume echo "-v Verbose output, does not hide known differences" 1043245230Sume echo "-vv More verbose output, shows diff output of all comparisons" 1044245230Sume echo "-o [OTHER] Compare with build in other directory. Will default to the old build directory" 1045245230Sume echo "" 1046122615Sume echo "--sort-symbols Sort all symbols before comparing" 104762590Sitojun echo "--strip Strip all binaries before comparing" 104855505Sshin echo "--clean Clean all previous comparison results first" 1049121156Sume echo "" 105055505Sshin echo "[FILTER] List filenames in the image to compare, works for jars, zips, libs and execs" 105155505Sshin echo "Example:" 105255505Sshin echo "bash ./common/bin/compareimages.sh CodePointIM.jar" 105378064Sume echo "" 105478064Sume echo "-2zips <file1> <file2> Compare two zip files only" 105578064Sume echo "-2bins <file1> <file2> Compare two binary files only" 105678064Sume echo "-2dirs <dir1> <dir2> Compare two directories as if they were images" 105755505Sshin echo "" 105855505Sshin exit 10 105955505Sshinfi 106078064Sume 106178064SumeCMP_NAMES=false 106278064SumeCMP_PERMS=false 106378064SumeCMP_TYPES=false 106478064SumeCMP_GENERAL=false 1065253999ShrsCMP_ZIPS=false 106678064SumeCMP_JARS=false 106778064SumeCMP_LIBS=false 106878064SumeCMP_EXECS=false 106978064Sume 107078064Sumewhile [ -n "$1" ]; do 1071151472Ssuz case "$1" in 1072151472Ssuz -v) 107378064Sume VERBOSE=true 107478064Sume ;; 1075121156Sume -vv) 107678064Sume VERBOSE=true 107778064Sume SHOW_DIFFS=true 107878064Sume ;; 107978064Sume -o) 108078064Sume OTHER="$2" 108178064Sume shift 108278064Sume ;; 108378064Sume -all) 108478064Sume CMP_NAMES=true 108578064Sume if [ "$OPENJDK_TARGET_OS" != "windows" ]; then 108678064Sume CMP_PERMS=true 108778064Sume fi 108878064Sume CMP_TYPES=true 1089121156Sume CMP_GENERAL=true 109078064Sume CMP_ZIPS=true 1091121156Sume CMP_JARS=true 109278064Sume CMP_LIBS=true 1093121156Sume CMP_EXECS=true 109478064Sume ;; 1095121156Sume -names) 1096121156Sume CMP_NAMES=true 109778064Sume ;; 109878064Sume -perms) 1099121156Sume CMP_PERMS=true 1100253999Shrs ;; 110178064Sume -types) 110278064Sume CMP_TYPES=true 110378064Sume ;; 110478064Sume -general) 1105253970Shrs CMP_GENERAL=true 110678064Sume ;; 110778064Sume -zips) 110878064Sume CMP_ZIPS=true 110955505Sshin ;; 111055505Sshin -jars) 1111253999Shrs CMP_JARS=true 111255505Sshin ;; 111355505Sshin -libs) 1114121156Sume CMP_LIBS=true 1115121156Sume ;; 111655505Sshin -execs) 111755505Sshin CMP_EXECS=true 1118121156Sume ;; 111955505Sshin -2dirs) 1120121156Sume THIS="$(cd "$2" > /dev/null && pwd )" 1121121156Sume OTHER="$(cd "$3" > /dev/null && pwd )" 1122121156Sume THIS_BASE_DIR="$THIS" 112362590Sitojun OTHER_BASE_DIR="$OTHER" 112478064Sume SKIP_DEFAULT=true 112555505Sshin shift 112655505Sshin shift 112755505Sshin ;; 112855505Sshin -2zips) 112955505Sshin CMP_2_ZIPS=true 113055505Sshin THIS_FILE=$2 113155505Sshin OTHER_FILE=$3 1132121156Sume shift 1133121156Sume shift 1134121156Sume ;; 113555505Sshin -2bins) 1136121156Sume CMP_2_BINS=true 113755505Sshin THIS_FILE=$2 1138121156Sume OTHER_FILE=$3 1139121156Sume shift 1140253999Shrs shift 114155505Sshin ;; 114255505Sshin --sort-symbols) 114355505Sshin SORT_ALL_SYMBOLS=true 114455505Sshin ;; 1145253970Shrs --strip) 114655505Sshin STRIP_ALL=true 114755505Sshin ;; 114855505Sshin --clean) 114978064Sume CLEAN_OUTPUT=true 115055505Sshin ;; 115155505Sshin *) 115255505Sshin CMP_NAMES=false 115355505Sshin CMP_PERMS=false 115455505Sshin CMP_TYPES=false 115578064Sume CMP_ZIPS=true 115678064Sume CMP_JARS=true 115778064Sume CMP_LIBS=true 115878064Sume CMP_EXECS=true 115978064Sume 116078064Sume if [ -z "$FILTER" ]; then 1161253999Shrs FILTER="$GREP" 116278064Sume fi 116378064Sume FILTER="$FILTER -e $1" 116478064Sume ;; 116578064Sume esac 116678064Sume shift 116778064Sumedone 116878064Sume 116978064Sumeif [ "$STRIP_ALL" = "true" ] && [ -z "$STRIP" ]; then 117078064Sume echo Warning: Not stripping even with --strip, since strip is missing on this platform 117178064Sume STRIP_ALL=false 1172121156Sumefi 117378064Sume 117478064SumeCOMPARE_ROOT=/tmp/cimages.$USER 117578064Sumeif [ "$CLEAN_OUTPUT" = "true" ]; then 117678064Sume echo Cleaning old output in $COMPARE_ROOT. 117778064Sume $RM -rf $COMPARE_ROOT 117878064Sumefi 117978064Sume$MKDIR -p $COMPARE_ROOT 118078064Sumeif [ "$OPENJDK_TARGET_OS" = "windows" ]; then 118178064Sume if [ "$(uname -o)" = "Cygwin" ]; then 118278064Sume COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT) 118378064Sume fi 118478064Sumefi 118578064Sume 118678064Sumeif [ "$CMP_2_ZIPS" = "true" ]; then 118778064Sume THIS_DIR="$(dirname $THIS_FILE)" 118878064Sume THIS_DIR="$(cd "$THIS_DIR" > /dev/null && pwd )" 118978064Sume OTHER_DIR="$(dirname $OTHER_FILE)" 1190121156Sume OTHER_DIR="$(cd "$OTHER_DIR" > /dev/null && pwd )" 119178064Sume THIS_FILE_NAME="$(basename $THIS_FILE)" 1192253999Shrs OTHER_FILE_NAME="$(basename $OTHER_FILE)" 119378064Sume echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME 119478064Sume compare_zip_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2zips $THIS_FILE_NAME $OTHER_FILE_NAME 119578064Sume exit 119678064Sumefi 119778064Sume 1198121156Sumeif [ "$CMP_2_BINS" = "true" ]; then 1199121156Sume THIS_DIR="$(dirname $THIS_FILE)" 1200121156Sume THIS_DIR="$(cd "$THIS_DIR" > /dev/null && pwd )" 1201121156Sume OTHER_DIR="$(dirname $OTHER_FILE)" 120278064Sume OTHER_DIR="$(cd "$OTHER_DIR" > /dev/null && pwd )" 1203121156Sume THIS_FILE_NAME="$(basename $THIS_FILE)" 120478064Sume OTHER_FILE_NAME="$(basename $OTHER_FILE)" 1205121156Sume echo Comparing $THIS_DIR/$THIS_FILE_NAME and $OTHER_DIR/$OTHER_FILE_NAME 120678064Sume compare_bin_file $THIS_DIR $OTHER_DIR $COMPARE_ROOT/2bins $THIS_FILE_NAME $OTHER_FILE_NAME 1207121156Sume exit 120878064Sumefi 120978064Sume 121078064Sumeif [ "$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 1211122615Sume CMP_NAMES=true 121278064Sume CMP_PERMS=true 121378064Sume CMP_TYPES=true 121478064Sume CMP_GENERAL=true 1215122615Sume CMP_ZIPS=true 121678064Sume CMP_JARS=true 121778064Sume CMP_LIBS=true 1218253970Shrs CMP_EXECS=true 121978064Sumefi 1220253970Shrs 122178064Sumeif [ -z "$FILTER" ]; then 122278064Sume FILTER="$CAT" 122378064Sumefi 122478064Sume 122578064Sumeif [ "$SKIP_DEFAULT" != "true" ]; then 122678064Sume if [ -z "$OTHER" ]; then 122778064Sume echo "Nothing to compare to, set with -o" 122878064Sume exit 1 122978064Sume else 123078064Sume if [ ! -d "$OTHER" ]; then 123178064Sume echo "Other build directory does not exist:" 123278064Sume echo "$OTHER" 1233122615Sume exit 1 123478064Sume fi 123578064Sume OTHER="$( cd "$OTHER" > /dev/null && pwd )" 123678064Sume echo "Comparing to:" 123778064Sume echo "$OTHER" 123878064Sume echo 123978064Sume fi 124078064Sume 124178064Sume 124278064Sume # Find the common images to compare, prioritizing later build stages 124378064Sume if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then 1244121156Sume THIS_JDK="$THIS/install/jdk" 1245121156Sume THIS_JRE="$THIS/install/jre" 124678064Sume OTHER_JDK="$OTHER/install/jdk" 1247121156Sume OTHER_JRE="$OTHER/install/jre" 124878064Sume echo "Selecting install images for compare" 124978064Sume elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/deploy/images/jdk" ]; then 125078064Sume THIS_JDK="$THIS/images/jdk" 125178064Sume THIS_JRE="$THIS/images/jre" 125278064Sume OTHER_JDK="$OTHER/deploy/images/jdk" 125378064Sume OTHER_JRE="$OTHER/deploy/images/jre" 125478064Sume echo "Selecting deploy images for compare" 125578064Sume elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then 125678064Sume THIS_JDK="$THIS/images/jdk" 125778064Sume THIS_JRE="$THIS/images/jre" 125878064Sume OTHER_JDK="$OTHER/images/jdk" 125978064Sume OTHER_JRE="$OTHER/images/jre" 126078064Sume echo "Selecting jdk images for compare" 126178064Sume else 126278064Sume echo "No common images found." 126378064Sume exit 1 126478064Sume fi 126578064Sume echo " $THIS_JDK" 126655505Sshin echo " $OTHER_JDK" 126755505Sshin 1268253999Shrs if [ -d "$THIS/images/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \ 126955505Sshin && [ -d "$OTHER/images/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then 1270253999Shrs if [ -d "$THIS/deploy/images/jdk-bundle" ]; then 127155505Sshin THIS_JDK_BUNDLE="$THIS/deploy/images/jdk-bundle" 127255505Sshin THIS_JRE_BUNDLE="$THIS/deploy/images/jre-bundle" 1273121156Sume else 1274121156Sume THIS_JDK_BUNDLE="$THIS/images/jdk-bundle" 127555505Sshin THIS_JRE_BUNDLE="$THIS/images/jre-bundle" 127655505Sshin fi 1277121156Sume if [ -d "$OTHER/deploy/images/jdk-bundle" ]; then 127855505Sshin OTHER_JDK_BUNDLE="$OTHER/deploy/images/jdk-bundle" 1279121156Sume OTHER_JRE_BUNDLE="$OTHER/deploy/images/jre-bundle" 1280121156Sume else 1281121156Sume OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle" 128262590Sitojun OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle" 128355505Sshin fi 128478064Sume echo "Also comparing jdk macosx bundles" 128578064Sume echo " $THIS_JDK_BUNDLE" 128678064Sume echo " $OTHER_JDK_BUNDLE" 128778064Sume fi 128878064Sume 128978064Sume if [ -d "$THIS/deploy/bundles" -o -d "$THIS/deploy/images/bundles" ] \ 129078064Sume && [ -d "$OTHER/deploy/bundles" -o -d "$OTHER/deploy/images/bundles" ]; then 129178064Sume if [ -d "$THIS/deploy/images/bundles" ]; then 129278064Sume THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/images/bundles" 129378064Sume else 129478064Sume THIS_DEPLOY_BUNDLE_DIR="$THIS/deploy/bundles" 129578064Sume fi 129678064Sume if [ -d "$OTHER/deploy/images/bundles" ]; then 129778064Sume OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/images/bundles" 1298121156Sume else 1299121156Sume OTHER_DEPLOY_BUNDLE_DIR="$OTHER/deploy/bundles" 130078064Sume fi 130178064Sume echo "Also comparing deploy javadoc bundles" 130278064Sume fi 130378064Sume 1304121156Sume if [ -d "$THIS/images/JavaAppletPlugin.plugin" ] \ 130578064Sume && [ -d "$OTHER/images/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then 1306253999Shrs if [ -d "$THIS/images/JavaAppletPlugin.plugin" ]; then 130762590Sitojun THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/images/JavaAppletPlugin.plugin" 130862590Sitojun else 130962590Sitojun THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin" 131062590Sitojun fi 131178064Sume if [ -d "$OTHER/images/JavaAppletPlugin.plugin" ]; then 131278064Sume OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/images/JavaAppletPlugin.plugin" 1313121156Sume else 131478064Sume OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin" 131578064Sume fi 131678064Sume echo "Also comparing deploy applet image" 1317121156Sume echo " $THIS_DEPLOY_APPLET_PLUGIN_DIR" 1318121156Sume echo " $OTHER_DEPLOY_APPLET_PLUGIN_DIR" 1319121156Sume fi 1320121156Sume 132178064Sume if [ -d "$THIS/install/sparkle/Sparkle.framework" ] \ 1322121156Sume && [ -d "$OTHER/install/sparkle/Sparkle.framework" ]; then 132378064Sume THIS_SPARKLE_DIR="$THIS/install/sparkle/Sparkle.framework" 1324121156Sume OTHER_SPARKLE_DIR="$OTHER/install/sparkle/Sparkle.framework" 132578064Sume echo "Also comparing install sparkle framework" 1326121156Sume echo " $THIS_SPARKLE_DIR" 132778064Sume echo " $OTHER_SPARKLE_DIR" 132862590Sitojun fi 1329121156Sume 1330121156Sume if [ -d "$OTHER/images" ]; then 133178064Sume OTHER_SEC_DIR="$OTHER/images" 133255505Sshin else 133355505Sshin OTHER_SEC_DIR="$OTHER/tmp" 133455505Sshin fi 1335122615Sume OTHER_SEC_BIN="$OTHER_SEC_DIR/sec-bin.zip" 133655505Sshin THIS_SEC_DIR="$THIS/images" 133755505Sshin THIS_SEC_BIN="$THIS_SEC_DIR/sec-bin.zip" 133855505Sshin if [ "$OPENJDK_TARGET_OS" = "windows" ]; then 1339122615Sume if [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then 134055505Sshin JGSS_WINDOWS_BIN="jgss-windows-x64-bin.zip" 134162590Sitojun else 1342253970Shrs JGSS_WINDOWS_BIN="jgss-windows-i586-bin.zip" 134362590Sitojun fi 1344253970Shrs OTHER_SEC_WINDOWS_BIN="$OTHER_SEC_DIR/sec-windows-bin.zip" 134555505Sshin OTHER_JGSS_WINDOWS_BIN="$OTHER_SEC_DIR/$JGSS_WINDOWS_BIN" 134662590Sitojun THIS_SEC_WINDOWS_BIN="$THIS_SEC_DIR/sec-windows-bin.zip" 134778064Sume THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN" 134878064Sume fi 134978064Sume 135078064Sume if [ -d "$THIS/images/docs" ] && [ -d "$OTHER/images/docs" ]; then 135162590Sitojun THIS_DOCS="$THIS/images/docs" 135262590Sitojun OTHER_DOCS="$OTHER/images/docs" 135362590Sitojun echo "Also comparing docs" 135462590Sitojun else 135562590Sitojun echo "WARNING! Docs haven't been built and won't be compared." 135662590Sitojun fi 135762590Sitojunfi 135862590Sitojun 135962590Sitojun################################################################################ 136062590Sitojun# Do the work 136162590Sitojun 136262590Sitojunif [ "$CMP_NAMES" = "true" ]; then 136362590Sitojun if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 136462590Sitojun echo -n "JDK " 136562590Sitojun compare_dirs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 136662590Sitojun echo -n "JRE " 136762590Sitojun compare_dirs $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 136878064Sume 136962590Sitojun echo -n "JDK " 137062590Sitojun compare_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 137162590Sitojun echo -n "JRE " 137262590Sitojun compare_files $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 137362590Sitojun fi 137478064Sume if [ -n "$THIS_JDK_BUNDLE" ] && [ -n "$OTHER_JDK_BUNDLE" ]; then 137578064Sume echo -n "JDK Bundle " 137662590Sitojun compare_dirs $THIS_JDK_BUNDLE $OTHER_JDK_BUNDLE $COMPARE_ROOT/jdk-bundle 137762590Sitojun echo -n "JRE Bundle " 137855505Sshin compare_dirs $THIS_JRE_BUNDLE $OTHER_JRE_BUNDLE $COMPARE_ROOT/jre-bundle 137955505Sshin 138055505Sshin echo -n "JDK Bundle " 138155505Sshin compare_files $THIS_JDK_BUNDLE $OTHER_JDK_BUNDLE $COMPARE_ROOT/jdk-bundle 138262590Sitojun echo -n "JRE Bundle " 138355505Sshin compare_files $THIS_JRE_BUNDLE $OTHER_JRE_BUNDLE $COMPARE_ROOT/jre-bundle 138455505Sshin fi 138555505Sshin if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then 138655505Sshin echo -n "Docs " 138755505Sshin compare_dirs $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs 138862590Sitojun echo -n "Docs " 138955505Sshin compare_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs 1390121156Sume fi 1391121156Sume if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 1392121156Sume compare_dirs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 139362590Sitojun compare_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 139455505Sshin fi 1395121156Sume if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 1396121156Sume echo -n "JavaAppletPlugin " 139762590Sitojun compare_dirs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 1398121156Sume echo -n "JavaAppletPlugin " 1399121156Sume compare_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 1400121156Sume fi 1401121156Sume if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then 1402121156Sume echo -n "Sparkle.framework " 140362590Sitojun compare_dirs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 140462590Sitojun echo -n "Sparkle.framework " 1405121156Sume compare_files $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 140662590Sitojun fi 140762590Sitojunfi 140878064Sume 140962590Sitojunif [ "$CMP_PERMS" = "true" ]; then 141055505Sshin if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 141155505Sshin echo -n "JDK " 141255505Sshin compare_permissions $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 1413121156Sume echo -n "JRE " 141462590Sitojun compare_permissions $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 141555505Sshin fi 141655505Sshin if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 141755505Sshin compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 141855505Sshin fi 141978064Sume if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 142055505Sshin echo -n "JavaAppletPlugin " 142155505Sshin compare_permissions $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 142255505Sshin fi 142355505Sshin if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then 142455505Sshin echo -n "Sparkle.framework " 142555505Sshin compare_permissions $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 142655505Sshin fi 142755505Sshinfi 142855505Sshin 142955505Sshinif [ "$CMP_TYPES" = "true" ]; then 1430121156Sume if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 143155505Sshin echo -n "JDK " 1432121156Sume compare_file_types $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 143355505Sshin echo -n "JRE " 143455505Sshin compare_file_types $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 143555505Sshin fi 143655505Sshin if [ -n "$THIS_JDK_BUNDLE" ] && [ -n "$OTHER_JDK_BUNDLE" ]; then 143755505Sshin echo -n "JDK Bundle " 143855505Sshin compare_file_types $THIS_JDK_BUNDLE $OTHER_JDK_BUNDLE $COMPARE_ROOT/jdk-bundle 143955505Sshin echo -n "JRE Bundle " 144055505Sshin compare_file_types $THIS_JRE_BUNDLE $OTHER_JRE_BUNDLE $COMPARE_ROOT/jre-bundle 144155505Sshin fi 144255505Sshin if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 1443121156Sume compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 144455505Sshin fi 1445121156Sume if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 144662590Sitojun echo -n "JavaAppletPlugin " 144762590Sitojun compare_file_types $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 144855505Sshin fi 144955505Sshin if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then 145055505Sshin echo -n "Sparkle.framework " 145155505Sshin compare_file_types $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 145255505Sshin fi 145355505Sshinfi 145455505Sshin 145555505Sshinif [ "$CMP_GENERAL" = "true" ]; then 145662590Sitojun if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 145762590Sitojun echo -n "JDK " 1458121156Sume compare_general_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 145962590Sitojun echo -n "JRE " 1460121156Sume compare_general_files $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 146162590Sitojun fi 146262590Sitojun if [ -n "$THIS_JDK_BUNDLE" ] && [ -n "$OTHER_JDK_BUNDLE" ]; then 146355505Sshin echo -n "JDK Bundle " 146455505Sshin compare_general_files $THIS_JDK_BUNDLE $OTHER_JDK_BUNDLE $COMPARE_ROOT/jdk-bundle 146562590Sitojun echo -n "JRE Bundle " 146662590Sitojun compare_general_files $THIS_JRE_BUNDLE $OTHER_JRE_BUNDLE $COMPARE_ROOT/jre-bundle 1467259169Sae fi 146862590Sitojun if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then 146962590Sitojun echo -n "Docs " 147062590Sitojun compare_general_files $THIS_DOCS $OTHER_DOCS $COMPARE_ROOT/docs 147162590Sitojun fi 147262590Sitojun if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 147362590Sitojun compare_general_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 147462590Sitojun fi 147562590Sitojun if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 147662590Sitojun echo -n "JavaAppletPlugin " 147762590Sitojun compare_general_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 147862590Sitojun fi 147962590Sitojun if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then 148062590Sitojun echo -n "Sparkle.framework " 148162590Sitojun compare_general_files $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 1482121156Sume fi 148362590Sitojunfi 148462590Sitojun 148562590Sitojunif [ "$CMP_ZIPS" = "true" ]; then 1486121156Sume if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 148762590Sitojun compare_all_zip_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 148862590Sitojun fi 148962590Sitojun if [ -n "$THIS_SEC_BIN" ] && [ -n "$OTHER_SEC_BIN" ]; then 149062590Sitojun if [ -n "$(echo $THIS_SEC_BIN | $FILTER)" ]; then 149162590Sitojun echo "sec-bin.zip..." 149262590Sitojun compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-bin.zip 149362590Sitojun fi 149462590Sitojun fi 149562590Sitojun if [ -n "$THIS_SEC_WINDOWS_BIN" ] && [ -n "$OTHER_SEC_WINDOWS_BIN" ]; then 149662590Sitojun if [ -n "$(echo $THIS_SEC_WINDOWS_BIN | $FILTER)" ]; then 149762590Sitojun echo "sec-windows-bin.zip..." 149862590Sitojun compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin sec-windows-bin.zip 149962590Sitojun fi 150062590Sitojun fi 1501121156Sume if [ -n "$THIS_JGSS_WINDOWS_BIN" ] && [ -n "$OTHER_JGSS_WINDOWS_BIN" ]; then 150262590Sitojun if [ -n "$(echo $THIS_JGSS_WINDOWS_BIN | $FILTER)" ]; then 150362590Sitojun echo "$JGSS_WINDOWS_BIN..." 1504121156Sume compare_zip_file $THIS_SEC_DIR $OTHER_SEC_DIR $COMPARE_ROOT/sec-bin $JGSS_WINDOWS_BIN 150562590Sitojun fi 150662590Sitojun fi 150762590Sitojun if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 150862590Sitojun compare_all_zip_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 150962590Sitojun fi 151062590Sitojun if [ -n "$THIS_DEPLOY_BUNDLE_DIR" ] && [ -n "$OTHER_DEPLOY_BUNDLE_DIR" ]; then 151162590Sitojun compare_all_zip_files $THIS_DEPLOY_BUNDLE_DIR $OTHER_DEPLOY_BUNDLE_DIR $COMPARE_ROOT/deploy-bundle 151262590Sitojun fi 151362590Sitojun if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 151462590Sitojun compare_all_zip_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 151562590Sitojun fi 151662590Sitojunfi 151762590Sitojun 151862590Sitojunif [ "$CMP_JARS" = "true" ]; then 151955505Sshin if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 1520259169Sae compare_all_jar_files $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 152155505Sshin fi 152255505Sshin if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 152355505Sshin compare_all_jar_files $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 152455505Sshin fi 152555505Sshin if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 1526121156Sume compare_all_jar_files $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 1527121156Sume fi 152855505Sshinfi 152955505Sshin 153055505Sshinif [ "$CMP_LIBS" = "true" ]; then 153155505Sshin if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 153255505Sshin echo -n "JDK " 153355505Sshin compare_all_libs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 153455505Sshin if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then 153555505Sshin echo -n "JRE " 1536121156Sume compare_all_libs $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 1537121156Sume fi 1538121156Sume fi 1539121156Sume if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 154055505Sshin compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 154155505Sshin fi 154255505Sshin if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 1543121156Sume echo -n "JavaAppletPlugin " 1544121156Sume compare_all_libs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 1545121156Sume fi 1546121156Sume if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then 154755505Sshin echo -n "Sparkle.framework " 154855505Sshin compare_all_libs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 154955505Sshin fi 1550121156Sumefi 1551121156Sume 1552121156Sumeif [ "$CMP_EXECS" = "true" ]; then 1553121156Sume if [ -n "$THIS_JDK" ] && [ -n "$OTHER_JDK" ]; then 155455505Sshin compare_all_execs $THIS_JDK $OTHER_JDK $COMPARE_ROOT/jdk 1555121156Sume if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then 155655505Sshin echo -n "JRE " 155755505Sshin compare_all_execs $THIS_JRE $OTHER_JRE $COMPARE_ROOT/jre 155855505Sshin fi 155955505Sshin fi 156055505Sshin if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then 156155505Sshin compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir 156255505Sshin fi 156355505Sshin if [ -n "$THIS_DEPLOY_APPLET_PLUGIN_DIR" ] && [ -n "$OTHER_DEPLOY_APPLET_PLUGIN_DIR" ]; then 156455505Sshin echo -n "JavaAppletPlugin " 1565259169Sae compare_all_execs $THIS_DEPLOY_APPLET_PLUGIN_DIR $OTHER_DEPLOY_APPLET_PLUGIN_DIR $COMPARE_ROOT/plugin 156655505Sshin fi 156755505Sshin if [ -n "$THIS_SPARKLE_DIR" ] && [ -n "$OTHER_SPARKLE_DIR" ]; then 156855505Sshin echo -n "Sparkle.framework " 156955505Sshin compare_all_execs $THIS_SPARKLE_DIR $OTHER_SPARKLE_DIR $COMPARE_ROOT/sparkle 1570253999Shrs fi 157155505Sshinfi 1572253999Shrs 157355505Sshinecho 1574186119Sqingli 1575186119Sqingliif [ -n "$REGRESSIONS" ]; then 1576 echo "REGRESSIONS FOUND!" 1577 echo 1578 exit 1 1579else 1580 echo "No regressions found" 1581 echo 1582 exit 0 1583fi 1584