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