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