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