Wed, 14 Nov 2012 10:05:49 -0800
8002026: build-infra: deploy repository building
Summary: Change the compare script to handle deploy build artifacts.
Reviewed-by: ohair, tbell
Contributed-by: erik.joelsson@oracle.com
ohair@494 | 1 | #!/bin/bash |
ohair@494 | 2 | # |
ohair@494 | 3 | # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
ohair@494 | 4 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
ohair@494 | 5 | # |
ohair@494 | 6 | # This code is free software; you can redistribute it and/or modify it |
ohair@494 | 7 | # under the terms of the GNU General Public License version 2 only, as |
ohair@494 | 8 | # published by the Free Software Foundation. |
ohair@494 | 9 | # |
ohair@494 | 10 | # This code is distributed in the hope that it will be useful, but WITHOUT |
ohair@494 | 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
ohair@494 | 12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
ohair@494 | 13 | # version 2 for more details (a copy is included in the LICENSE file that |
ohair@494 | 14 | # accompanied this code). |
ohair@494 | 15 | # |
ohair@494 | 16 | # You should have received a copy of the GNU General Public License version |
ohair@494 | 17 | # 2 along with this work; if not, write to the Free Software Foundation, |
ohair@494 | 18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
ohair@494 | 19 | # |
ohair@494 | 20 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@494 | 21 | # or visit www.oracle.com if you need additional information or have any |
ohair@494 | 22 | # questions. |
ohair@494 | 23 | # |
ohair@494 | 24 | |
ohair@494 | 25 | # This script is processed by configure before it's usable. It is run from |
ohair@494 | 26 | # the root of the build directory. |
ohair@494 | 27 | |
ohair@494 | 28 | |
ohair@494 | 29 | ########################################################################################## |
ohair@494 | 30 | |
ohair@494 | 31 | # Check that we are run via the wrapper generated by configure |
ohair@494 | 32 | if [ -z "$SRC_ROOT" ]; then |
ohair@494 | 33 | echo "Error: You must run this script using build/[conf]/compare.sh" |
ohair@494 | 34 | exit 1 |
ohair@494 | 35 | fi |
ohair@494 | 36 | |
ohair@494 | 37 | if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then |
ohair@494 | 38 | FULLDUMP_CMD="$OTOOL -v -V -h -X -t -d" |
ohair@494 | 39 | LDD_CMD="$OTOOL -L" |
ohair@494 | 40 | DIS_CMD="$OTOOL -v -t" |
ohair@494 | 41 | STAT_PRINT_SIZE="-f %z" |
ohair@494 | 42 | elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then |
ohair@494 | 43 | FULLDUMP_CMD="$DUMPBIN -all" |
ohair@494 | 44 | LDD_CMD="$DUMPBIN -dependants | $GREP .dll" |
ohair@494 | 45 | DIS_CMD="$DUMPBIN -disasm:nobytes" |
ohair@494 | 46 | STAT_PRINT_SIZE="-c %s" |
ohair@494 | 47 | else |
ohair@494 | 48 | FULLDUMP_CMD="$READELF -a" |
ohair@494 | 49 | LDD_CMD="$LDD" |
ohair@494 | 50 | DIS_CMD="$OBJDUMP -d" |
ohair@494 | 51 | STAT_PRINT_SIZE="-c %s" |
ohair@494 | 52 | fi |
ohair@494 | 53 | |
ohair@494 | 54 | UNARCHIVE="$UNZIP -q" |
ohair@494 | 55 | |
ohair@494 | 56 | COMPARE_EXCEPTIONS_INCLUDE="$SRC_ROOT/common/bin/compare_exceptions.sh.incl" |
ohair@494 | 57 | if [ ! -e "$COMPARE_EXCEPTIONS_INCLUDE" ]; then |
ohair@494 | 58 | echo "Error: Cannot locate the exceptions file, it should have been here: $COMPARE_EXCEPTIONS_INCLUDE" |
ohair@494 | 59 | exit 1 |
ohair@494 | 60 | fi |
ohair@494 | 61 | # Include exception definitions |
ohair@494 | 62 | . "$COMPARE_EXCEPTIONS_INCLUDE" |
ohair@494 | 63 | |
ohair@494 | 64 | ########################################################################################## |
ohair@494 | 65 | # Compare text files and ignore specific differences: |
ohair@494 | 66 | # |
ohair@494 | 67 | # * Timestamps in Java sources generated by idl2java |
ohair@494 | 68 | # * Sorting order and cleanup style in .properties files |
ohair@494 | 69 | |
ohair@494 | 70 | diff_text() { |
ohair@494 | 71 | OTHER_FILE=$1 |
ohair@494 | 72 | THIS_FILE=$2 |
ohair@494 | 73 | |
ohair@494 | 74 | SUFFIX="${THIS_FILE##*.}" |
ohair@494 | 75 | |
ohair@494 | 76 | TMP=1 |
ohair@494 | 77 | |
ohair@494 | 78 | if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then |
ohair@494 | 79 | TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \ |
ohair@494 | 80 | $GREP '^[<>]' | \ |
ohair@494 | 81 | $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \ |
ohair@494 | 82 | -e '/[<>] Created-By: .* (Oracle Corporation).*/d') |
ohair@494 | 83 | fi |
ohair@494 | 84 | if test "x$SUFFIX" = "xjava"; then |
ohair@494 | 85 | TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \ |
ohair@494 | 86 | $GREP '^[<>]' | \ |
ohair@494 | 87 | $SED -e '/[<>] \* from.*\.idl/d' \ |
ohair@494 | 88 | -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \ |
ohair@494 | 89 | -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \ |
ohair@494 | 90 | -e '/\/\/ Generated from input file.*/d' \ |
ohair@494 | 91 | -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \ |
ohair@494 | 92 | -e '/\/\/ java GenerateCharacter.*/d') |
ohair@494 | 93 | fi |
ohair@494 | 94 | # Ignore date strings in class files. |
ohair@494 | 95 | # On Macosx the system sources for generated java classes produce different output on |
ohair@494 | 96 | # consequtive invokations seemingly randomly. |
ohair@494 | 97 | # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this. |
ohair@494 | 98 | if test "x$SUFFIX" = "xclass"; then |
ohair@494 | 99 | # To improve performance when large diffs are found, do a rough filtering of classes |
ohair@494 | 100 | # elibeble for these exceptions |
ohair@494 | 101 | if $GREP -R -e '[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}' -e thePoint -e aPoint -e setItemsPtr ${THIS_FILE} > /dev/null; then |
ohair@494 | 102 | $JAVAP -c -constants -l -p ${OTHER_FILE} > ${OTHER_FILE}.javap |
ohair@494 | 103 | $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap |
ohair@494 | 104 | TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \ |
ohair@494 | 105 | $GREP '^[<>]' | \ |
ohair@494 | 106 | $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \ |
ohair@494 | 107 | -e '/[<>].*Point Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \ |
ohair@494 | 108 | -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \ |
ohair@494 | 109 | -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d') |
ohair@494 | 110 | fi |
ohair@494 | 111 | fi |
ohair@494 | 112 | if test "x$SUFFIX" = "xproperties"; then |
ohair@494 | 113 | $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e 's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \ |
ohair@494 | 114 | | $SED -f "$SRC_ROOT/common/makefiles/support/unicode2x.sed" \ |
ohair@494 | 115 | | $SED -e '/^#/d' -e '/^$/d' \ |
ohair@494 | 116 | -e :a -e '/\\$/N; s/\\\n//; ta' \ |
ohair@494 | 117 | -e 's/^[ \t]*//;s/[ \t]*$//' \ |
ohair@494 | 118 | -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned |
ohair@494 | 119 | TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE) |
ohair@494 | 120 | fi |
ohair@494 | 121 | if test -n "$TMP"; then |
ohair@494 | 122 | echo Files $OTHER_FILE and $THIS_FILE differ |
ohair@494 | 123 | return 1 |
ohair@494 | 124 | fi |
ohair@494 | 125 | |
ohair@494 | 126 | return 0 |
ohair@494 | 127 | } |
ohair@494 | 128 | |
ohair@494 | 129 | ########################################################################################## |
ohair@494 | 130 | # Compare directory structure |
ohair@494 | 131 | |
ohair@494 | 132 | compare_dirs() { |
ohair@494 | 133 | THIS_DIR=$1 |
ohair@494 | 134 | OTHER_DIR=$2 |
ohair@494 | 135 | WORK_DIR=$3 |
ohair@494 | 136 | |
ohair@494 | 137 | mkdir -p $WORK_DIR |
ohair@494 | 138 | |
ohair@494 | 139 | (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_other) |
ohair@494 | 140 | (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/dirs_this) |
ohair@494 | 141 | |
ohair@494 | 142 | $DIFF $WORK_DIR/dirs_other $WORK_DIR/dirs_other > $WORK_DIR/dirs_diff |
ohair@494 | 143 | |
ohair@494 | 144 | echo -n Directory structure... |
ohair@494 | 145 | if [ -s $WORK_DIR/dirs_diff ]; then |
ohair@494 | 146 | echo Differences found. |
ohair@494 | 147 | REGRESSIONS=true |
ohair@494 | 148 | # Differences in directories found. |
ohair@494 | 149 | ONLY_OTHER=$($GREP '<' $WORK_DIR/dirs_diff) |
ohair@494 | 150 | if [ "$ONLY_OTHER" ]; then |
ohair@494 | 151 | echo Only in $OTHER |
ohair@494 | 152 | $GREP '<' $WORK_DIR/dirs_diff | $SED 's|< ./| |g' |
ohair@494 | 153 | fi |
ohair@494 | 154 | ONLY_THIS=$($GREP '>' $WORK_DIR/dirs_diff) |
ohair@494 | 155 | if [ "$ONLY_THIS" ]; then |
ohair@494 | 156 | echo Only in $THIS |
ohair@494 | 157 | $GREP '>' $WORK_DIR/dirs_diff | $SED 's|> ./| |g' |
ohair@494 | 158 | fi |
ohair@494 | 159 | else |
ohair@494 | 160 | echo Identical! |
ohair@494 | 161 | fi |
ohair@494 | 162 | } |
ohair@494 | 163 | |
ohair@494 | 164 | |
ohair@494 | 165 | ########################################################################################## |
ohair@494 | 166 | # Compare file structure |
ohair@494 | 167 | |
ohair@494 | 168 | compare_files() { |
ohair@494 | 169 | THIS_DIR=$1 |
ohair@494 | 170 | OTHER_DIR=$2 |
ohair@494 | 171 | WORK_DIR=$3 |
ohair@494 | 172 | |
ohair@494 | 173 | $MKDIR -p $WORK_DIR |
ohair@494 | 174 | |
ohair@494 | 175 | (cd $OTHER_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_other) |
ohair@494 | 176 | (cd $THIS_DIR && $FIND . ! -type d | $SORT > $WORK_DIR/files_this) |
ohair@494 | 177 | |
ohair@494 | 178 | $DIFF $WORK_DIR/files_other $WORK_DIR/files_this > $WORK_DIR/files_diff |
ohair@494 | 179 | |
ohair@494 | 180 | echo -n File names... |
ohair@494 | 181 | if [ -s $WORK_DIR/files_diff ]; then |
ohair@494 | 182 | echo Differences found. |
ohair@494 | 183 | REGRESSIONS=true |
ohair@494 | 184 | # Differences in files found. |
ohair@494 | 185 | ONLY_OTHER=$($GREP '<' $WORK_DIR/files_diff) |
ohair@494 | 186 | if [ "$ONLY_OTHER" ]; then |
ohair@494 | 187 | echo Only in $OTHER |
ohair@494 | 188 | $GREP '<' $WORK_DIR/files_diff | $SED 's|< ./| |g' |
ohair@494 | 189 | fi |
ohair@494 | 190 | ONLY_THIS=$($GREP '>' $WORK_DIR/files_diff) |
ohair@494 | 191 | if [ "$ONLY_THIS" ]; then |
ohair@494 | 192 | echo Only in $THIS |
ohair@494 | 193 | $GREP '>' $WORK_DIR/files_diff | $SED 's|> ./| |g' |
ohair@494 | 194 | fi |
ohair@494 | 195 | else |
ohair@494 | 196 | echo Identical! |
ohair@494 | 197 | fi |
ohair@494 | 198 | } |
ohair@494 | 199 | |
ohair@494 | 200 | |
ohair@494 | 201 | ########################################################################################## |
ohair@494 | 202 | # Compare permissions |
ohair@494 | 203 | |
ohair@494 | 204 | compare_permissions() { |
ohair@494 | 205 | THIS_DIR=$1 |
ohair@494 | 206 | OTHER_DIR=$2 |
ohair@494 | 207 | WORK_DIR=$3 |
ohair@494 | 208 | |
ohair@494 | 209 | mkdir -p $WORK_DIR |
ohair@494 | 210 | |
ohair@494 | 211 | echo -n Permissions... |
ohair@494 | 212 | found="" |
ohair@494 | 213 | for f in `cd $OTHER_DIR && $FIND . -type f` |
ohair@494 | 214 | do |
ohair@494 | 215 | if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi |
ohair@494 | 216 | if [ ! -f ${THIS_DIR}/$f ]; then continue; fi |
ohair@494 | 217 | OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'` |
ohair@494 | 218 | TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'` |
ohair@494 | 219 | if [ "$OP" != "$TP" ] |
ohair@494 | 220 | then |
ohair@494 | 221 | if [ -z "$found" ]; then echo ; found="yes"; fi |
ohair@494 | 222 | $PRINTF "\told: ${OP} new: ${TP}\t$f\n" |
ohair@494 | 223 | fi |
ohair@494 | 224 | done |
ohair@494 | 225 | if [ -z "$found" ]; then |
ohair@494 | 226 | echo "Identical!" |
ohair@494 | 227 | else |
ohair@494 | 228 | REGRESSIONS=true |
ohair@494 | 229 | fi |
ohair@494 | 230 | } |
ohair@494 | 231 | |
ohair@494 | 232 | ########################################################################################## |
ohair@494 | 233 | # Compare file command output |
ohair@494 | 234 | |
ohair@494 | 235 | compare_file_types() { |
ohair@494 | 236 | THIS_DIR=$1 |
ohair@494 | 237 | OTHER_DIR=$2 |
ohair@494 | 238 | WORK_DIR=$3 |
ohair@494 | 239 | |
ohair@494 | 240 | $MKDIR -p $WORK_DIR |
ohair@494 | 241 | |
ohair@494 | 242 | echo -n File types... |
ohair@494 | 243 | found="" |
ohair@494 | 244 | for f in `cd $OTHER_DIR && $FIND . ! -type d` |
ohair@494 | 245 | do |
ohair@494 | 246 | if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi |
ohair@494 | 247 | if [ ! -f ${THIS_DIR}/$f ]; then continue; fi |
ohair@494 | 248 | OF=`cd ${OTHER_DIR} && $FILE -h $f` |
ohair@494 | 249 | TF=`cd ${THIS_DIR} && $FILE -h $f` |
ohair@494 | 250 | if [ "$f" = "./src.zip" ] || [[ "$f" = *"/Home/src.zip" ]] || [[ "$f" = *"/lib/JObjC.jar" ]] |
ohair@494 | 251 | then |
ohair@494 | 252 | if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ] |
ohair@494 | 253 | then |
ohair@494 | 254 | # the way we produces zip-files make it so that directories are stored in old file |
ohair@494 | 255 | # but not in new (only files with full-path) |
ohair@494 | 256 | # this makes file-5.09 report them as different |
ohair@494 | 257 | continue; |
ohair@494 | 258 | fi |
ohair@494 | 259 | fi |
ohair@494 | 260 | |
ohair@494 | 261 | if [ "$OF" != "$TF" ] |
ohair@494 | 262 | then |
ohair@494 | 263 | if [ -z "$found" ]; then echo ; found="yes"; fi |
ohair@494 | 264 | $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n" |
ohair@494 | 265 | fi |
ohair@494 | 266 | done |
ohair@494 | 267 | if [ -z "$found" ]; then |
ohair@494 | 268 | echo "Identical!" |
ohair@494 | 269 | else |
ohair@494 | 270 | REGRESSIONS=true |
ohair@494 | 271 | fi |
ohair@494 | 272 | } |
ohair@494 | 273 | |
ohair@494 | 274 | ########################################################################################## |
ohair@494 | 275 | # Compare the rest of the files |
ohair@494 | 276 | |
ohair@494 | 277 | compare_general_files() { |
ohair@494 | 278 | THIS_DIR=$1 |
ohair@494 | 279 | OTHER_DIR=$2 |
ohair@494 | 280 | WORK_DIR=$3 |
ohair@494 | 281 | |
ohair@494 | 282 | GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \ |
ohair@494 | 283 | ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \ |
ohair@494 | 284 | ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \ |
ohair@494 | 285 | ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \ |
tbell@510 | 286 | ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \ |
ohair@494 | 287 | | $GREP -v "./bin/" | $SORT | $FILTER) |
ohair@494 | 288 | |
ohair@494 | 289 | echo General files... |
ohair@494 | 290 | for f in $GENERAL_FILES |
ohair@494 | 291 | do |
ohair@494 | 292 | if [ -e $OTHER_DIR/$f ]; then |
ohair@494 | 293 | if [ "$(basename $f)" = "release" ]; then |
ohair@494 | 294 | # Ignore differences in change numbers in release file. |
ohair@494 | 295 | OTHER_FILE=$WORK_DIR/$f.other |
ohair@494 | 296 | THIS_FILE=$WORK_DIR/$f.this |
ohair@494 | 297 | $MKDIR -p $(dirname $OTHER_FILE) |
ohair@494 | 298 | $MKDIR -p $(dirname $THIS_FILE) |
ohair@494 | 299 | $CAT $OTHER_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $OTHER_FILE |
ohair@494 | 300 | $CAT $THIS_DIR/$f | $SED 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' > $THIS_FILE |
ohair@494 | 301 | else |
ohair@494 | 302 | OTHER_FILE=$OTHER_DIR/$f |
ohair@494 | 303 | THIS_FILE=$THIS_DIR/$f |
ohair@494 | 304 | fi |
ohair@494 | 305 | DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1) |
ohair@494 | 306 | if [ -n "$DIFF_OUT" ]; then |
ohair@494 | 307 | echo $f |
ohair@494 | 308 | REGRESSIONS=true |
ohair@494 | 309 | if [ "$SHOW_DIFFS" = "true" ]; then |
ohair@494 | 310 | echo "$DIFF_OUT" |
ohair@494 | 311 | fi |
ohair@494 | 312 | fi |
ohair@494 | 313 | fi |
ohair@494 | 314 | done |
ohair@494 | 315 | |
ohair@494 | 316 | |
ohair@494 | 317 | } |
ohair@494 | 318 | |
ohair@494 | 319 | ########################################################################################## |
ohair@494 | 320 | # Compare zip file |
ohair@494 | 321 | |
ohair@494 | 322 | compare_zip_file() { |
ohair@494 | 323 | THIS_DIR=$1 |
ohair@494 | 324 | OTHER_DIR=$2 |
ohair@494 | 325 | WORK_DIR=$3 |
ohair@494 | 326 | ZIP_FILE=$4 |
ohair@494 | 327 | |
ohair@494 | 328 | THIS_ZIP=$THIS_DIR/$ZIP_FILE |
ohair@494 | 329 | OTHER_ZIP=$OTHER_DIR/$ZIP_FILE |
ohair@494 | 330 | |
ohair@494 | 331 | THIS_SUFFIX="${THIS_ZIP##*.}" |
ohair@494 | 332 | OTHER_SUFFIX="${OTHER_ZIP##*.}" |
ohair@494 | 333 | if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then |
ohair@494 | 334 | echo The files do not have the same suffix type! |
ohair@494 | 335 | return 2 |
ohair@494 | 336 | fi |
ohair@494 | 337 | |
ohair@494 | 338 | TYPE="$THIS_SUFFIX" |
ohair@494 | 339 | |
ohair@494 | 340 | if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null |
ohair@494 | 341 | then |
ohair@494 | 342 | return 0 |
ohair@494 | 343 | fi |
ohair@494 | 344 | # Not quite identical, the might still contain the same data. |
ohair@494 | 345 | # Unpack the jar/zip files in temp dirs |
ohair@494 | 346 | |
ohair@494 | 347 | THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this |
ohair@494 | 348 | OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other |
ohair@494 | 349 | $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR |
ohair@494 | 350 | $MKDIR -p $THIS_UNZIPDIR |
ohair@494 | 351 | $MKDIR -p $OTHER_UNZIPDIR |
ohair@494 | 352 | (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP) |
ohair@494 | 353 | (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP) |
ohair@494 | 354 | |
erikj@502 | 355 | # Find all archives inside and unzip them as well to compare the contents rather than |
erikj@502 | 356 | # the archives. |
erikj@502 | 357 | EXCEPTIONS="" |
erikj@502 | 358 | for pack in $($FIND $THIS_UNZIPDIR -name "*.pack" -o -name "*.pack.gz"); do |
erikj@502 | 359 | ($UNPACK200 $pack $pack.jar) |
erikj@502 | 360 | # Filter out the unzipped archives from the diff below. |
erikj@502 | 361 | EXCEPTIONS="$EXCEPTIONS $pack $pack.jar" |
erikj@502 | 362 | done |
erikj@502 | 363 | for pack in $($FIND $OTHER_UNZIPDIR -name "*.pack" -o -name "*.pack.gz"); do |
erikj@502 | 364 | ($UNPACK200 $pack $pack.jar) |
erikj@502 | 365 | EXCEPTIONS="$EXCEPTIONS $pack $pack.jar" |
erikj@502 | 366 | done |
erikj@502 | 367 | for zip in $($FIND $THIS_UNZIPDIR -name "*.jar" -o -name "*.zip"); do |
erikj@502 | 368 | $MKDIR $zip.unzip |
erikj@502 | 369 | (cd $zip.unzip && $UNARCHIVE $zip) |
erikj@502 | 370 | EXCEPTIONS="$EXCEPTIONS $zip" |
erikj@502 | 371 | done |
erikj@502 | 372 | for zip in $($FIND $OTHER_UNZIPDIR -name "*.jar" -o -name "*.zip"); do |
erikj@502 | 373 | $MKDIR $zip.unzip |
erikj@502 | 374 | (cd $zip.unzip && $UNARCHIVE $zip) |
erikj@502 | 375 | EXCEPTIONS="$EXCEPTIONS $zip" |
erikj@502 | 376 | done |
erikj@502 | 377 | |
ohair@494 | 378 | CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff |
ohair@494 | 379 | # On solaris, there is no -q option. |
ohair@494 | 380 | if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then |
ohair@494 | 381 | LANG=C $DIFF -r $OTHER_UNZIPDIR $THIS_UNZIPDIR \ |
ohair@494 | 382 | | $GREP -v -e "^<" -e "^>" -e "^Common subdirectories:" \ |
ohair@494 | 383 | > $CONTENTS_DIFF_FILE |
ohair@494 | 384 | else |
ohair@494 | 385 | LANG=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE |
ohair@494 | 386 | fi |
ohair@494 | 387 | |
ohair@494 | 388 | ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE) |
ohair@494 | 389 | ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE) |
ohair@494 | 390 | |
ohair@494 | 391 | return_value=0 |
ohair@494 | 392 | |
ohair@494 | 393 | if [ -n "$ONLY_OTHER" ]; then |
ohair@494 | 394 | echo " Only OTHER $ZIP_FILE contains:" |
ohair@494 | 395 | echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR| |"g | sed 's|: |/|g' |
ohair@494 | 396 | return_value=1 |
ohair@494 | 397 | fi |
ohair@494 | 398 | |
ohair@494 | 399 | if [ -n "$ONLY_THIS" ]; then |
ohair@494 | 400 | echo " Only THIS $ZIP_FILE contains:" |
ohair@494 | 401 | echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR| |"g | sed 's|: |/|g' |
ohair@494 | 402 | return_value=1 |
ohair@494 | 403 | fi |
ohair@494 | 404 | |
ohair@494 | 405 | if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then |
ohair@494 | 406 | DIFFING_FILES=$($GREP -e "differ$" -e "^diff " $CONTENTS_DIFF_FILE \ |
ohair@494 | 407 | | $CUT -f 3 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g") |
ohair@494 | 408 | else |
ohair@494 | 409 | DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \ |
ohair@494 | 410 | | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g") |
ohair@494 | 411 | fi |
ohair@494 | 412 | |
ohair@494 | 413 | $RM -f $WORK_DIR/$ZIP_FILE.diffs |
ohair@494 | 414 | for file in $DIFFING_FILES; do |
erikj@502 | 415 | if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then |
ohair@494 | 416 | diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs |
ohair@494 | 417 | fi |
ohair@494 | 418 | done |
ohair@494 | 419 | |
ohair@494 | 420 | if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then |
ohair@494 | 421 | return_value=1 |
ohair@494 | 422 | echo " Differing files in $ZIP_FILE" |
ohair@494 | 423 | $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP differ | cut -f 2 -d ' ' | \ |
ohair@494 | 424 | $SED "s|$OTHER_UNZIPDIR| |g" > $WORK_DIR/$ZIP_FILE.difflist |
ohair@494 | 425 | $CAT $WORK_DIR/$ZIP_FILE.difflist |
ohair@494 | 426 | |
ohair@494 | 427 | if [ -n "$SHOW_DIFFS" ]; then |
ohair@494 | 428 | for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do |
ohair@494 | 429 | if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then |
ohair@494 | 430 | LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap |
ohair@494 | 431 | elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then |
ohair@494 | 432 | LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i |
ohair@494 | 433 | else |
ohair@494 | 434 | LANG=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i |
ohair@494 | 435 | fi |
ohair@494 | 436 | done |
ohair@494 | 437 | fi |
ohair@494 | 438 | fi |
ohair@494 | 439 | |
ohair@494 | 440 | return $return_value |
ohair@494 | 441 | } |
ohair@494 | 442 | |
ohair@494 | 443 | |
ohair@494 | 444 | ########################################################################################## |
ohair@494 | 445 | # Compare all zip files |
ohair@494 | 446 | |
ohair@494 | 447 | compare_all_zip_files() { |
ohair@494 | 448 | THIS_DIR=$1 |
ohair@494 | 449 | OTHER_DIR=$2 |
ohair@494 | 450 | WORK_DIR=$3 |
ohair@494 | 451 | |
ohair@494 | 452 | ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER ) |
ohair@494 | 453 | |
ohair@494 | 454 | if [ -n "$ZIPS" ]; then |
ohair@494 | 455 | echo Zip files... |
ohair@494 | 456 | |
ohair@494 | 457 | return_value=0 |
ohair@494 | 458 | for f in $ZIPS; do |
ohair@494 | 459 | if [ -f "$OTHER_DIR/$f" ]; then |
ohair@494 | 460 | compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f |
ohair@494 | 461 | if [ "$?" != "0" ]; then |
ohair@494 | 462 | return_value=1 |
ohair@494 | 463 | REGRESSIONS=true |
ohair@494 | 464 | fi |
ohair@494 | 465 | fi |
ohair@494 | 466 | done |
ohair@494 | 467 | fi |
ohair@494 | 468 | |
ohair@494 | 469 | return $return_value |
ohair@494 | 470 | } |
ohair@494 | 471 | |
ohair@494 | 472 | ########################################################################################## |
ohair@494 | 473 | # Compare all jar files |
ohair@494 | 474 | |
ohair@494 | 475 | compare_all_jar_files() { |
ohair@494 | 476 | THIS_DIR=$1 |
ohair@494 | 477 | OTHER_DIR=$2 |
ohair@494 | 478 | WORK_DIR=$3 |
ohair@494 | 479 | |
ohair@494 | 480 | # TODO filter? |
ohair@494 | 481 | ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" | $SORT | $FILTER) |
ohair@494 | 482 | |
ohair@494 | 483 | if [ -n "$ZIPS" ]; then |
ohair@494 | 484 | echo Jar files... |
ohair@494 | 485 | |
ohair@494 | 486 | return_value=0 |
ohair@494 | 487 | for f in $ZIPS; do |
ohair@494 | 488 | if [ -f "$OTHER_DIR/$f" ]; then |
ohair@494 | 489 | compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f |
ohair@494 | 490 | if [ "$?" != "0" ]; then |
ohair@494 | 491 | return_value=1 |
ohair@494 | 492 | REGRESSIONS=true |
ohair@494 | 493 | fi |
ohair@494 | 494 | fi |
ohair@494 | 495 | done |
ohair@494 | 496 | fi |
ohair@494 | 497 | |
ohair@494 | 498 | return $return_value |
ohair@494 | 499 | } |
ohair@494 | 500 | |
ohair@494 | 501 | ########################################################################################## |
ohair@494 | 502 | # Compare binary (executable/library) file |
ohair@494 | 503 | |
ohair@494 | 504 | compare_bin_file() { |
ohair@494 | 505 | THIS_DIR=$1 |
ohair@494 | 506 | OTHER_DIR=$2 |
ohair@494 | 507 | WORK_DIR=$3 |
ohair@494 | 508 | BIN_FILE=$4 |
ohair@494 | 509 | |
ohair@494 | 510 | THIS_FILE=$THIS_DIR/$BIN_FILE |
ohair@494 | 511 | OTHER_FILE=$OTHER_DIR/$BIN_FILE |
ohair@494 | 512 | NAME=$(basename $BIN_FILE) |
ohair@494 | 513 | WORK_FILE_BASE=$WORK_DIR/$BIN_FILE |
ohair@494 | 514 | FILE_WORK_DIR=$(dirname $WORK_FILE_BASE) |
ohair@494 | 515 | |
ohair@494 | 516 | $MKDIR -p $FILE_WORK_DIR |
ohair@494 | 517 | |
ohair@494 | 518 | ORIG_THIS_FILE="$THIS_FILE" |
ohair@494 | 519 | ORIG_OTHER_FILE="$OTHER_FILE" |
ohair@494 | 520 | |
ohair@494 | 521 | if [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then |
ohair@494 | 522 | THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME |
ohair@494 | 523 | OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME |
ohair@494 | 524 | $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other |
ohair@494 | 525 | $CP $THIS_FILE $THIS_STRIPPED_FILE |
ohair@494 | 526 | $CP $OTHER_FILE $OTHER_STRIPPED_FILE |
ohair@494 | 527 | $STRIP $THIS_STRIPPED_FILE |
ohair@494 | 528 | $STRIP $OTHER_STRIPPED_FILE |
ohair@494 | 529 | THIS_FILE="$THIS_STRIPPED_FILE" |
ohair@494 | 530 | OTHER_FILE="$OTHER_STRIPPED_FILE" |
ohair@494 | 531 | fi |
ohair@494 | 532 | |
ohair@494 | 533 | if [ "$OPENJDK_TARGET_OS" = "windows" ]; then |
ohair@494 | 534 | unset _NT_SYMBOL_PATH |
ohair@494 | 535 | # On windows we need to unzip the debug symbols, if present |
ohair@494 | 536 | OTHER_FILE_BASE=${OTHER_FILE/.dll/} |
ohair@494 | 537 | OTHER_FILE_BASE=${OTHER_FILE_BASE/.exe/} |
ohair@494 | 538 | DIZ_NAME=$(basename $OTHER_FILE_BASE).diz |
ohair@494 | 539 | # java.exe and java.dll diz files will have the same name. Have to |
ohair@494 | 540 | # make sure java.exe gets the right one. This is only needed for |
ohair@494 | 541 | # OTHER since in the new build, all pdb files are left around. |
ohair@494 | 542 | if [ "$NAME" = "java.exe" ] && [ -f "$OTHER/tmp/java/java/obj64/java.diz" ]; then |
ohair@494 | 543 | OTHER_DIZ_FILE="$OTHER/tmp/java/java/obj64/java.diz" |
ohair@494 | 544 | elif [ -f "${OTHER_FILE_BASE}.diz" ]; then |
ohair@494 | 545 | OTHER_DIZ_FILE=${OTHER_FILE_BASE}.diz |
ohair@494 | 546 | else |
ohair@494 | 547 | # Some files, jli.dll, appears twice in the image but only one of |
ohair@494 | 548 | # thme has a diz file next to it. |
ohair@494 | 549 | OTHER_DIZ_FILE="$($FIND $OTHER_DIR -name $DIZ_NAME | $SED 1q)" |
ohair@494 | 550 | if [ ! -f "$OTHER_DIZ_FILE" ]; then |
ohair@494 | 551 | # As a last resort, look for diz file in the whole build output |
ohair@494 | 552 | # dir. |
ohair@494 | 553 | OTHER_DIZ_FILE="$($FIND $OTHER -name $DIZ_NAME | $SED 1q)" |
ohair@494 | 554 | fi |
ohair@494 | 555 | fi |
ohair@494 | 556 | if [ -n "$OTHER_DIZ_FILE" ]; then |
ohair@494 | 557 | $MKDIR -p $FILE_WORK_DIR/other |
ohair@494 | 558 | (cd $FILE_WORK_DIR/other ; $UNARCHIVE -o $OTHER_DIZ_FILE) |
ohair@494 | 559 | export _NT_SYMBOL_PATH="$FILE_WORK_DIR/other" |
ohair@494 | 560 | fi |
ohair@494 | 561 | THIS_FILE_BASE=${THIS_FILE/.dll/} |
ohair@494 | 562 | THIS_FILE_BASE=${THIS_FILE_BASE/.exe/} |
ohair@494 | 563 | if [ -f "${THIS_FILE/.dll/}.diz" ]; then |
ohair@494 | 564 | THIS_DIZ_FILE=${THIS_FILE/.dll/}.diz |
ohair@494 | 565 | else |
ohair@494 | 566 | THIS_DIZ_FILE="$($FIND $THIS_DIR -name $DIZ_NAME | $SED 1q)" |
ohair@494 | 567 | if [ ! -f "$THIS_DIZ_FILE" ]; then |
ohair@494 | 568 | # As a last resort, look for diz file in the whole build output |
ohair@494 | 569 | # dir. |
ohair@494 | 570 | THIS_DIZ_FILE="$($FIND $THIS -name $DIZ_NAME | $SED 1q)" |
ohair@494 | 571 | fi |
ohair@494 | 572 | fi |
ohair@494 | 573 | if [ -n "$THIS_DIZ_FILE" ]; then |
ohair@494 | 574 | $MKDIR -p $FILE_WORK_DIR/this |
ohair@494 | 575 | (cd $FILE_WORK_DIR/this ; $UNARCHIVE -o $THIS_DIZ_FILE) |
ohair@494 | 576 | export _NT_SYMBOL_PATH="$_NT_SYMBOL_PATH;$FILE_WORK_DIR/this" |
ohair@494 | 577 | fi |
ohair@494 | 578 | fi |
ohair@494 | 579 | |
ohair@494 | 580 | if [ -z "$SKIP_BIN_DIFF" ]; then |
ohair@494 | 581 | if cmp $OTHER_FILE $THIS_FILE > /dev/null; then |
ohair@494 | 582 | # The files were bytewise identical. |
ohair@494 | 583 | if [ -n "$VERBOSE" ]; then |
ohair@494 | 584 | echo " : : : : : $BIN_FILE" |
ohair@494 | 585 | fi |
ohair@494 | 586 | return 0 |
ohair@494 | 587 | fi |
ohair@494 | 588 | BIN_MSG=" diff " |
ohair@494 | 589 | if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 590 | DIFF_BIN=true |
ohair@494 | 591 | if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 592 | BIN_MSG="*$BIN_MSG*" |
ohair@494 | 593 | REGRESSIONS=true |
ohair@494 | 594 | else |
ohair@494 | 595 | BIN_MSG=" $BIN_MSG " |
ohair@494 | 596 | fi |
ohair@494 | 597 | else |
ohair@494 | 598 | BIN_MSG="($BIN_MSG)" |
ohair@494 | 599 | DIFF_BIN= |
ohair@494 | 600 | fi |
ohair@494 | 601 | fi |
ohair@494 | 602 | |
ohair@494 | 603 | if [ -n "$STAT" ]; then |
ohair@494 | 604 | THIS_SIZE=$($STAT $STAT_PRINT_SIZE "$THIS_FILE") |
ohair@494 | 605 | OTHER_SIZE=$($STAT $STAT_PRINT_SIZE "$OTHER_FILE") |
ohair@494 | 606 | else |
ohair@494 | 607 | THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }') |
ohair@494 | 608 | OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }') |
ohair@494 | 609 | fi |
ohair@494 | 610 | if [ $THIS_SIZE -ne $OTHER_SIZE ]; then |
ohair@494 | 611 | DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE) |
ohair@494 | 612 | DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE) |
ohair@494 | 613 | SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM) |
tbell@510 | 614 | if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] \ |
tbell@510 | 615 | && [ "$DIFF_SIZE_REL" -lt 102 ]; then |
ohair@494 | 616 | SIZE_MSG="($SIZE_MSG)" |
ohair@494 | 617 | DIFF_SIZE= |
tbell@510 | 618 | elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ |
tbell@510 | 619 | && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ |
tbell@510 | 620 | && [ "$DIFF_SIZE_NUM" = 512 ]; then |
tbell@510 | 621 | # On windows, size of binaries increase in 512 increments. |
tbell@510 | 622 | SIZE_MSG="($SIZE_MSG)" |
tbell@510 | 623 | DIFF_SIZE= |
tbell@510 | 624 | elif [ "$OPENJDK_TARGET_OS" = "windows" ] \ |
tbell@510 | 625 | && [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] \ |
tbell@510 | 626 | && [ "$DIFF_SIZE_NUM" = -512 ]; then |
ohair@494 | 627 | # On windows, size of binaries increase in 512 increments. |
ohair@494 | 628 | SIZE_MSG="($SIZE_MSG)" |
ohair@494 | 629 | DIFF_SIZE= |
ohair@494 | 630 | else |
ohair@494 | 631 | if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 632 | DIFF_SIZE=true |
ohair@494 | 633 | if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 634 | SIZE_MSG="*$SIZE_MSG*" |
ohair@494 | 635 | REGRESSIONS=true |
ohair@494 | 636 | else |
ohair@494 | 637 | SIZE_MSG=" $SIZE_MSG " |
ohair@494 | 638 | fi |
ohair@494 | 639 | else |
ohair@494 | 640 | SIZE_MSG="($SIZE_MSG)" |
ohair@494 | 641 | DIFF_SIZE= |
ohair@494 | 642 | fi |
ohair@494 | 643 | fi |
ohair@494 | 644 | else |
ohair@494 | 645 | SIZE_MSG=" " |
ohair@494 | 646 | DIFF_SIZE= |
ohair@494 | 647 | if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then |
ohair@494 | 648 | SIZE_MSG=" ! " |
ohair@494 | 649 | fi |
ohair@494 | 650 | fi |
ohair@494 | 651 | |
ohair@494 | 652 | if [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then |
ohair@494 | 653 | SYM_SORT_CMD="sort" |
ohair@494 | 654 | else |
ohair@494 | 655 | SYM_SORT_CMD="cat" |
ohair@494 | 656 | fi |
ohair@494 | 657 | |
ohair@494 | 658 | # Check symbols |
ohair@494 | 659 | if [ "$OPENJDK_TARGET_OS" = "windows" ]; then |
ohair@494 | 660 | # The output from dumpbin on windows differs depending on if the debug symbol |
ohair@494 | 661 | # files are still around at the location the binary is pointing too. Need |
ohair@494 | 662 | # to filter out that extra information. |
ohair@494 | 663 | $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 |
ohair@494 | 664 | $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 |
ohair@494 | 665 | elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then |
ohair@494 | 666 | # Some symbols get seemingly random 15 character prefixes. Filter them out. |
ohair@494 | 667 | $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 |
ohair@494 | 668 | $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 |
ohair@494 | 669 | else |
ohair@494 | 670 | $NM -a $ORIG_OTHER_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other |
ohair@494 | 671 | $NM -a $ORIG_THIS_FILE 2> /dev/null | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this |
ohair@494 | 672 | fi |
ohair@494 | 673 | |
ohair@494 | 674 | LANG=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff |
ohair@494 | 675 | if [ -s $WORK_FILE_BASE.symbols.diff ]; then |
ohair@494 | 676 | SYM_MSG=" diff " |
ohair@494 | 677 | if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 678 | DIFF_SYM=true |
ohair@494 | 679 | if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 680 | SYM_MSG="*$SYM_MSG*" |
ohair@494 | 681 | REGRESSIONS=true |
ohair@494 | 682 | else |
ohair@494 | 683 | SYM_MSG=" $SYM_MSG " |
ohair@494 | 684 | fi |
ohair@494 | 685 | else |
ohair@494 | 686 | SYM_MSG="($SYM_MSG)" |
ohair@494 | 687 | DIFF_SYM= |
ohair@494 | 688 | fi |
ohair@494 | 689 | else |
ohair@494 | 690 | SYM_MSG=" " |
ohair@494 | 691 | DIFF_SYM= |
ohair@494 | 692 | if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then |
ohair@494 | 693 | SYM_MSG=" ! " |
ohair@494 | 694 | fi |
ohair@494 | 695 | fi |
ohair@494 | 696 | |
ohair@494 | 697 | # Check dependencies |
ohair@494 | 698 | if [ -n "$LDD_CMD" ]; then |
erikj@502 | 699 | (cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME 2>/dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq) |
erikj@502 | 700 | (cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME 2</dev/null | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq) |
ohair@494 | 701 | (cd $FILE_WORK_DIR && $RM -f $NAME) |
ohair@494 | 702 | |
ohair@494 | 703 | LANG=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff |
ohair@494 | 704 | LANG=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq |
ohair@494 | 705 | |
ohair@494 | 706 | if [ -s $WORK_FILE_BASE.deps.diff ]; then |
ohair@494 | 707 | if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then |
ohair@494 | 708 | DEP_MSG=" diff " |
ohair@494 | 709 | else |
ohair@494 | 710 | DEP_MSG=" redun " |
ohair@494 | 711 | fi |
ohair@494 | 712 | if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 713 | DIFF_DEP=true |
ohair@494 | 714 | if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 715 | DEP_MSG="*$DEP_MSG*" |
ohair@494 | 716 | REGRESSIONS=true |
ohair@494 | 717 | else |
ohair@494 | 718 | DEP_MSG=" $DEP_MSG " |
ohair@494 | 719 | fi |
ohair@494 | 720 | else |
ohair@494 | 721 | DEP_MSG="($DEP_MSG)" |
ohair@494 | 722 | DIFF_DEP= |
ohair@494 | 723 | fi |
ohair@494 | 724 | else |
ohair@494 | 725 | DEP_MSG=" " |
ohair@494 | 726 | DIFF_DEP= |
ohair@494 | 727 | if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then |
ohair@494 | 728 | DEP_MSG=" ! " |
ohair@494 | 729 | fi |
ohair@494 | 730 | fi |
ohair@494 | 731 | else |
ohair@494 | 732 | DEP_MSG=" - " |
ohair@494 | 733 | fi |
ohair@494 | 734 | |
ohair@494 | 735 | # Compare fulldump output |
ohair@494 | 736 | if [ -n "$FULLDUMP_CMD" ] && [ -z "$SKIP_FULLDUMP_DIFF" ]; then |
ohair@494 | 737 | $FULLDUMP_CMD $OTHER_FILE > $WORK_FILE_BASE.fulldump.other 2>&1 |
ohair@494 | 738 | $FULLDUMP_CMD $THIS_FILE > $WORK_FILE_BASE.fulldump.this 2>&1 |
ohair@494 | 739 | LANG=C $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this > $WORK_FILE_BASE.fulldump.diff |
ohair@494 | 740 | |
ohair@494 | 741 | if [ -s $WORK_FILE_BASE.fulldump.diff ]; then |
ohair@494 | 742 | ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.fulldump.diff | awk '{print $5}') |
ohair@494 | 743 | ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE) |
ohair@494 | 744 | if [[ "$ACCEPTED_ELF_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 745 | DIFF_ELF=true |
ohair@494 | 746 | if [[ "$KNOWN_ELF_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 747 | ELF_MSG="*$ELF_MSG*" |
ohair@494 | 748 | REGRESSIONS=true |
ohair@494 | 749 | else |
ohair@494 | 750 | ELF_MSG=" $ELF_MSG " |
ohair@494 | 751 | fi |
ohair@494 | 752 | else |
ohair@494 | 753 | ELF_MSG="($ELF_MSG)" |
ohair@494 | 754 | DIFF_ELF= |
ohair@494 | 755 | fi |
ohair@494 | 756 | else |
ohair@494 | 757 | ELF_MSG=" " |
ohair@494 | 758 | DIFF_ELF= |
ohair@494 | 759 | if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then |
ohair@494 | 760 | ELF_MSG=" ! " |
ohair@494 | 761 | fi |
ohair@494 | 762 | fi |
ohair@494 | 763 | fi |
ohair@494 | 764 | |
ohair@494 | 765 | # Compare disassemble output |
ohair@494 | 766 | if [ -n "$DIS_CMD" ] && [ -z "$SKIP_DIS_DIFF" ]; then |
ohair@494 | 767 | if [ -z "$DIS_DIFF_FILTER" ]; then |
ohair@494 | 768 | DIS_DIFF_FILTER="$CAT" |
ohair@494 | 769 | fi |
ohair@494 | 770 | $DIS_CMD $OTHER_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.other 2>&1 |
ohair@494 | 771 | $DIS_CMD $THIS_FILE | $GREP -v $NAME | $DIS_DIFF_FILTER > $WORK_FILE_BASE.dis.this 2>&1 |
ohair@494 | 772 | |
ohair@494 | 773 | LANG=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff |
ohair@494 | 774 | |
ohair@494 | 775 | if [ -s $WORK_FILE_BASE.dis.diff ]; then |
ohair@494 | 776 | DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}') |
ohair@494 | 777 | DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE) |
ohair@494 | 778 | if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 779 | DIFF_DIS=true |
ohair@494 | 780 | if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then |
ohair@494 | 781 | DIS_MSG="*$DIS_MSG*" |
ohair@494 | 782 | REGRESSIONS=true |
ohair@494 | 783 | else |
ohair@494 | 784 | DIS_MSG=" $DIS_MSG " |
ohair@494 | 785 | fi |
ohair@494 | 786 | else |
ohair@494 | 787 | DIS_MSG="($DIS_MSG)" |
ohair@494 | 788 | DIFF_DIS= |
ohair@494 | 789 | fi |
ohair@494 | 790 | else |
ohair@494 | 791 | DIS_MSG=" " |
ohair@494 | 792 | DIFF_DIS= |
ohair@494 | 793 | if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then |
ohair@494 | 794 | DIS_MSG=" ! " |
ohair@494 | 795 | fi |
ohair@494 | 796 | fi |
ohair@494 | 797 | fi |
ohair@494 | 798 | |
ohair@494 | 799 | |
ohair@494 | 800 | if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_ELF$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then |
ohair@494 | 801 | if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi |
ohair@494 | 802 | if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi |
ohair@494 | 803 | if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi |
ohair@494 | 804 | if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi |
ohair@494 | 805 | if [ -n "$ELF_MSG" ]; then echo -n "$ELF_MSG:"; fi |
ohair@494 | 806 | if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi |
ohair@494 | 807 | echo " $BIN_FILE" |
ohair@494 | 808 | if [ "$SHOW_DIFFS" = "true" ]; then |
ohair@494 | 809 | if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then |
ohair@494 | 810 | echo "Symbols diff:" |
ohair@494 | 811 | $CAT $WORK_FILE_BASE.symbols.diff |
ohair@494 | 812 | fi |
ohair@494 | 813 | if [ -s "$WORK_FILE_BASE.deps.diff" ]; then |
ohair@494 | 814 | echo "Deps diff:" |
ohair@494 | 815 | $CAT $WORK_FILE_BASE.deps.diff |
ohair@494 | 816 | fi |
ohair@494 | 817 | if [ -s "$WORK_FILE_BASE.fulldump.diff" ]; then |
ohair@494 | 818 | echo "Fulldump diff:" |
ohair@494 | 819 | $CAT $WORK_FILE_BASE.fulldump.diff |
ohair@494 | 820 | fi |
ohair@494 | 821 | if [ -s "$WORK_FILE_BASE.dis.diff" ]; then |
ohair@494 | 822 | echo "Disassembly diff:" |
ohair@494 | 823 | $CAT $WORK_FILE_BASE.dis.diff |
ohair@494 | 824 | fi |
ohair@494 | 825 | fi |
ohair@494 | 826 | return 1 |
ohair@494 | 827 | fi |
ohair@494 | 828 | return 0 |
ohair@494 | 829 | } |
ohair@494 | 830 | |
ohair@494 | 831 | ########################################################################################## |
ohair@494 | 832 | # Print binary diff header |
ohair@494 | 833 | |
ohair@494 | 834 | print_binary_diff_header() { |
ohair@494 | 835 | if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi |
ohair@494 | 836 | if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n " Size :"; fi |
ohair@494 | 837 | if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi |
ohair@494 | 838 | if [ -z "$SKIP_DEP_DIFF" ]; then echo -n " Deps :"; fi |
ohair@494 | 839 | if [ -z "$SKIP_FULLDUMP_DIFF" ]; then echo -n " Fulldump :"; fi |
ohair@494 | 840 | if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass :"; fi |
ohair@494 | 841 | echo |
ohair@494 | 842 | } |
ohair@494 | 843 | |
ohair@494 | 844 | ########################################################################################## |
ohair@494 | 845 | # Compare all libraries |
ohair@494 | 846 | |
ohair@494 | 847 | compare_all_libs() { |
ohair@494 | 848 | THIS_DIR=$1 |
ohair@494 | 849 | OTHER_DIR=$2 |
ohair@494 | 850 | WORK_DIR=$3 |
ohair@494 | 851 | |
tbell@510 | 852 | LIBS=$(cd $THIS_DIR && $FIND . -type f \( -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' -o -name 'JavaControlPanel' \) | $SORT | $FILTER) |
ohair@494 | 853 | |
ohair@494 | 854 | if [ -n "$LIBS" ]; then |
ohair@494 | 855 | echo Libraries... |
ohair@494 | 856 | print_binary_diff_header |
ohair@494 | 857 | for l in $LIBS; do |
ohair@494 | 858 | if [ -f "$OTHER_DIR/$l" ]; then |
ohair@494 | 859 | compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l |
ohair@494 | 860 | if [ "$?" != "0" ]; then |
ohair@494 | 861 | return_value=1 |
ohair@494 | 862 | fi |
ohair@494 | 863 | fi |
ohair@494 | 864 | done |
ohair@494 | 865 | fi |
ohair@494 | 866 | |
ohair@494 | 867 | return $return_value |
ohair@494 | 868 | } |
ohair@494 | 869 | |
ohair@494 | 870 | ########################################################################################## |
ohair@494 | 871 | # Compare all executables |
ohair@494 | 872 | |
ohair@494 | 873 | compare_all_execs() { |
ohair@494 | 874 | THIS_DIR=$1 |
ohair@494 | 875 | OTHER_DIR=$2 |
ohair@494 | 876 | WORK_DIR=$3 |
ohair@494 | 877 | |
ohair@494 | 878 | if [ "$OPENJDK_TARGET_OS" = "windows" ]; then |
ohair@494 | 879 | EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER) |
ohair@494 | 880 | else |
erikj@502 | 881 | EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \ |
erikj@502 | 882 | \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \ |
erikj@502 | 883 | -o -name '*.jar' -o -name '*.diz' -o -name 'jcontrol' -o -name '*.properties' \ |
erikj@502 | 884 | -o -name '*.data' -o -name '*.bfc' -o -name '*.src' -o -name '*.txt' \ |
erikj@502 | 885 | -o -name '*.cfg' -o -name 'meta-index' -o -name '*.properties.ja' \ |
erikj@502 | 886 | -o -name 'classlist' \) | $SORT | $FILTER) |
ohair@494 | 887 | fi |
ohair@494 | 888 | |
ohair@494 | 889 | if [ -n "$EXECS" ]; then |
ohair@494 | 890 | echo Executables... |
ohair@494 | 891 | print_binary_diff_header |
ohair@494 | 892 | for e in $EXECS; do |
ohair@494 | 893 | if [ -f "$OTHER_DIR/$e" ]; then |
ohair@494 | 894 | compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e |
ohair@494 | 895 | if [ "$?" != "0" ]; then |
ohair@494 | 896 | return_value=1 |
ohair@494 | 897 | fi |
ohair@494 | 898 | fi |
ohair@494 | 899 | done |
ohair@494 | 900 | fi |
ohair@494 | 901 | |
ohair@494 | 902 | return $return_value |
ohair@494 | 903 | } |
ohair@494 | 904 | |
ohair@494 | 905 | ########################################################################################## |
ohair@494 | 906 | # Initiate configuration |
ohair@494 | 907 | |
ohair@494 | 908 | COMPARE_ROOT=/tmp/cimages.$USER |
ohair@494 | 909 | $MKDIR -p $COMPARE_ROOT |
ohair@494 | 910 | if [ "$OPENJDK_TARGET_OS" = "windows" ]; then |
ohair@494 | 911 | if [ "$(uname -o)" = "Cygwin" ]; then |
ohair@494 | 912 | COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT) |
ohair@494 | 913 | fi |
ohair@494 | 914 | fi |
ohair@494 | 915 | |
ohair@494 | 916 | THIS="$( cd "$( dirname "$0" )" && pwd )" |
ohair@494 | 917 | echo "$THIS" |
ohair@494 | 918 | THIS_SCRIPT="$0" |
ohair@494 | 919 | |
ohair@494 | 920 | if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then |
ohair@494 | 921 | echo "bash ./compare.sh [OPTIONS] [FILTER]" |
ohair@494 | 922 | echo "" |
ohair@494 | 923 | echo "-all Compare all files in all known ways" |
ohair@494 | 924 | echo "-names Compare the file names and directory structure" |
ohair@494 | 925 | echo "-perms Compare the permission bits on all files and directories" |
ohair@494 | 926 | echo "-types Compare the output of the file command on all files" |
ohair@494 | 927 | echo "-general Compare the files not convered by the specialized comparisons" |
ohair@494 | 928 | echo "-zips Compare the contents of all zip files" |
ohair@494 | 929 | echo "-jars Compare the contents of all jar files" |
ohair@494 | 930 | echo "-libs Compare all native libraries" |
ohair@494 | 931 | echo "-execs Compare all executables" |
ohair@494 | 932 | echo "-v Verbose output, does not hide known differences" |
ohair@494 | 933 | echo "-vv More verbose output, shows diff output of all comparisons" |
ohair@494 | 934 | echo "-o [OTHER] Compare with build in other directory. Will default to the old build directory" |
ohair@494 | 935 | echo "" |
ohair@494 | 936 | echo "[FILTER] List filenames in the image to compare, works for jars, zips, libs and execs" |
ohair@494 | 937 | echo "Example:" |
ohair@494 | 938 | echo "bash ./common/bin/compareimages.sh CodePointIM.jar" |
ohair@494 | 939 | exit 10 |
ohair@494 | 940 | fi |
ohair@494 | 941 | |
ohair@494 | 942 | CMP_NAMES=false |
ohair@494 | 943 | CMP_PERMS=false |
ohair@494 | 944 | CMP_TYPES=false |
ohair@494 | 945 | CMP_GENERAL=false |
ohair@494 | 946 | CMP_ZIPS=false |
ohair@494 | 947 | CMP_JARS=false |
ohair@494 | 948 | CMP_LIBS=false |
ohair@494 | 949 | CMP_EXECS=false |
ohair@494 | 950 | |
ohair@494 | 951 | while [ -n "$1" ]; do |
ohair@494 | 952 | case "$1" in |
ohair@494 | 953 | -v) |
ohair@494 | 954 | VERBOSE=true |
ohair@494 | 955 | ;; |
ohair@494 | 956 | -vv) |
ohair@494 | 957 | VERBOSE=true |
ohair@494 | 958 | SHOW_DIFFS=true |
ohair@494 | 959 | ;; |
ohair@494 | 960 | -o) |
ohair@494 | 961 | OTHER="$2" |
ohair@494 | 962 | shift |
ohair@494 | 963 | ;; |
ohair@494 | 964 | -all) |
ohair@494 | 965 | CMP_NAMES=true |
ohair@494 | 966 | if [ "$OPENJDK_TARGET_OS" != "windows" ]; then |
ohair@494 | 967 | CMP_PERMS=true |
ohair@494 | 968 | fi |
ohair@494 | 969 | CMP_TYPES=true |
ohair@494 | 970 | CMP_GENERAL=true |
ohair@494 | 971 | CMP_ZIPS=true |
ohair@494 | 972 | CMP_JARS=true |
ohair@494 | 973 | CMP_LIBS=true |
ohair@494 | 974 | CMP_EXECS=true |
ohair@494 | 975 | ;; |
ohair@494 | 976 | -names) |
ohair@494 | 977 | CMP_NAMES=true |
ohair@494 | 978 | ;; |
ohair@494 | 979 | -perms) |
ohair@494 | 980 | CMP_PERMS=true |
ohair@494 | 981 | ;; |
ohair@494 | 982 | -types) |
ohair@494 | 983 | CMP_TYPES=true |
ohair@494 | 984 | ;; |
ohair@494 | 985 | -general) |
ohair@494 | 986 | CMP_GENERAL=true |
ohair@494 | 987 | ;; |
ohair@494 | 988 | -zips) |
ohair@494 | 989 | CMP_ZIPS=true |
ohair@494 | 990 | ;; |
ohair@494 | 991 | -jars) |
ohair@494 | 992 | CMP_JARS=true |
ohair@494 | 993 | ;; |
ohair@494 | 994 | -libs) |
ohair@494 | 995 | CMP_LIBS=true |
ohair@494 | 996 | ;; |
ohair@494 | 997 | -execs) |
ohair@494 | 998 | CMP_EXECS=true |
ohair@494 | 999 | ;; |
ohair@494 | 1000 | *) |
ohair@494 | 1001 | CMP_NAMES=false |
ohair@494 | 1002 | CMP_PERMS=false |
ohair@494 | 1003 | CMP_TYPES=false |
ohair@494 | 1004 | CMP_ZIPS=true |
ohair@494 | 1005 | CMP_JARS=true |
ohair@494 | 1006 | CMP_LIBS=true |
ohair@494 | 1007 | CMP_EXECS=true |
ohair@494 | 1008 | |
ohair@494 | 1009 | if [ -z "$FILTER" ]; then |
ohair@494 | 1010 | FILTER="$GREP" |
ohair@494 | 1011 | fi |
ohair@494 | 1012 | FILTER="$FILTER -e $1" |
ohair@494 | 1013 | ;; |
ohair@494 | 1014 | esac |
ohair@494 | 1015 | shift |
ohair@494 | 1016 | done |
ohair@494 | 1017 | |
ohair@494 | 1018 | 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 |
ohair@494 | 1019 | CMP_NAMES=true |
ohair@494 | 1020 | CMP_PERMS=true |
ohair@494 | 1021 | CMP_TYPES=true |
ohair@494 | 1022 | CMP_GENERAL=true |
ohair@494 | 1023 | CMP_ZIPS=true |
ohair@494 | 1024 | CMP_JARS=true |
ohair@494 | 1025 | CMP_LIBS=true |
ohair@494 | 1026 | CMP_EXECS=true |
ohair@494 | 1027 | fi |
ohair@494 | 1028 | |
ohair@494 | 1029 | if [ -z "$FILTER" ]; then |
ohair@494 | 1030 | FILTER="$CAT" |
ohair@494 | 1031 | fi |
ohair@494 | 1032 | |
ohair@494 | 1033 | if [ -z "$OTHER" ]; then |
ohair@494 | 1034 | OTHER="$THIS/../$LEGACY_BUILD_DIR" |
ohair@494 | 1035 | if [ -d "$OTHER" ]; then |
ohair@494 | 1036 | OTHER="$( cd "$OTHER" && pwd )" |
ohair@494 | 1037 | else |
ohair@494 | 1038 | echo "Default old build directory does not exist:" |
ohair@494 | 1039 | echo "$OTHER" |
ohair@494 | 1040 | exit 1 |
ohair@494 | 1041 | fi |
ohair@494 | 1042 | echo "Comparing to default old build:" |
ohair@494 | 1043 | echo "$OTHER" |
ohair@494 | 1044 | echo |
ohair@494 | 1045 | else |
ohair@494 | 1046 | if [ ! -d "$OTHER" ]; then |
ohair@494 | 1047 | echo "Other build directory does not exist:" |
ohair@494 | 1048 | echo "$OTHER" |
ohair@494 | 1049 | exit 1 |
ohair@494 | 1050 | fi |
ohair@494 | 1051 | OTHER="$( cd "$OTHER" && pwd )" |
ohair@494 | 1052 | echo "Comparing to:" |
ohair@494 | 1053 | echo "$OTHER" |
ohair@494 | 1054 | echo |
ohair@494 | 1055 | fi |
ohair@494 | 1056 | |
ohair@494 | 1057 | |
ohair@494 | 1058 | # Figure out the layout of the this build. Which kinds of images have been produced |
ohair@494 | 1059 | if [ -d "$THIS/deploy/j2sdk-image" ]; then |
ohair@494 | 1060 | THIS_J2SDK="$THIS/deploy/j2sdk-image" |
ohair@494 | 1061 | THIS_J2RE="$THIS/deploy/j2re-image" |
erikj@502 | 1062 | echo "Comparing deploy images" |
ohair@494 | 1063 | elif [ -d "$THIS/images/j2sdk-image" ]; then |
ohair@494 | 1064 | THIS_J2SDK="$THIS/images/j2sdk-image" |
ohair@494 | 1065 | THIS_J2RE="$THIS/images/j2re-image" |
ohair@494 | 1066 | fi |
ohair@494 | 1067 | if [ -d "$THIS/images/j2sdk-overlay-image" ]; then |
ohair@494 | 1068 | THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image" |
ohair@494 | 1069 | THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image" |
ohair@494 | 1070 | fi |
ohair@494 | 1071 | |
ohair@494 | 1072 | if [ -d "$THIS/images/j2sdk-bundle" ]; then |
ohair@494 | 1073 | THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle" |
ohair@494 | 1074 | THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle" |
ohair@494 | 1075 | fi |
ohair@494 | 1076 | |
ohair@494 | 1077 | # Figure out the layout of the other build (old or new, normal or overlay image) |
ohair@494 | 1078 | if [ -d "$OTHER/j2sdk-image" ]; then |
ohair@494 | 1079 | if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then |
ohair@494 | 1080 | OTHER_J2SDK="$OTHER/j2sdk-image" |
ohair@494 | 1081 | OTHER_J2RE="$OTHER/j2re-image" |
ohair@494 | 1082 | else |
ohair@494 | 1083 | OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image" |
ohair@494 | 1084 | OTHER_J2RE_OVERLAY="$OTHER/j2re-image" |
ohair@494 | 1085 | fi |
ohair@494 | 1086 | |
ohair@494 | 1087 | fi |
ohair@494 | 1088 | |
ohair@494 | 1089 | if [ -d "$OTHER/j2sdk-bundle" ]; then |
ohair@494 | 1090 | OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle" |
ohair@494 | 1091 | OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle" |
ohair@494 | 1092 | elif [ -d "$OTHER/images/j2sdk-bundle" ]; then |
ohair@494 | 1093 | OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle" |
ohair@494 | 1094 | OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle" |
ohair@494 | 1095 | fi |
ohair@494 | 1096 | |
ohair@494 | 1097 | if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then |
ohair@494 | 1098 | if [ -z "$THIS_J2SDK_OVERLAY" ]; then |
ohair@494 | 1099 | echo "Cannot locate images for this build. Are you sure you have run 'make images'?" |
ohair@494 | 1100 | exit 1 |
ohair@494 | 1101 | fi |
ohair@494 | 1102 | fi |
ohair@494 | 1103 | |
ohair@494 | 1104 | if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then |
ohair@494 | 1105 | echo "OTHER build only has an overlay image while this build does not. Nothing to compare!" |
ohair@494 | 1106 | exit 1 |
ohair@494 | 1107 | fi |
ohair@494 | 1108 | |
ohair@494 | 1109 | if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then |
ohair@494 | 1110 | echo "WARNING! OTHER build has bundles built while this build does not." |
ohair@494 | 1111 | echo "Skipping bundle compare!" |
ohair@494 | 1112 | fi |
ohair@494 | 1113 | |
ohair@494 | 1114 | ########################################################################################## |
ohair@494 | 1115 | # Do the work |
ohair@494 | 1116 | |
ohair@494 | 1117 | if [ "$CMP_NAMES" = "true" ]; then |
ohair@494 | 1118 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1119 | echo -n "J2SDK " |
ohair@494 | 1120 | compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1121 | echo -n "J2RE " |
ohair@494 | 1122 | compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re |
ohair@494 | 1123 | |
ohair@494 | 1124 | echo -n "J2SDK " |
ohair@494 | 1125 | compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1126 | echo -n "J2RE " |
ohair@494 | 1127 | compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re |
ohair@494 | 1128 | fi |
ohair@494 | 1129 | if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then |
ohair@494 | 1130 | echo -n "J2SDK Overlay " |
ohair@494 | 1131 | compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1132 | echo -n "J2RE Overlay " |
ohair@494 | 1133 | compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay |
ohair@494 | 1134 | |
ohair@494 | 1135 | echo -n "J2SDK Overlay " |
ohair@494 | 1136 | compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1137 | echo -n "J2RE Overlay " |
ohair@494 | 1138 | compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay |
ohair@494 | 1139 | fi |
ohair@494 | 1140 | if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then |
ohair@494 | 1141 | echo -n "J2SDK Bundle " |
ohair@494 | 1142 | compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle |
ohair@494 | 1143 | echo -n "J2RE Bundle " |
ohair@494 | 1144 | compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle |
ohair@494 | 1145 | |
ohair@494 | 1146 | echo -n "J2SDK Bundle " |
ohair@494 | 1147 | compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle |
ohair@494 | 1148 | echo -n "J2RE Bundle " |
ohair@494 | 1149 | compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle |
ohair@494 | 1150 | fi |
ohair@494 | 1151 | fi |
ohair@494 | 1152 | |
ohair@494 | 1153 | if [ "$CMP_PERMS" = "true" ]; then |
ohair@494 | 1154 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1155 | echo -n "J2SDK " |
ohair@494 | 1156 | compare_permissions $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1157 | echo -n "J2RE " |
ohair@494 | 1158 | compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re |
ohair@494 | 1159 | fi |
ohair@494 | 1160 | if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then |
ohair@494 | 1161 | echo -n "J2SDK Overlay " |
ohair@494 | 1162 | compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1163 | echo -n "J2RE Overlay " |
ohair@494 | 1164 | compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay |
ohair@494 | 1165 | fi |
ohair@494 | 1166 | if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then |
ohair@494 | 1167 | echo -n "J2SDK Bundle " |
ohair@494 | 1168 | compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle |
ohair@494 | 1169 | echo -n "J2RE Bundle " |
ohair@494 | 1170 | compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle |
ohair@494 | 1171 | fi |
ohair@494 | 1172 | fi |
ohair@494 | 1173 | |
ohair@494 | 1174 | if [ "$CMP_TYPES" = "true" ]; then |
ohair@494 | 1175 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1176 | echo -n "J2SDK " |
ohair@494 | 1177 | compare_file_types $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1178 | echo -n "J2RE " |
ohair@494 | 1179 | compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re |
ohair@494 | 1180 | fi |
ohair@494 | 1181 | if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then |
ohair@494 | 1182 | echo -n "J2SDK Overlay " |
ohair@494 | 1183 | compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1184 | echo -n "J2RE Overlay " |
ohair@494 | 1185 | compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay |
ohair@494 | 1186 | fi |
ohair@494 | 1187 | if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then |
ohair@494 | 1188 | echo -n "J2SDK Bundle " |
ohair@494 | 1189 | compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle |
ohair@494 | 1190 | echo -n "J2RE Bundle " |
ohair@494 | 1191 | compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle |
ohair@494 | 1192 | fi |
ohair@494 | 1193 | fi |
ohair@494 | 1194 | |
ohair@494 | 1195 | if [ "$CMP_GENERAL" = "true" ]; then |
ohair@494 | 1196 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1197 | echo -n "J2SDK " |
ohair@494 | 1198 | compare_general_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1199 | echo -n "J2RE " |
ohair@494 | 1200 | compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re |
ohair@494 | 1201 | fi |
ohair@494 | 1202 | if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then |
ohair@494 | 1203 | echo -n "J2SDK Overlay " |
ohair@494 | 1204 | compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1205 | echo -n "J2RE Overlay " |
ohair@494 | 1206 | compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay |
ohair@494 | 1207 | fi |
ohair@494 | 1208 | if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then |
ohair@494 | 1209 | echo -n "J2SDK Bundle " |
ohair@494 | 1210 | compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle |
ohair@494 | 1211 | echo -n "J2RE Bundle " |
ohair@494 | 1212 | compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle |
ohair@494 | 1213 | fi |
ohair@494 | 1214 | fi |
ohair@494 | 1215 | |
ohair@494 | 1216 | if [ "$CMP_ZIPS" = "true" ]; then |
ohair@494 | 1217 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1218 | compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1219 | fi |
ohair@494 | 1220 | fi |
ohair@494 | 1221 | |
ohair@494 | 1222 | if [ "$CMP_JARS" = "true" ]; then |
ohair@494 | 1223 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1224 | compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1225 | fi |
ohair@494 | 1226 | fi |
ohair@494 | 1227 | |
ohair@494 | 1228 | if [ "$CMP_LIBS" = "true" ]; then |
ohair@494 | 1229 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
tbell@510 | 1230 | echo -n "J2SDK " |
ohair@494 | 1231 | compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
tbell@510 | 1232 | if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then |
tbell@510 | 1233 | echo -n "J2RE " |
tbell@510 | 1234 | compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re |
tbell@510 | 1235 | fi |
ohair@494 | 1236 | fi |
ohair@494 | 1237 | if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then |
ohair@494 | 1238 | echo -n "Bundle " |
ohair@494 | 1239 | compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1240 | fi |
ohair@494 | 1241 | fi |
ohair@494 | 1242 | |
ohair@494 | 1243 | if [ "$CMP_EXECS" = "true" ]; then |
ohair@494 | 1244 | if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then |
ohair@494 | 1245 | compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk |
ohair@494 | 1246 | fi |
ohair@494 | 1247 | if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then |
ohair@494 | 1248 | echo -n "Overlay " |
ohair@494 | 1249 | compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay |
ohair@494 | 1250 | fi |
ohair@494 | 1251 | fi |
ohair@494 | 1252 | |
ohair@494 | 1253 | echo |
ohair@494 | 1254 | |
ohair@494 | 1255 | if [ -n "$REGRESSIONS" ]; then |
ohair@494 | 1256 | echo "REGRESSIONS FOUND!" |
ohair@494 | 1257 | echo |
ohair@494 | 1258 | exit 1 |
ohair@494 | 1259 | else |
ohair@494 | 1260 | echo "No regressions found" |
ohair@494 | 1261 | echo |
ohair@494 | 1262 | exit 0 |
ohair@494 | 1263 | fi |