common/autoconf/compare.sh.in
changeset 13697 5262b00bc10c
child 14111 2a82ecb35fc7
equal deleted inserted replaced
13694:ffe6bce5a521 13697:5262b00bc10c
       
     1 #!/bin/bash
       
     2 #
       
     3 # Copyright (c) 2012, 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 # Substitutions from autoconf
       
    31 
       
    32 LEGACY_BUILD_DIR=@OPENJDK_TARGET_OS@-@OPENJDK_TARGET_CPU_LEGACY@
       
    33 
       
    34 OPENJDK_TARGET_OS="@OPENJDK_TARGET_OS@"
       
    35 OPENJDK_TARGET_CPU="@OPENJDK_TARGET_CPU@"
       
    36 
       
    37 AWK="@AWK@"
       
    38 CAT="@CAT@"
       
    39 CMP="@CMP@"
       
    40 CP="@CP@"
       
    41 CUT="@CUT@"
       
    42 DIFF="@DIFF@"
       
    43 DUMPBIN="@UNCYGDRIVE@ @DUMPBIN@"
       
    44 EXPR="@EXPR@"
       
    45 FILE="@FILE@"
       
    46 FIND="@FIND@"
       
    47 GREP="@GREP@"
       
    48 JAVAP="@UNCYGDRIVE@ @BOOT_JDK@/bin/javap"
       
    49 LDD="@LDD@"
       
    50 MKDIR="@MKDIR@"
       
    51 NM="@NM@"
       
    52 OBJDUMP="@OBJDUMP@"
       
    53 OTOOL="@OTOOL@"
       
    54 PRINTF="@PRINTF@"
       
    55 READELF="@READELF@"
       
    56 RM="@RM@"
       
    57 SED="@SED@"
       
    58 SORT="@SORT@"
       
    59 STRIP="@POST_STRIP_CMD@"
       
    60 TEE="@TEE@"
       
    61 UNIQ="@UNIQ@"
       
    62 UNZIP="@UNZIP@"
       
    63 
       
    64 SRC_ROOT="@SRC_ROOT@"
       
    65 
       
    66 if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
       
    67     READELF_CMD="otool -v -V -h -X -t -d"
       
    68 elif [ -n "$READELF" ] && [ "$OPENJDK_TARGET_OS" != "windows" ]; then
       
    69     READELF_CMD="$READELF -a"
       
    70 fi
       
    71 
       
    72 if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
       
    73     LDD_CMD="$OTOOL -L"
       
    74 elif [ -n "$LDD" ]; then
       
    75     LDD_CMD="$LDD"
       
    76 fi
       
    77 
       
    78 ##########################################################################################
       
    79 # Diff exceptions
       
    80 
       
    81 if [ "$OPENJDK_TARGET_OS" = "linux" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
       
    82 STRIP_BEFORE_COMPARE="
       
    83 ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
       
    84 ./demo/jvmti/gctest/lib/libgctest.so
       
    85 ./demo/jvmti/heapTracker/lib/libheapTracker.so
       
    86 ./demo/jvmti/heapViewer/lib/libheapViewer.so
       
    87 ./demo/jvmti/hprof/lib/libhprof.so
       
    88 ./demo/jvmti/minst/lib/libminst.so
       
    89 ./demo/jvmti/mtrace/lib/libmtrace.so
       
    90 ./demo/jvmti/versionCheck/lib/libversionCheck.so
       
    91 ./demo/jvmti/waiters/lib/libwaiters.so
       
    92 "
       
    93 
       
    94 KNOWN_BIN_DIFF="
       
    95 "
       
    96 
       
    97 ACCEPTED_BIN_DIFF="
       
    98 ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
       
    99 ./demo/jvmti/gctest/lib/libgctest.so
       
   100 ./demo/jvmti/heapTracker/lib/libheapTracker.so
       
   101 ./demo/jvmti/heapViewer/lib/libheapViewer.so
       
   102 ./demo/jvmti/hprof/lib/libhprof.so
       
   103 ./demo/jvmti/minst/lib/libminst.so
       
   104 ./demo/jvmti/mtrace/lib/libmtrace.so
       
   105 ./demo/jvmti/versionCheck/lib/libversionCheck.so
       
   106 ./demo/jvmti/waiters/lib/libwaiters.so
       
   107 ./jre/lib/amd64/libattach.so
       
   108 ./jre/lib/amd64/libdt_socket.so
       
   109 ./jre/lib/amd64/libhprof.so
       
   110 ./jre/lib/amd64/libinstrument.so
       
   111 ./jre/lib/amd64/libjava_crw_demo.so
       
   112 ./jre/lib/amd64/libjsdt.so
       
   113 ./jre/lib/amd64/libjsig.so
       
   114 ./jre/lib/amd64/libmanagement.so
       
   115 ./jre/lib/amd64/libnpt.so
       
   116 ./jre/lib/amd64/libsaproc.so
       
   117 ./jre/lib/amd64/libverify.so
       
   118 ./jre/lib/amd64/server/libjsig.so
       
   119 ./jre/lib/amd64/server/libjvm.so
       
   120 ./bin/appletviewer
       
   121 ./bin/extcheck
       
   122 ./bin/idlj
       
   123 ./bin/jar
       
   124 ./bin/jarsigner
       
   125 ./bin/java
       
   126 ./bin/javac
       
   127 ./bin/javadoc
       
   128 ./bin/javah
       
   129 ./bin/javap
       
   130 ./bin/jcmd
       
   131 ./bin/jconsole
       
   132 ./bin/jdb
       
   133 ./bin/jhat
       
   134 ./bin/jinfo
       
   135 ./bin/jmap
       
   136 ./bin/jps
       
   137 ./bin/jrunscript
       
   138 ./bin/jsadebugd
       
   139 ./bin/jstack
       
   140 ./bin/jstat
       
   141 ./bin/jstatd
       
   142 ./bin/keytool
       
   143 ./bin/native2ascii
       
   144 ./bin/orbd
       
   145 ./bin/pack200
       
   146 ./bin/policytool
       
   147 ./bin/rmic
       
   148 ./bin/rmid
       
   149 ./bin/rmiregistry
       
   150 ./bin/schemagen
       
   151 ./bin/serialver
       
   152 ./bin/servertool
       
   153 ./bin/tnameserv
       
   154 ./bin/wsgen
       
   155 ./bin/wsimport
       
   156 ./bin/xjc
       
   157 ./jre/bin/java
       
   158 ./jre/bin/keytool
       
   159 ./jre/bin/orbd
       
   160 ./jre/bin/pack200
       
   161 ./jre/bin/policytool
       
   162 ./jre/bin/rmid
       
   163 ./jre/bin/rmiregistry
       
   164 ./jre/bin/servertool
       
   165 ./jre/bin/tnameserv
       
   166 "
       
   167 
       
   168 KNOWN_SIZE_DIFF="
       
   169 "
       
   170 
       
   171 KNOWN_SYM_DIFF="
       
   172 "
       
   173 
       
   174 KNOWN_ELF_DIFF="
       
   175 ./demo/jvmti/heapTracker/lib/libheapTracker.so
       
   176 ./demo/jvmti/hprof/lib/libhprof.so
       
   177 ./demo/jvmti/waiters/lib/libwaiters.so
       
   178 "
       
   179 fi
       
   180 
       
   181 if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
       
   182 
       
   183 STRIP_BEFORE_COMPARE="
       
   184 ./demo/jni/Poller/lib/libPoller.so
       
   185 ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
       
   186 ./demo/jvmti/gctest/lib/libgctest.so
       
   187 ./demo/jvmti/heapTracker/lib/libheapTracker.so
       
   188 ./demo/jvmti/heapViewer/lib/libheapViewer.so
       
   189 ./demo/jvmti/hprof/lib/libhprof.so
       
   190 ./demo/jvmti/minst/lib/libminst.so
       
   191 ./demo/jvmti/mtrace/lib/libmtrace.so
       
   192 ./demo/jvmti/versionCheck/lib/libversionCheck.so
       
   193 ./demo/jvmti/waiters/lib/libwaiters.so
       
   194 ./jre/lib/i386/jexec
       
   195 "
       
   196 
       
   197 SORT_SYMBOLS="
       
   198 ./jre/lib/i386/client/libjvm.so
       
   199 ./jre/lib/i386/server/libjvm.so
       
   200 "
       
   201 
       
   202 SKIP_BIN_DIFF="true"
       
   203 
       
   204 ACCEPTED_SMALL_SIZE_DIFF="
       
   205 ./demo/jni/Poller/lib/libPoller.so
       
   206 ./demo/jvmti/compiledMethodLoad/lib/libcompiledMethodLoad.so
       
   207 ./demo/jvmti/gctest/lib/libgctest.so
       
   208 ./demo/jvmti/heapTracker/lib/libheapTracker.so
       
   209 ./demo/jvmti/heapViewer/lib/libheapViewer.so
       
   210 ./demo/jvmti/hprof/lib/libhprof.so
       
   211 ./demo/jvmti/minst/lib/libminst.so
       
   212 ./demo/jvmti/mtrace/lib/libmtrace.so
       
   213 ./demo/jvmti/versionCheck/lib/libversionCheck.so
       
   214 ./demo/jvmti/waiters/lib/libwaiters.so
       
   215 ./jre/lib/i386/client/libjvm.so
       
   216 ./jre/lib/i386/jli/libjli.so
       
   217 ./jre/lib/i386/libJdbcOdbc.so
       
   218 ./jre/lib/i386/libattach.so
       
   219 ./jre/lib/i386/libawt.so
       
   220 ./jre/lib/i386/libawt_headless.so
       
   221 ./jre/lib/i386/libawt_xawt.so
       
   222 ./jre/lib/i386/libdcpr.so
       
   223 ./jre/lib/i386/libdt_socket.so
       
   224 ./jre/lib/i386/libfontmanager.so
       
   225 ./jre/lib/i386/libhprof.so
       
   226 ./jre/lib/i386/libinstrument.so
       
   227 ./jre/lib/i386/libj2gss.so
       
   228 ./jre/lib/i386/libj2pcsc.so
       
   229 ./jre/lib/i386/libj2pkcs11.so
       
   230 ./jre/lib/i386/libj2ucrypto.so
       
   231 ./jre/lib/i386/libjaas_unix.so
       
   232 ./jre/lib/i386/libjava.so
       
   233 ./jre/lib/i386/libjava_crw_demo.so
       
   234 ./jre/lib/i386/libjawt.so
       
   235 ./jre/lib/i386/libjdwp.so
       
   236 ./jre/lib/i386/libjfr.so
       
   237 ./jre/lib/i386/libjpeg.so
       
   238 ./jre/lib/i386/libjsdt.so
       
   239 ./jre/lib/i386/libjsound.so
       
   240 ./jre/lib/i386/libkcms.so
       
   241 ./jre/lib/i386/libmanagement.so
       
   242 ./jre/lib/i386/libmlib_image.so
       
   243 ./jre/lib/i386/libnet.so
       
   244 ./jre/lib/i386/libnio.so
       
   245 ./jre/lib/i386/libnpt.so
       
   246 ./jre/lib/i386/libsctp.so
       
   247 ./jre/lib/i386/libsplashscreen.so
       
   248 ./jre/lib/i386/libsunec.so
       
   249 ./jre/lib/i386/libsunwjdga.so
       
   250 ./jre/lib/i386/libt2k.so
       
   251 ./jre/lib/i386/libunpack.so
       
   252 ./jre/lib/i386/libverify.so
       
   253 ./jre/lib/i386/libzip.so
       
   254 ./jre/lib/i386/server/libjvm.so
       
   255 ./bin/appletviewer
       
   256 ./bin/extcheck
       
   257 ./bin/idlj
       
   258 ./bin/jar
       
   259 ./bin/jarsigner
       
   260 ./bin/java
       
   261 ./bin/javac
       
   262 ./bin/javadoc
       
   263 ./bin/javah
       
   264 ./bin/javap
       
   265 ./bin/jcmd
       
   266 ./bin/jconsole
       
   267 ./bin/jdb
       
   268 ./bin/jhat
       
   269 ./bin/jinfo
       
   270 ./bin/jmap
       
   271 ./bin/jps
       
   272 ./bin/jrunscript
       
   273 ./bin/jsadebugd
       
   274 ./bin/jstack
       
   275 ./bin/jstat
       
   276 ./bin/jstatd
       
   277 ./bin/keytool
       
   278 ./bin/native2ascii
       
   279 ./bin/orbd
       
   280 ./bin/pack200
       
   281 ./bin/policytool
       
   282 ./bin/rmic
       
   283 ./bin/rmid
       
   284 ./bin/rmiregistry
       
   285 ./bin/schemagen
       
   286 ./bin/serialver
       
   287 ./bin/servertool
       
   288 ./bin/tnameserv
       
   289 ./bin/unpack200
       
   290 ./bin/wsgen
       
   291 ./bin/wsimport
       
   292 ./bin/xjc
       
   293 ./jre/bin/java
       
   294 ./jre/bin/keytool
       
   295 ./jre/bin/orbd
       
   296 ./jre/bin/pack200
       
   297 ./jre/bin/policytool
       
   298 ./jre/bin/rmid
       
   299 ./jre/bin/rmiregistry
       
   300 ./jre/bin/servertool
       
   301 ./jre/bin/tnameserv
       
   302 ./jre/bin/unpack200
       
   303 ./jre/lib/i386/jexec
       
   304 "
       
   305 
       
   306 SKIP_ELF_DIFF="true"
       
   307 
       
   308 # libjvm.so differs in the random 15 char prefix on some symbols.
       
   309 ACCEPTED_DIS_DIFF="
       
   310 ./jre/lib/i386/client/libjvm.so
       
   311 ./jre/lib/i386/server/libjvm.so
       
   312 "
       
   313 
       
   314 fi
       
   315 
       
   316 if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
       
   317 
       
   318 STRIP_BEFORE_COMPARE="
       
   319 ./demo/jni/Poller/lib/amd64/libPoller.so
       
   320 ./demo/jvmti/compiledMethodLoad/lib/amd64/libcompiledMethodLoad.so
       
   321 ./demo/jvmti/gctest/lib/amd64/libgctest.so
       
   322 ./demo/jvmti/heapTracker/lib/amd64/libheapTracker.so
       
   323 ./demo/jvmti/heapViewer/lib/amd64/libheapViewer.so
       
   324 ./demo/jvmti/hprof/lib/amd64/libhprof.so
       
   325 ./demo/jvmti/minst/lib/amd64/libminst.so
       
   326 ./demo/jvmti/mtrace/lib/amd64/libmtrace.so
       
   327 ./demo/jvmti/versionCheck/lib/amd64/libversionCheck.so
       
   328 ./demo/jvmti/waiters/lib/amd64/libwaiters.so
       
   329 "
       
   330 
       
   331 SORT_SYMBOLS="
       
   332 ./jre/lib/amd64/server/libjvm.so
       
   333 "
       
   334 
       
   335 SKIP_BIN_DIFF="true"
       
   336 
       
   337 ACCEPTED_SMALL_SIZE_DIFF="
       
   338 ./demo/jni/Poller/lib/amd64/libPoller.so
       
   339 ./demo/jvmti/compiledMethodLoad/lib/amd64/libcompiledMethodLoad.so
       
   340 ./demo/jvmti/gctest/lib/amd64/libgctest.so
       
   341 ./demo/jvmti/heapTracker/lib/amd64/libheapTracker.so
       
   342 ./demo/jvmti/heapViewer/lib/amd64/libheapViewer.so
       
   343 ./demo/jvmti/hprof/lib/amd64/libhprof.so
       
   344 ./demo/jvmti/minst/lib/amd64/libminst.so
       
   345 ./demo/jvmti/mtrace/lib/amd64/libmtrace.so
       
   346 ./demo/jvmti/versionCheck/lib/amd64/libversionCheck.so
       
   347 ./demo/jvmti/waiters/lib/amd64/libwaiters.so
       
   348 ./jre/lib/amd64/jli/libjli.so
       
   349 ./jre/lib/amd64/libJdbcOdbc.so
       
   350 ./jre/lib/amd64/libattach.so
       
   351 ./jre/lib/amd64/libawt.so
       
   352 ./jre/lib/amd64/libawt_headless.so
       
   353 ./jre/lib/amd64/libawt_xawt.so
       
   354 ./jre/lib/amd64/libdcpr.so
       
   355 ./jre/lib/amd64/libdt_socket.so
       
   356 ./jre/lib/amd64/libfontmanager.so
       
   357 ./jre/lib/amd64/libhprof.so
       
   358 ./jre/lib/amd64/libinstrument.so
       
   359 ./jre/lib/amd64/libj2gss.so
       
   360 ./jre/lib/amd64/libj2pcsc.so
       
   361 ./jre/lib/amd64/libj2pkcs11.so
       
   362 ./jre/lib/amd64/libj2ucrypto.so
       
   363 ./jre/lib/amd64/libjaas_unix.so
       
   364 ./jre/lib/amd64/libjava.so
       
   365 ./jre/lib/amd64/libjava_crw_demo.so
       
   366 ./jre/lib/amd64/libjawt.so
       
   367 ./jre/lib/amd64/libjdwp.so
       
   368 ./jre/lib/amd64/libjfr.so
       
   369 ./jre/lib/amd64/libjpeg.so
       
   370 ./jre/lib/amd64/libjsdt.so
       
   371 ./jre/lib/amd64/libjsound.so
       
   372 ./jre/lib/amd64/libkcms.so
       
   373 ./jre/lib/amd64/libmanagement.so
       
   374 ./jre/lib/amd64/libmlib_image.so
       
   375 ./jre/lib/amd64/libnet.so
       
   376 ./jre/lib/amd64/libnio.so
       
   377 ./jre/lib/amd64/libnpt.so
       
   378 ./jre/lib/amd64/libsctp.so
       
   379 ./jre/lib/amd64/libsplashscreen.so
       
   380 ./jre/lib/amd64/libsunec.so
       
   381 ./jre/lib/amd64/libsunwjdga.so
       
   382 ./jre/lib/amd64/libt2k.so
       
   383 ./jre/lib/amd64/libunpack.so
       
   384 ./jre/lib/amd64/libverify.so
       
   385 ./jre/lib/amd64/libzip.so
       
   386 ./jre/lib/amd64/server/64/libjvm_db.so
       
   387 ./jre/lib/amd64/server/64/libjvm_dtrace.so
       
   388 ./bin/amd64/appletviewer
       
   389 ./bin/amd64/extcheck
       
   390 ./bin/amd64/idlj
       
   391 ./bin/amd64/jar
       
   392 ./bin/amd64/jarsigner
       
   393 ./bin/amd64/java
       
   394 ./bin/amd64/javac
       
   395 ./bin/amd64/javadoc
       
   396 ./bin/amd64/javah
       
   397 ./bin/amd64/javap
       
   398 ./bin/amd64/jcmd
       
   399 ./bin/amd64/jconsole
       
   400 ./bin/amd64/jdb
       
   401 ./bin/amd64/jhat
       
   402 ./bin/amd64/jinfo
       
   403 ./bin/amd64/jmap
       
   404 ./bin/amd64/jps
       
   405 ./bin/amd64/jrunscript
       
   406 ./bin/amd64/jsadebugd
       
   407 ./bin/amd64/jstack
       
   408 ./bin/amd64/jstat
       
   409 ./bin/amd64/jstatd
       
   410 ./bin/amd64/keytool
       
   411 ./bin/amd64/native2ascii
       
   412 ./bin/amd64/orbd
       
   413 ./bin/amd64/pack200
       
   414 ./bin/amd64/policytool
       
   415 ./bin/amd64/rmic
       
   416 ./bin/amd64/rmid
       
   417 ./bin/amd64/rmiregistry
       
   418 ./bin/amd64/schemagen
       
   419 ./bin/amd64/serialver
       
   420 ./bin/amd64/servertool
       
   421 ./bin/amd64/tnameserv
       
   422 ./bin/amd64/unpack200
       
   423 ./bin/amd64/wsgen
       
   424 ./bin/amd64/wsimport
       
   425 ./bin/amd64/xjc
       
   426 ./jre/bin/amd64/java
       
   427 ./jre/bin/amd64/keytool
       
   428 ./jre/bin/amd64/orbd
       
   429 ./jre/bin/amd64/pack200
       
   430 ./jre/bin/amd64/policytool
       
   431 ./jre/bin/amd64/rmid
       
   432 ./jre/bin/amd64/rmiregistry
       
   433 ./jre/bin/amd64/servertool
       
   434 ./jre/bin/amd64/tnameserv
       
   435 ./jre/bin/amd64/unpack200
       
   436 ./jre/lib/amd64/jexec
       
   437 "
       
   438 
       
   439 SKIP_ELF_DIFF="true"
       
   440 
       
   441 # Can't find an explaination for the diff in libmlib_image.so.
       
   442 KNOWN_DIS_DIFF="
       
   443 ./jre/lib/amd64/libmlib_image.so
       
   444 "
       
   445 # libjvm.so differs in the random 15 char prefix on some symbols.
       
   446 ACCEPTED_DIS_DIFF="
       
   447 ./jre/lib/amd64/server/libjvm.so
       
   448 "
       
   449 
       
   450 fi
       
   451 
       
   452 if [ "$OPENJDK_TARGET_OS" = "windows" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
       
   453 
       
   454 ACCEPTED_BIN_DIFF="
       
   455 ./bin/jli.dll
       
   456 ./demo/jvmti/compiledMethodLoad/lib/compiledMethodLoad.dll
       
   457 ./demo/jvmti/gctest/lib/gctest.dll
       
   458 ./demo/jvmti/heapTracker/lib/heapTracker.dll
       
   459 ./demo/jvmti/heapViewer/lib/heapViewer.dll
       
   460 ./demo/jvmti/hprof/lib/hprof.dll
       
   461 ./demo/jvmti/minst/lib/minst.dll
       
   462 ./demo/jvmti/mtrace/lib/mtrace.dll
       
   463 ./demo/jvmti/versionCheck/lib/versionCheck.dll
       
   464 ./demo/jvmti/waiters/lib/waiters.dll
       
   465 ./jre/bin/attach.dll
       
   466 ./jre/bin/awt.dll
       
   467 ./jre/bin/dcpr.dll
       
   468 ./jre/bin/dt_shmem.dll
       
   469 ./jre/bin/dt_socket.dll
       
   470 ./jre/bin/fontmanager.dll
       
   471 ./jre/bin/hprof.dll
       
   472 ./jre/bin/instrument.dll
       
   473 ./jre/bin/j2pcsc.dll
       
   474 ./jre/bin/j2pkcs11.dll
       
   475 ./jre/bin/jaas_nt.dll
       
   476 ./jre/bin/java.dll
       
   477 ./jre/bin/java_crw_demo.dll
       
   478 ./jre/bin/jawt.dll
       
   479 ./jre/bin/JdbcOdbc.dll
       
   480 ./jre/bin/jdwp.dll
       
   481 ./jre/bin/jfr.dll
       
   482 ./jre/bin/jli.dll
       
   483 ./jre/bin/jpeg.dll
       
   484 ./jre/bin/jsdt.dll
       
   485 ./jre/bin/jsound.dll
       
   486 ./jre/bin/jsoundds.dll
       
   487 ./jre/bin/kcms.dll
       
   488 ./jre/bin/management.dll
       
   489 ./jre/bin/mlib_image.dll
       
   490 ./jre/bin/net.dll
       
   491 ./jre/bin/nio.dll
       
   492 ./jre/bin/npt.dll
       
   493 ./jre/bin/sawindbg.dll
       
   494 ./jre/bin/server/jvm.dll
       
   495 ./jre/bin/splashscreen.dll
       
   496 ./jre/bin/sunec.dll
       
   497 ./jre/bin/sunmscapi.dll
       
   498 ./jre/bin/t2k.dll
       
   499 ./jre/bin/unpack.dll
       
   500 ./jre/bin/verify.dll
       
   501 ./jre/bin/w2k_lsa_auth.dll
       
   502 ./jre/bin/zip.dll
       
   503 ./bin/appletviewer.exe
       
   504 ./bin/extcheck.exe
       
   505 ./bin/idlj.exe
       
   506 ./bin/jar.exe
       
   507 ./bin/jarsigner.exe
       
   508 ./bin/java.exe
       
   509 ./bin/javac.exe
       
   510 ./bin/javadoc.exe
       
   511 ./bin/javah.exe
       
   512 ./bin/javap.exe
       
   513 ./bin/java-rmi.exe
       
   514 ./bin/javaw.exe
       
   515 ./bin/jcmd.exe
       
   516 ./bin/jconsole.exe
       
   517 ./bin/jdb.exe
       
   518 ./bin/jhat.exe
       
   519 ./bin/jinfo.exe
       
   520 ./bin/jmap.exe
       
   521 ./bin/jps.exe
       
   522 ./bin/jrunscript.exe
       
   523 ./bin/jsadebugd.exe
       
   524 ./bin/jstack.exe
       
   525 ./bin/jstat.exe
       
   526 ./bin/jstatd.exe
       
   527 ./bin/keytool.exe
       
   528 ./bin/kinit.exe
       
   529 ./bin/klist.exe
       
   530 ./bin/ktab.exe
       
   531 ./bin/native2ascii.exe
       
   532 ./bin/orbd.exe
       
   533 ./bin/pack200.exe
       
   534 ./bin/policytool.exe
       
   535 ./bin/rmic.exe
       
   536 ./bin/rmid.exe
       
   537 ./bin/rmiregistry.exe
       
   538 ./bin/schemagen.exe
       
   539 ./bin/serialver.exe
       
   540 ./bin/servertool.exe
       
   541 ./bin/tnameserv.exe
       
   542 ./bin/unpack200.exe
       
   543 ./bin/wsgen.exe
       
   544 ./bin/wsimport.exe
       
   545 ./bin/xjc.exe
       
   546 ./jre/bin/java.exe
       
   547 ./jre/bin/java-rmi.exe
       
   548 ./jre/bin/javaw.exe
       
   549 ./jre/bin/keytool.exe
       
   550 ./jre/bin/kinit.exe
       
   551 ./jre/bin/klist.exe
       
   552 ./jre/bin/ktab.exe
       
   553 ./jre/bin/orbd.exe
       
   554 ./jre/bin/pack200.exe
       
   555 ./jre/bin/policytool.exe
       
   556 ./jre/bin/rmid.exe
       
   557 ./jre/bin/rmiregistry.exe
       
   558 ./jre/bin/servertool.exe
       
   559 ./jre/bin/tnameserv.exe
       
   560 ./jre/bin/unpack200.exe
       
   561 "
       
   562 
       
   563 KNOWN_SIZE_DIFF="
       
   564 ./demo/jvmti/heapTracker/lib/heapTracker.dll
       
   565 ./demo/jvmti/minst/lib/minst.dll
       
   566 ./jre/bin/awt.dll
       
   567 ./jre/bin/java_crw_demo.dll
       
   568 ./bin/java.exe
       
   569 ./bin/javaw.exe
       
   570 ./bin/unpack200.exe
       
   571 ./jre/bin/java.exe
       
   572 ./jre/bin/javaw.exe
       
   573 ./jre/bin/unpack200.exe
       
   574 "
       
   575 
       
   576 KNOWN_SYM_DIFF="
       
   577 ./jre/bin/awt.dll
       
   578 ./jre/bin/java_crw_demo.dll
       
   579 "
       
   580 fi
       
   581 
       
   582 
       
   583 
       
   584 if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
       
   585 ACCEPTED_JARZIP_CONTENTS="
       
   586 /META-INF/INDEX.LIST
       
   587 "
       
   588 
       
   589 KNOWN_BIN_DIFF="
       
   590 ./jre/lib/libJObjC.dylib
       
   591 ./jre/lib/libsaproc.dylib
       
   592 ./jre/lib/server/libjvm.dylib
       
   593 "
       
   594 
       
   595 ACCEPTED_BIN_DIFF="
       
   596 ./bin/appletviewer
       
   597 ./bin/extcheck
       
   598 ./bin/idlj
       
   599 ./bin/jar
       
   600 ./bin/jarsigner
       
   601 ./bin/java
       
   602 ./bin/javac
       
   603 ./bin/javadoc
       
   604 ./bin/javah
       
   605 ./bin/javap
       
   606 ./bin/jcmd
       
   607 ./bin/jconsole
       
   608 ./bin/jdb
       
   609 ./bin/jhat
       
   610 ./bin/jinfo
       
   611 ./bin/jmap
       
   612 ./bin/jps
       
   613 ./bin/jrunscript
       
   614 ./bin/jsadebugd
       
   615 ./bin/jstack
       
   616 ./bin/jstat
       
   617 ./bin/jstatd
       
   618 ./bin/keytool
       
   619 ./bin/native2ascii
       
   620 ./bin/orbd
       
   621 ./bin/pack200
       
   622 ./bin/policytool
       
   623 ./bin/rmic
       
   624 ./bin/rmid
       
   625 ./bin/rmiregistry
       
   626 ./bin/schemagen
       
   627 ./bin/serialver
       
   628 ./bin/servertool
       
   629 ./bin/tnameserv
       
   630 ./bin/wsgen
       
   631 ./bin/wsimport
       
   632 ./bin/xjc
       
   633 ./jre/bin/java
       
   634 ./jre/bin/keytool
       
   635 ./jre/bin/orbd
       
   636 ./jre/bin/pack200
       
   637 ./jre/bin/policytool
       
   638 ./jre/bin/rmid
       
   639 ./jre/bin/rmiregistry
       
   640 ./jre/bin/servertool
       
   641 ./jre/bin/tnameserv
       
   642 "
       
   643 
       
   644 KNOWN_SIZE_DIFF="
       
   645 ./jre/lib/libJObjC.dylib
       
   646 ./jre/lib/server/libjvm.dylib
       
   647 "
       
   648 
       
   649 KNOWN_SYM_DIFF="
       
   650 ./jre/lib/libJObjC.dylib
       
   651 ./jre/lib/server/libjvm.dylib
       
   652 "
       
   653 
       
   654 KNOWN_ELF_DIFF="
       
   655 ./jre/lib/libJObjC.dylib
       
   656 ./jre/lib/server/libjvm.dylib
       
   657 "
       
   658 
       
   659 SKIP_DIS_DIFF="true"
       
   660 
       
   661 fi
       
   662 
       
   663 ##########################################################################################
       
   664 # Compare text files and ignore specific differences:
       
   665 #
       
   666 #  * Timestamps in Java sources generated by idl2java
       
   667 #  * Sorting order and cleanup style in .properties files
       
   668 
       
   669 diff_text() {
       
   670     OTHER_FILE=$1
       
   671     THIS_FILE=$2
       
   672 
       
   673     SUFFIX="${THIS_FILE##*.}"
       
   674 
       
   675     TMP=1
       
   676 
       
   677     if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
       
   678         TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
       
   679             $GREP '^[<>]' | \
       
   680             $SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
       
   681 	         -e '/[<>] Created-By: .* (Oracle Corporation).*/d')
       
   682     fi
       
   683     if test "x$SUFFIX" = "xjava"; then
       
   684         TMP=$(LANG=C $DIFF $OTHER_FILE $THIS_FILE | \
       
   685             $GREP '^[<>]' | \
       
   686             $SED -e '/[<>] \* from.*\.idl/d' \
       
   687                  -e '/[<>] \*.*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
       
   688                  -e '/[<>] \*.*[0-9]\{4\} [0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \
       
   689                  -e '/\/\/ Generated from input file.*/d' \
       
   690                  -e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \
       
   691                  -e '/\/\/ java GenerateCharacter.*/d')
       
   692     fi
       
   693     # Ignore date strings in class files.
       
   694     # On Macosx the system sources for generated java classes produce different output on 
       
   695     # consequtive invokations seemingly randomly.
       
   696     # For example a method parameter randomly named "thePoint" or "aPoint". Ignore this.
       
   697     if test "x$SUFFIX" = "xclass"; then
       
   698         $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
       
   699         $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
       
   700         TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
       
   701             $GREP '^[<>]' | \
       
   702             $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
       
   703 	         -e '/[<>].*Point   Lcom\/apple\/jobjc\/foundation\/NSPoint;/d' \
       
   704 	         -e '/[<>].*public com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*itemsPtr();/d' \
       
   705 	         -e '/[<>].*public void setItemsPtr(com\.apple\.jobjc\.Pointer<com\.apple\.jobjc\..*);/d')
       
   706     fi
       
   707     if test "x$SUFFIX" = "xproperties"; then
       
   708         $CAT $OTHER_FILE | $SED -e 's/\([^\\]\):/\1\\:/g' -e  's/\([^\\]\)=/\1\\=/g' -e 's/#.*/#/g' \
       
   709             | $SED -f "$SRC_ROOT/common/bin/unicode2x.sed" \
       
   710   	    | $SED -e '/^#/d' -e '/^$/d' \
       
   711             -e :a -e '/\\$/N; s/\\\n//; ta' \
       
   712   	    -e 's/^[ \t]*//;s/[ \t]*$//' \
       
   713 	    -e 's/\\=/=/' | LANG=C $SORT > $OTHER_FILE.cleaned
       
   714         TMP=$(LANG=C $DIFF $OTHER_FILE.cleaned $THIS_FILE)
       
   715     fi
       
   716     if test -n "$TMP"; then
       
   717         echo Files $OTHER_FILE and $THIS_FILE differ
       
   718         return 1
       
   719     fi
       
   720 
       
   721     return 0
       
   722 }
       
   723 
       
   724 ##########################################################################################
       
   725 # Compare directory structure
       
   726 
       
   727 compare_dirs() {
       
   728     THIS_DIR=$1
       
   729     OTHER_DIR=$2
       
   730     WORK_DIR=$3
       
   731 
       
   732     mkdir -p $WORK_DIR
       
   733 
       
   734     (cd $OTHER_DIR && $FIND . -type d | $SORT > $WORK_DIR/other_dirs)
       
   735     (cd $THIS_DIR && $FIND . -type d | $SORT > $WORK_DIR/this_dirs)
       
   736     
       
   737     echo -n Directory structure...
       
   738     if $DIFF $WORK_DIR/other_dirs $WORK_DIR/this_dirs > /dev/null; then
       
   739         echo Identical!
       
   740     else
       
   741         echo Differences found.
       
   742         REGRESSIONS=true
       
   743     # Differences in directories found.
       
   744         ONLY_OTHER=$($DIFF $WORK_DIR/other_dirs $WORK_DIR/this_dirs | $GREP '<')
       
   745         if [ "$ONLY_OTHER" ]; then
       
   746             echo Only in $OTHER
       
   747             echo $ONLY_OTHER | $SED 's|< ./|\t|g' | $SED 's/ /\n/g'
       
   748         fi
       
   749     # Differences in directories found.
       
   750         ONLY_THIS=$($DIFF $WORK_DIR/other_dirs $WORK_DIR/this_dirs | $GREP '>')
       
   751         if [ "$ONLY_THIS" ]; then
       
   752             echo Only in $THIS
       
   753             echo $ONLY_THIS | $SED 's|> ./|\t|g' | $SED 's/ /\n/g'
       
   754         fi
       
   755     fi
       
   756 }
       
   757 
       
   758 
       
   759 ##########################################################################################
       
   760 # Compare file structure
       
   761 
       
   762 compare_files() {
       
   763     THIS_DIR=$1
       
   764     OTHER_DIR=$2
       
   765     WORK_DIR=$3
       
   766 
       
   767     mkdir -p $WORK_DIR
       
   768 
       
   769     (cd $OTHER_DIR && $FIND . -type f | $SORT > $WORK_DIR/other_files)
       
   770     (cd $THIS_DIR && $FIND . -type f | $SORT > $WORK_DIR/this_files)
       
   771     
       
   772     echo -n File names...
       
   773     if diff $WORK_DIR/other_files $WORK_DIR/this_files > /dev/null; then
       
   774         echo Identical!
       
   775     else
       
   776         echo Differences found.
       
   777         REGRESSIONS=true
       
   778     # Differences in directories found.
       
   779         ONLY_OTHER=$(diff $WORK_DIR/other_files $WORK_DIR/this_files | $GREP '<')
       
   780         if [ "$ONLY_OTHER" ]; then
       
   781             echo Only in $OTHER
       
   782             echo "$ONLY_OTHER" | sed 's|< ./|    |g'
       
   783         fi
       
   784     # Differences in directories found.
       
   785         ONLY_THIS=$(diff $WORK_DIR/other_files $WORK_DIR/this_files | $GREP '>')
       
   786         if [ "$ONLY_THIS" ]; then
       
   787             echo Only in $THIS
       
   788             echo "$ONLY_THIS" | sed 's|> ./|    |g'
       
   789         fi
       
   790     fi
       
   791 }
       
   792 
       
   793 
       
   794 ##########################################################################################
       
   795 # Compare permissions
       
   796 
       
   797 compare_permissions() {
       
   798     THIS_DIR=$1
       
   799     OTHER_DIR=$2
       
   800     WORK_DIR=$3
       
   801 
       
   802     mkdir -p $WORK_DIR
       
   803 
       
   804     echo -n Permissions...
       
   805     found=""
       
   806     for f in `cd $OTHER_DIR && $FIND . -type f`
       
   807     do
       
   808         if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
       
   809         if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
       
   810         OP=`ls -l ${OTHER_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
       
   811         TP=`ls -l ${THIS_DIR}/$f | awk '{printf("%.10s\n", $1);}'`
       
   812         if [ "$OP" != "$TP" ]
       
   813         then
       
   814 	    if [ -z "$found" ]; then echo ; found="yes"; fi
       
   815 	    $PRINTF "\told: ${OP} new: ${TP}\t$f\n"
       
   816         fi
       
   817     done
       
   818     if [ -z "$found" ]; then 
       
   819         echo "Identical!"
       
   820     else
       
   821         REGRESSIONS=true
       
   822     fi
       
   823 }
       
   824 
       
   825 ##########################################################################################
       
   826 # Compare file command output
       
   827 
       
   828 compare_file_types() {
       
   829     THIS_DIR=$1
       
   830     OTHER_DIR=$2
       
   831     WORK_DIR=$3
       
   832 
       
   833     $MKDIR -p $WORK_DIR
       
   834 
       
   835     echo -n File types...
       
   836     found=""
       
   837     for f in `cd $OTHER_DIR && $FIND . -type f`
       
   838     do
       
   839         if [ ! -f ${OTHER_DIR}/$f ]; then continue; fi
       
   840         if [ ! -f ${THIS_DIR}/$f ]; then continue; fi
       
   841         OF=`cd ${OTHER_DIR} && $FILE $f`
       
   842         TF=`cd ${THIS_DIR} && $FILE $f`
       
   843         if [ "$f" = "./src.zip" ] || [ "$f" = "./jre/lib/JObjC.jar" ] || [ "$f" = "./lib/JObjC.jar" ]
       
   844         then
       
   845 	    if [ "`echo $OF | $GREP -ic zip`" -gt 0 -a "`echo $TF | $GREP -ic zip`" -gt 0 ]
       
   846 	    then
       
   847 	        # the way we produces zip-files make it so that directories are stored in old file
       
   848 	        # but not in new (only files with full-path)
       
   849 	        # this makes file-5.09 report them as different
       
   850 	        continue;
       
   851 	    fi
       
   852         fi
       
   853         
       
   854         if [ "$OF" != "$TF" ]
       
   855         then
       
   856 	    if [ -z "$found" ]; then echo ; found="yes"; fi
       
   857 	    $PRINTF "\tother: ${OF}\n\tthis : ${TF}\n"
       
   858         fi
       
   859     done
       
   860     if [ -z "$found" ]; then 
       
   861         echo "Identical!"
       
   862     else
       
   863         REGRESSIONS=true
       
   864     fi
       
   865 }
       
   866 
       
   867 ##########################################################################################
       
   868 # Compare the rest of the files
       
   869 
       
   870 compare_general_files() {
       
   871     THIS_DIR=$1
       
   872     OTHER_DIR=$2
       
   873     WORK_DIR=$3
       
   874     
       
   875     GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
       
   876         ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
       
   877         ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
       
   878         ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
       
   879         ! -name "*.lib" \
       
   880         | $GREP -v "./bin/"  | $SORT | $FILTER)
       
   881 
       
   882     echo General files...
       
   883     for f in $GENERAL_FILES
       
   884     do
       
   885         if [ -e $OTHER_DIR/$f ]; then
       
   886             DIFF_OUT=$($DIFF $OTHER_DIR/$f $THIS_DIR/$f 2>&1)
       
   887             if [ -n "$DIFF_OUT" ]; then
       
   888                 echo $f
       
   889                 REGRESSIONS=true
       
   890                 if [ "$SHOW_DIFFS" = "true" ]; then
       
   891                     echo "$DIFF_OUT"
       
   892                 fi
       
   893             fi
       
   894         fi
       
   895     done
       
   896 
       
   897 
       
   898 }
       
   899 
       
   900 ##########################################################################################
       
   901 # Compare zip file
       
   902 
       
   903 compare_zip_file() {
       
   904     THIS_DIR=$1
       
   905     OTHER_DIR=$2
       
   906     WORK_DIR=$3
       
   907     ZIP_FILE=$4
       
   908 
       
   909     THIS_ZIP=$THIS_DIR/$ZIP_FILE
       
   910     OTHER_ZIP=$OTHER_DIR/$ZIP_FILE
       
   911 
       
   912     THIS_SUFFIX="${THIS_ZIP##*.}"
       
   913     OTHER_SUFFIX="${OTHER_ZIP##*.}"
       
   914     if [ "$THIS_SUFFIX" != "$OTHER_SUFFIX" ]; then
       
   915         echo The files do not have the same suffix type!
       
   916         return 2
       
   917     fi
       
   918 
       
   919     UNARCHIVE="$UNZIP -q"
       
   920 
       
   921     TYPE="$THIS_SUFFIX"
       
   922 
       
   923     if $CMP $OTHER_ZIP $THIS_ZIP > /dev/null
       
   924     then
       
   925         return 0
       
   926     fi
       
   927     # Not quite identical, the might still contain the same data.
       
   928     # Unpack the jar/zip files in temp dirs
       
   929     
       
   930     THIS_UNZIPDIR=$WORK_DIR/$ZIP_FILE.this
       
   931     OTHER_UNZIPDIR=$WORK_DIR/$ZIP_FILE.other
       
   932     $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
       
   933     $MKDIR -p $THIS_UNZIPDIR
       
   934     $MKDIR -p $OTHER_UNZIPDIR
       
   935     (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
       
   936     (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
       
   937 
       
   938     CONTENTS_DIFF_FILE=$WORK_DIR/$ZIP_FILE.diff
       
   939     LANG=C $DIFF -rq $OTHER_UNZIPDIR $THIS_UNZIPDIR > $CONTENTS_DIFF_FILE
       
   940 
       
   941     ONLY_OTHER=$($GREP "^Only in $OTHER_UNZIPDIR" $CONTENTS_DIFF_FILE)
       
   942     ONLY_THIS=$($GREP "^Only in $THIS_UNZIPDIR" $CONTENTS_DIFF_FILE)
       
   943 
       
   944     return_value=0
       
   945 
       
   946     if [ -n "$ONLY_OTHER" ]; then
       
   947         echo "        Only OTHER $ZIP_FILE contains:"
       
   948         echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR|            |"g | sed 's|: |/|g'
       
   949         return_value=1
       
   950     fi
       
   951 
       
   952     if [ -n "$ONLY_THIS" ]; then
       
   953         echo "        Only THIS $ZIP_FILE contains:"
       
   954         echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR|            |"g | sed 's|: |/|g'
       
   955         return_value=1
       
   956     fi
       
   957 
       
   958     DIFFING_FILES=$($GREP differ $CONTENTS_DIFF_FILE | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
       
   959 
       
   960     $RM -f $WORK_DIR/$ZIP_FILE.diffs
       
   961     for file in $DIFFING_FILES; do
       
   962 	if [[ "$ACCEPTED_JARZIP_CONTENTS" != *"$file"* ]]; then
       
   963             diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
       
   964 	fi
       
   965     done
       
   966 
       
   967     if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
       
   968         return_value=1
       
   969         echo "        Differing files in $ZIP_FILE"
       
   970         $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP differ | cut -f 2 -d ' ' | \
       
   971             $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
       
   972         $CAT $WORK_DIR/$ZIP_FILE.difflist
       
   973 
       
   974         if [ -n "$SHOW_DIFFS" ]; then
       
   975             for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
       
   976                 if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
       
   977                     LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
       
   978                 elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
       
   979                     LANG=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
       
   980                 else
       
   981                     LANG=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
       
   982                 fi
       
   983             done
       
   984         fi
       
   985     fi
       
   986 
       
   987     return $return_value
       
   988 }
       
   989 
       
   990 
       
   991 ##########################################################################################
       
   992 # Compare all zip files
       
   993 
       
   994 compare_all_zip_files() {
       
   995     THIS_DIR=$1
       
   996     OTHER_DIR=$2
       
   997     WORK_DIR=$3
       
   998 
       
   999     ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" | $SORT | $FILTER )
       
  1000 
       
  1001     if [ -n "$ZIPS" ]; then
       
  1002         echo Zip files...
       
  1003 
       
  1004         return_value=0
       
  1005         for f in $ZIPS; do
       
  1006             if [ -f "$OTHER_DIR/$f" ]; then
       
  1007                 compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
       
  1008                 if [ "$?" != "0" ]; then
       
  1009                     return_value=1
       
  1010                     REGRESSIONS=true
       
  1011                 fi
       
  1012             fi
       
  1013         done
       
  1014     fi
       
  1015 
       
  1016     return $return_value
       
  1017 }
       
  1018 
       
  1019 ##########################################################################################
       
  1020 # Compare all jar files
       
  1021 
       
  1022 compare_all_jar_files() {
       
  1023     THIS_DIR=$1
       
  1024     OTHER_DIR=$2
       
  1025     WORK_DIR=$3
       
  1026 
       
  1027     # TODO filter?
       
  1028     ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" | $SORT | $FILTER)
       
  1029 
       
  1030     if [ -n "$ZIPS" ]; then
       
  1031         echo Jar files...
       
  1032 
       
  1033         return_value=0
       
  1034         for f in $ZIPS; do
       
  1035             if [ -f "$OTHER_DIR/$f" ]; then
       
  1036                 compare_zip_file $THIS_DIR $OTHER_DIR $WORK_DIR $f
       
  1037                 if [ "$?" != "0" ]; then
       
  1038                     return_value=1
       
  1039                     REGRESSIONS=true
       
  1040                 fi
       
  1041             fi
       
  1042         done
       
  1043     fi
       
  1044 
       
  1045     return $return_value
       
  1046 }
       
  1047 
       
  1048 ##########################################################################################
       
  1049 # Compare binary (executable/library) file
       
  1050 
       
  1051 compare_bin_file() {
       
  1052     THIS_DIR=$1
       
  1053     OTHER_DIR=$2
       
  1054     WORK_DIR=$3
       
  1055     BIN_FILE=$4
       
  1056 
       
  1057     THIS_FILE=$THIS_DIR/$BIN_FILE
       
  1058     OTHER_FILE=$OTHER_DIR/$BIN_FILE
       
  1059     NAME=$(basename $BIN_FILE)
       
  1060     WORK_FILE_BASE=$WORK_DIR/$BIN_FILE
       
  1061     FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
       
  1062 
       
  1063     $MKDIR -p $FILE_WORK_DIR
       
  1064 
       
  1065     ORIG_THIS_FILE="$THIS_FILE"
       
  1066     ORIG_OTHER_FILE="$OTHER_FILE"
       
  1067 
       
  1068     if [[ "$STRIP_BEFORE_COMPARE" = *"$BIN_FILE"* ]]; then
       
  1069         THIS_STRIPPED_FILE=$FILE_WORK_DIR/this/$NAME
       
  1070         OTHER_STRIPPED_FILE=$FILE_WORK_DIR/other/$NAME
       
  1071         $MKDIR -p $FILE_WORK_DIR/this $FILE_WORK_DIR/other
       
  1072         $CP $THIS_FILE $THIS_STRIPPED_FILE
       
  1073         $CP $OTHER_FILE $OTHER_STRIPPED_FILE
       
  1074         $STRIP $THIS_STRIPPED_FILE
       
  1075         $STRIP $OTHER_STRIPPED_FILE
       
  1076         THIS_FILE="$THIS_STRIPPED_FILE"
       
  1077         OTHER_FILE="$OTHER_STRIPPED_FILE"
       
  1078     fi
       
  1079 
       
  1080     if [ -z "$SKIP_BIN_DIFF" ]; then
       
  1081         if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
       
  1082         # The files were bytewise identical.
       
  1083             if [ -n "$VERBOSE" ]; then
       
  1084                 echo "        :           :         :         :          : $BIN_FILE"
       
  1085             fi
       
  1086             return 0
       
  1087         fi
       
  1088         BIN_MSG=" diff "
       
  1089         if [[ "$ACCEPTED_BIN_DIFF" != *"$BIN_FILE"* ]]; then
       
  1090             DIFF_BIN=true
       
  1091             if [[ "$KNOWN_BIN_DIFF" != *"$BIN_FILE"* ]]; then
       
  1092                 BIN_MSG="*$BIN_MSG*"
       
  1093                 REGRESSIONS=true
       
  1094             else
       
  1095                 BIN_MSG=" $BIN_MSG "
       
  1096             fi
       
  1097         else
       
  1098             BIN_MSG="($BIN_MSG)"
       
  1099             DIFF_BIN=
       
  1100         fi
       
  1101     fi
       
  1102 
       
  1103     THIS_SIZE=$(ls -l "$THIS_FILE" | awk '{ print $5 }')
       
  1104     OTHER_SIZE=$(ls -l "$OTHER_FILE" | awk '{ print $5 }')
       
  1105     if [ $THIS_SIZE -ne $OTHER_SIZE ]; then
       
  1106         DIFF_SIZE_NUM=$($EXPR $THIS_SIZE - $OTHER_SIZE)
       
  1107         DIFF_SIZE_REL=$($EXPR $THIS_SIZE \* 100 / $OTHER_SIZE)
       
  1108         SIZE_MSG=$($PRINTF "%3d%% %4d" $DIFF_SIZE_REL $DIFF_SIZE_NUM)
       
  1109         if [[ "$ACCEPTED_SMALL_SIZE_DIFF" = *"$BIN_FILE"* ]] && [ "$DIFF_SIZE_REL" -gt 98 ] && [ "$DIFF_SIZE_REL" -lt 102 ]; then
       
  1110             SIZE_MSG="($SIZE_MSG)"
       
  1111             DIFF_SIZE=
       
  1112         else
       
  1113             if [[ "$ACCEPTED_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
       
  1114                 DIFF_SIZE=true
       
  1115                 if [[ "$KNOWN_SIZE_DIFF" != *"$BIN_FILE"* ]]; then
       
  1116                     SIZE_MSG="*$SIZE_MSG*"
       
  1117                     REGRESSIONS=true
       
  1118                 else
       
  1119                     SIZE_MSG=" $SIZE_MSG "
       
  1120                 fi
       
  1121             else
       
  1122                 SIZE_MSG="($SIZE_MSG)"
       
  1123                 DIFF_SIZE=
       
  1124             fi
       
  1125         fi
       
  1126     else
       
  1127         SIZE_MSG="           "
       
  1128         DIFF_SIZE=
       
  1129         if [[ "$KNOWN_SIZE_DIFF $ACCEPTED_SIZE_DIFF" = *"$BIN_FILE"* ]]; then
       
  1130             SIZE_MSG="     !     "
       
  1131         fi
       
  1132     fi
       
  1133 
       
  1134     if [[ "$SORT_SYMBOLS" = *"$BIN_FILE"* ]]; then
       
  1135         SYM_SORT_CMD="sort"
       
  1136     else
       
  1137         SYM_SORT_CMD="cat"
       
  1138     fi
       
  1139 
       
  1140     # Check symbols
       
  1141     if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
       
  1142 	$DUMPBIN -exports $OTHER_FILE | $GREP " = " | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
       
  1143 	$DUMPBIN -exports $THIS_FILE  | $GREP " = " | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
       
  1144     elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
       
  1145         # Some symbols get seemingly random 15 character prefixes. Filter them out.
       
  1146         $NM -a $ORIG_OTHER_FILE | $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
       
  1147 	$NM -a $ORIG_THIS_FILE  | $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
       
  1148     else
       
  1149 	$NM -a $ORIG_OTHER_FILE | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.other
       
  1150 	$NM -a $ORIG_THIS_FILE  | $GREP -v $NAME | $AWK '{print $2, $3, $4, $5}' | $SYM_SORT_CMD > $WORK_FILE_BASE.symbols.this
       
  1151     fi
       
  1152     
       
  1153     LANG=C $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
       
  1154     if [ -s $WORK_FILE_BASE.symbols.diff ]; then
       
  1155         SYM_MSG=" diff  "
       
  1156         if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
       
  1157             DIFF_SYM=true
       
  1158             if [[ "$KNOWN_SYM_DIFF" != *"$BIN_FILE"* ]]; then
       
  1159                 SYM_MSG="*$SYM_MSG*"
       
  1160                 REGRESSIONS=true
       
  1161             else
       
  1162                 SYM_MSG=" $SYM_MSG "
       
  1163             fi
       
  1164         else
       
  1165             SYM_MSG="($SYM_MSG)"            
       
  1166             DIFF_SYM=
       
  1167         fi
       
  1168     else
       
  1169         SYM_MSG="         "
       
  1170         DIFF_SYM=
       
  1171         if [[ "$KNOWN_SYM_DIFF $ACCEPTED_SYM_DIFF" = *"$BIN_FILE"* ]]; then
       
  1172             SYM_MSG="    !    "
       
  1173         fi
       
  1174     fi
       
  1175 
       
  1176     # Check dependencies
       
  1177     if [ -n "$LDD_CMD" ];then
       
  1178 	(cd $FILE_WORK_DIR && $CP $OTHER_FILE . && $LDD_CMD $NAME | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.other | $UNIQ > $WORK_FILE_BASE.deps.other.uniq)
       
  1179 	(cd $FILE_WORK_DIR && $CP $THIS_FILE . && $LDD_CMD $NAME | $AWK '{ print $1;}' | $SORT | $TEE $WORK_FILE_BASE.deps.this | $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
       
  1180 	(cd $FILE_WORK_DIR && $RM -f $NAME)
       
  1181 	
       
  1182 	LANG=C $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this > $WORK_FILE_BASE.deps.diff
       
  1183 	LANG=C $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq > $WORK_FILE_BASE.deps.diff.uniq
       
  1184 	
       
  1185 	if [ -s $WORK_FILE_BASE.deps.diff ]; then
       
  1186             if [ -s $WORK_FILE_BASE.deps.diff.uniq ]; then
       
  1187 		DEP_MSG=" diff  "
       
  1188             else
       
  1189 		DEP_MSG=" redun "
       
  1190             fi
       
  1191             if [[ "$ACCEPTED_DEP_DIFF" != *"$BIN_FILE"* ]]; then
       
  1192 		DIFF_DEP=true
       
  1193 		if [[ "$KNOWN_DEP_DIFF" != *"$BIN_FILE"* ]]; then
       
  1194                     DEP_MSG="*$DEP_MSG*"
       
  1195                     REGRESSIONS=true
       
  1196 		else
       
  1197                     DEP_MSG=" $DEP_MSG "
       
  1198 		fi
       
  1199             else
       
  1200 		DEP_MSG="($DEP_MSG)"
       
  1201 		DIFF_DEP=
       
  1202             fi
       
  1203 	else
       
  1204 	    DEP_MSG="         "
       
  1205 	    DIFF_DEP=
       
  1206             if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
       
  1207                 DEP_MSG="     !      "
       
  1208             fi
       
  1209 	fi
       
  1210     fi
       
  1211     
       
  1212     # Compare readelf output
       
  1213     if [ -n "$READELF_CMD" ] && [ -z "$SKIP_ELF_DIFF" ]; then
       
  1214         $READELF_CMD $OTHER_FILE > $WORK_FILE_BASE.readelf.other 2>&1
       
  1215         $READELF_CMD $THIS_FILE > $WORK_FILE_BASE.readelf.this 2>&1
       
  1216         
       
  1217         LANG=C $DIFF $WORK_FILE_BASE.readelf.other $WORK_FILE_BASE.readelf.this > $WORK_FILE_BASE.readelf.diff
       
  1218         
       
  1219         if [ -s $WORK_FILE_BASE.readelf.diff ]; then
       
  1220             ELF_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.readelf.diff | awk '{print $5}')
       
  1221             ELF_MSG=$($PRINTF "%8d" $ELF_DIFF_SIZE)
       
  1222             if [[ "$ACCEPTED_ELF_DIFF" != *"$BIN_FILE"* ]]; then
       
  1223                 DIFF_ELF=true
       
  1224                 if [[ "$KNOWN_ELF_DIFF" != *"$BIN_FILE"* ]]; then
       
  1225                     ELF_MSG="*$ELF_MSG*"
       
  1226                     REGRESSIONS=true
       
  1227                 else
       
  1228                     ELF_MSG=" $ELF_MSG "
       
  1229                 fi
       
  1230             else
       
  1231                 ELF_MSG="($ELF_MSG)"
       
  1232                 DIFF_ELF=
       
  1233             fi
       
  1234         else
       
  1235             ELF_MSG="          "
       
  1236             DIFF_ELF=
       
  1237             if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
       
  1238                 ELF_MSG="    !    "
       
  1239             fi
       
  1240         fi
       
  1241     fi
       
  1242 
       
  1243     # Compare disassemble output
       
  1244     if [ -f "$OBJDUMP" ] && [ -z "$SKIP_DIS_DIFF" ]; then
       
  1245         $OBJDUMP -d $OTHER_FILE | $GREP -v $NAME > $WORK_FILE_BASE.dis.other 2>&1
       
  1246         $OBJDUMP -d $THIS_FILE  | $GREP -v $NAME > $WORK_FILE_BASE.dis.this  2>&1
       
  1247         
       
  1248         LANG=C $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
       
  1249         
       
  1250         if [ -s $WORK_FILE_BASE.dis.diff ]; then
       
  1251             DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
       
  1252             DIS_MSG=$($PRINTF "%8d" $DIS_DIFF_SIZE)
       
  1253             if [[ "$ACCEPTED_DIS_DIFF" != *"$BIN_FILE"* ]]; then
       
  1254                 DIFF_DIS=true
       
  1255                 if [[ "$KNOWN_DIS_DIFF" != *"$BIN_FILE"* ]]; then
       
  1256                     DIS_MSG="*$DIS_MSG*"
       
  1257                     REGRESSIONS=true
       
  1258                 else
       
  1259                     DIS_MSG=" $DIS_MSG "
       
  1260                 fi
       
  1261             else
       
  1262                 DIS_MSG="($DIS_MSG)"
       
  1263                 DIFF_DIS=
       
  1264             fi
       
  1265         else
       
  1266             DIS_MSG="          "
       
  1267             DIFF_DIS=
       
  1268             if [[ "$KNOWN_DEP_DIFF $ACCEPTED_DEP_DIFF" = *"$BIN_FILE"* ]]; then
       
  1269                 DIS_MSG="    !    "
       
  1270             fi
       
  1271         fi
       
  1272     fi
       
  1273 
       
  1274 
       
  1275     if [ -n "$DIFF_BIN$DIFF_SIZE$DIFF_SYM$DIFF_DEP$DIFF_ELF$DIFF_DIS" ] || [ -n "$VERBOSE" ]; then
       
  1276         if [ -n "$BIN_MSG" ]; then echo -n "$BIN_MSG:"; fi
       
  1277         if [ -n "$SIZE_MSG" ]; then echo -n "$SIZE_MSG:"; fi
       
  1278         if [ -n "$SYM_MSG" ]; then echo -n "$SYM_MSG:"; fi
       
  1279         if [ -n "$DEP_MSG" ]; then echo -n "$DEP_MSG:"; fi
       
  1280         if [ -n "$ELF_MSG" ]; then echo -n "$ELF_MSG:"; fi
       
  1281         if [ -n "$DIS_MSG" ]; then echo -n "$DIS_MSG:"; fi
       
  1282         echo " $BIN_FILE"
       
  1283         if [ "$SHOW_DIFFS" = "true" ]; then
       
  1284             if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then
       
  1285                 echo "Symbols diff:"
       
  1286                 $CAT $WORK_FILE_BASE.symbols.diff
       
  1287             fi
       
  1288             if [ -s "$WORK_FILE_BASE.deps.diff" ]; then
       
  1289                 echo "Deps diff:"
       
  1290                 $CAT $WORK_FILE_BASE.deps.diff
       
  1291             fi
       
  1292             if [ -s "$WORK_FILE_BASE.readelf.diff" ]; then
       
  1293                 echo "Readelf diff:"
       
  1294                 $CAT $WORK_FILE_BASE.readelf.diff
       
  1295             fi
       
  1296             if [ -s "$WORK_FILE_BASE.dis.diff" ]; then
       
  1297                 echo "Disassembly diff:"
       
  1298                 $CAT $WORK_FILE_BASE.dis.diff
       
  1299             fi
       
  1300         fi
       
  1301         return 1
       
  1302     fi
       
  1303     return 0
       
  1304 }
       
  1305 
       
  1306 ##########################################################################################
       
  1307 # Print binary diff header
       
  1308 
       
  1309 print_binary_diff_header() {
       
  1310     if [ -z "$SKIP_BIN_DIFF" ]; then echo -n " Binary :"; fi
       
  1311     if [ -z "$SKIP_SIZE_DIFF" ]; then echo -n "   Size    :"; fi
       
  1312     if [ -z "$SKIP_SYM_DIFF" ]; then echo -n " Symbols :"; fi
       
  1313     if [ -z "$SKIP_DEP_DIFF" ]; then echo -n "  Deps   :"; fi
       
  1314     if [ -z "$SKIP_ELF_DIFF" ]; then echo -n " Readelf  :"; fi
       
  1315     if [ -z "$SKIP_DIS_DIFF" ]; then echo -n " Disass   :"; fi
       
  1316     echo
       
  1317 }
       
  1318 
       
  1319 ##########################################################################################
       
  1320 # Compare all libraries
       
  1321 
       
  1322 compare_all_libs() {
       
  1323     THIS_DIR=$1
       
  1324     OTHER_DIR=$2
       
  1325     WORK_DIR=$3
       
  1326 
       
  1327     LIBS=$(cd $THIS_DIR && $FIND . -name 'lib*.so' -o -name '*.dylib' -o -name '*.dll' | $SORT | $FILTER)
       
  1328 
       
  1329     if [ -n "$LIBS" ]; then
       
  1330         echo Libraries...
       
  1331         print_binary_diff_header
       
  1332         for l in $LIBS; do
       
  1333             if [ -f "$OTHER_DIR/$l" ]; then
       
  1334                 compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $l
       
  1335                 if [ "$?" != "0" ]; then
       
  1336                     return_value=1
       
  1337                 fi
       
  1338             fi
       
  1339         done
       
  1340     fi
       
  1341 
       
  1342     return $return_value
       
  1343 }
       
  1344 
       
  1345 ##########################################################################################
       
  1346 # Compare all executables
       
  1347 
       
  1348 compare_all_execs() {
       
  1349     THIS_DIR=$1
       
  1350     OTHER_DIR=$2
       
  1351     WORK_DIR=$3
       
  1352 
       
  1353     if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
       
  1354         EXECS=$(cd $THIS_DIR && $FIND . -type f -name '*.exe' | $SORT | $FILTER)
       
  1355     else
       
  1356         EXECS=$(cd $THIS_DIR && $FIND . -name db -prune -o -type f -perm -100 \! \( -name '*.so' -o -name '*.dylib' -o -name '*.dll' -o -name '*.cgi' \) | $SORT | $FILTER)
       
  1357     fi
       
  1358 
       
  1359     if [ -n "$EXECS" ]; then
       
  1360         echo Executables...
       
  1361         print_binary_diff_header
       
  1362         for e in $EXECS; do
       
  1363             if [ -f "$OTHER_DIR/$e" ]; then
       
  1364                 compare_bin_file $THIS_DIR $OTHER_DIR $WORK_DIR $e
       
  1365                 if [ "$?" != "0" ]; then
       
  1366                     return_value=1
       
  1367                 fi
       
  1368             fi
       
  1369         done
       
  1370     fi
       
  1371 
       
  1372     return $return_value
       
  1373 }
       
  1374 
       
  1375 ##########################################################################################
       
  1376 # Initiate configuration
       
  1377 
       
  1378 COMPARE_ROOT=/tmp/cimages.$USER
       
  1379 $MKDIR -p $COMPARE_ROOT
       
  1380 if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
       
  1381     if [ "$(uname -o)" = "Cygwin" ]; then
       
  1382 	COMPARE_ROOT=$(cygpath -msa $COMPARE_ROOT)
       
  1383     fi
       
  1384 fi
       
  1385 
       
  1386 THIS="$( cd "$( dirname "$0" )" && pwd )"
       
  1387 echo "$THIS"
       
  1388 THIS_SCRIPT="$0"
       
  1389 
       
  1390 if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
       
  1391     echo "bash ./compare.sh [OPTIONS] [FILTER]"
       
  1392     echo ""
       
  1393     echo "-all                Compare all files in all known ways"
       
  1394     echo "-names              Compare the file names and directory structure"
       
  1395     echo "-perms              Compare the permission bits on all files and directories"
       
  1396     echo "-types              Compare the output of the file command on all files"
       
  1397     echo "-general            Compare the files not convered by the specialized comparisons"
       
  1398     echo "-zips               Compare the contents of all zip files"
       
  1399     echo "-jars               Compare the contents of all jar files"
       
  1400     echo "-libs               Compare all native libraries"
       
  1401     echo "-execs              Compare all executables"
       
  1402     echo "-v                  Verbose output, does not hide known differences"
       
  1403     echo "-vv                 More verbose output, shows diff output of all comparisons"
       
  1404     echo "-o [OTHER]          Compare with build in other directory. Will default to the old build directory"
       
  1405     echo ""
       
  1406     echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
       
  1407     echo "Example:"
       
  1408     echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
       
  1409     exit 10
       
  1410 fi
       
  1411 
       
  1412 CMP_NAMES=false
       
  1413 CMP_PERMS=false
       
  1414 CMP_TYPES=false
       
  1415 CMP_GENERAL=false
       
  1416 CMP_ZIPS=false
       
  1417 CMP_JARS=false
       
  1418 CMP_LIBS=false
       
  1419 CMP_EXECS=false
       
  1420 
       
  1421 while [ -n "$1" ]; do
       
  1422     case "$1" in
       
  1423         -v)
       
  1424             VERBOSE=true
       
  1425             ;;
       
  1426         -vv)
       
  1427             VERBOSE=true
       
  1428             SHOW_DIFFS=true
       
  1429             ;;
       
  1430         -o)
       
  1431             OTHER=$2
       
  1432             shift
       
  1433             ;;
       
  1434         -all)
       
  1435             CMP_NAMES=true
       
  1436             if [ "$OPENJDK_TARGET_OS" != "windows" ]; then
       
  1437                 CMP_PERMS=true
       
  1438             fi
       
  1439             CMP_TYPES=true
       
  1440             CMP_GENERAL=true
       
  1441             CMP_ZIPS=true
       
  1442             CMP_JARS=true
       
  1443             CMP_LIBS=true
       
  1444             CMP_EXECS=true
       
  1445             ;;
       
  1446         -names)
       
  1447             CMP_NAMES=true
       
  1448             ;;
       
  1449         -perms)
       
  1450             CMP_PERMS=true
       
  1451             ;;
       
  1452         -types)
       
  1453             CMP_TYPES=true
       
  1454             ;;
       
  1455         -general)
       
  1456             CMP_GENERAL=true
       
  1457             ;;
       
  1458         -zips)
       
  1459             CMP_ZIPS=true
       
  1460             ;;
       
  1461         -jars)
       
  1462             CMP_JARS=true
       
  1463             ;;
       
  1464         -libs)
       
  1465             CMP_LIBS=true
       
  1466             ;;
       
  1467         -execs)
       
  1468             CMP_EXECS=true
       
  1469             ;;
       
  1470         *)
       
  1471             CMP_NAMES=false
       
  1472             CMP_PERMS=false
       
  1473             CMP_TYPES=false
       
  1474             CMP_ZIPS=true
       
  1475             CMP_JARS=true
       
  1476             CMP_LIBS=true
       
  1477             CMP_EXECS=true
       
  1478             
       
  1479             if [ -z "$FILTER" ]; then
       
  1480                 FILTER="$GREP"
       
  1481             fi
       
  1482             FILTER="$FILTER -e $1"
       
  1483             ;;
       
  1484     esac
       
  1485     shift
       
  1486 done
       
  1487 
       
  1488 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
       
  1489     CMP_NAMES=true
       
  1490     CMP_PERMS=true
       
  1491     CMP_TYPES=true
       
  1492     CMP_GENERAL=true
       
  1493     CMP_ZIPS=true
       
  1494     CMP_JARS=true
       
  1495     CMP_LIBS=true
       
  1496     CMP_EXECS=true
       
  1497 fi
       
  1498 
       
  1499 if [ -z "$FILTER" ]; then
       
  1500     FILTER="$CAT"
       
  1501 fi
       
  1502 
       
  1503 if [ -z "$OTHER" ]; then
       
  1504     OTHER="$THIS/../$LEGACY_BUILD_DIR"
       
  1505     if [ -d "$OTHER" ]; then
       
  1506         OTHER="$( cd "$OTHER" && pwd )"
       
  1507     else
       
  1508         echo "Default old build directory does not exist:"
       
  1509         echo "$OTHER"
       
  1510     fi
       
  1511     echo "Comparing to default old build:"
       
  1512     echo "$OTHER"
       
  1513     echo
       
  1514 else
       
  1515     echo "Comparing to:"
       
  1516     echo "$OTHER"
       
  1517     echo
       
  1518 fi
       
  1519 
       
  1520 if [ ! -d "$OTHER" ]; then
       
  1521     echo "Other build directory does not exist:"
       
  1522     echo "$OTHER"
       
  1523     exit 1;
       
  1524 fi
       
  1525 
       
  1526 # Figure out the layout of the new build. Which kinds of images have been produced
       
  1527 if [ -d "$THIS/images/j2sdk-image" ]; then
       
  1528     THIS_J2SDK="$THIS/images/j2sdk-image"
       
  1529     THIS_J2RE="$THIS/images/j2re-image"
       
  1530 fi
       
  1531 if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
       
  1532     THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
       
  1533     THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
       
  1534 fi
       
  1535 
       
  1536 # Figure out the layout of the other build (old or new, normal or overlay image)
       
  1537 if [ -d "$OTHER/j2sdk-image" ]; then
       
  1538     if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
       
  1539         OTHER_J2SDK="$OTHER/j2sdk-image"
       
  1540         OTHER_J2RE="$OTHER/j2re-image"
       
  1541     else
       
  1542         OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
       
  1543         OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
       
  1544     fi
       
  1545 
       
  1546 fi
       
  1547 
       
  1548 if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
       
  1549     echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
       
  1550     exit 1
       
  1551 fi
       
  1552 
       
  1553 
       
  1554 ##########################################################################################
       
  1555 # Do the work
       
  1556 
       
  1557 if [ "$CMP_NAMES" = "true" ]; then
       
  1558     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1559         echo -n "J2SDK "
       
  1560         compare_dirs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1561         echo -n "J2RE  "
       
  1562         compare_dirs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
       
  1563         
       
  1564         echo -n "J2SDK "
       
  1565         compare_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1566         echo -n "J2RE  "
       
  1567         compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
       
  1568     fi
       
  1569     if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
       
  1570         echo -n "J2SDK Overlay "
       
  1571         compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1572         echo -n "J2RE  Overlay "
       
  1573         compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
       
  1574         
       
  1575         echo -n "J2SDK Overlay "
       
  1576         compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1577         echo -n "J2RE  Overlay "
       
  1578         compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
       
  1579     fi
       
  1580 fi
       
  1581 
       
  1582 if [ "$CMP_PERMS" = "true" ]; then
       
  1583     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1584         echo -n "J2SDK "
       
  1585         compare_permissions $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1586         echo -n "J2RE  "
       
  1587         compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
       
  1588     fi
       
  1589     if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
       
  1590         echo -n "J2SDK Overlay "
       
  1591         compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1592         echo -n "J2RE  Overlay "
       
  1593         compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
       
  1594     fi
       
  1595 fi
       
  1596 
       
  1597 if [ "$CMP_TYPES" = "true" ]; then
       
  1598     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1599         echo -n "J2SDK "
       
  1600         compare_file_types $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1601         echo -n "J2RE  "
       
  1602         compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
       
  1603     fi
       
  1604     if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
       
  1605         echo -n "J2SDK Overlay "
       
  1606         compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1607         echo -n "J2RE  Overlay "
       
  1608         compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
       
  1609     fi
       
  1610 fi
       
  1611 
       
  1612 if [ "$CMP_GENERAL" = "true" ]; then
       
  1613     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1614         echo -n "J2SDK "
       
  1615         compare_general_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1616         echo -n "J2RE  "
       
  1617         compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
       
  1618     fi
       
  1619     if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
       
  1620         echo -n "J2SDK Overlay "
       
  1621         compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1622         echo -n "J2RE  Overlay "
       
  1623         compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
       
  1624     fi
       
  1625 fi
       
  1626 
       
  1627 if [ "$CMP_ZIPS" = "true" ]; then
       
  1628     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1629         compare_all_zip_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1630     fi
       
  1631 fi
       
  1632 
       
  1633 if [ "$CMP_JARS" = "true" ]; then
       
  1634     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1635         compare_all_jar_files $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1636     fi
       
  1637 fi
       
  1638 
       
  1639 if [ "$CMP_LIBS" = "true" ]; then
       
  1640     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1641         compare_all_libs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1642     fi
       
  1643     if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
       
  1644         echo -n "Overlay "
       
  1645         compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1646     fi
       
  1647 fi
       
  1648 
       
  1649 if [ "$CMP_EXECS" = "true" ]; then
       
  1650     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
       
  1651         compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
       
  1652     fi
       
  1653     if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
       
  1654         echo -n "Overlay "
       
  1655         compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
       
  1656     fi
       
  1657 fi
       
  1658 
       
  1659 echo
       
  1660 
       
  1661 if [ -n "$REGRESSIONS" ]; then
       
  1662     echo "REGRESSIONS FOUND!"
       
  1663     echo
       
  1664     exit 1
       
  1665 else
       
  1666     echo "No regressions found"
       
  1667     echo
       
  1668     exit 0
       
  1669 fi