< prev index next >

common/bin/compare.sh

Print this page




 492         echo "        Only OTHER $ZIP_FILE contains:"
 493         echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR|            |"g | sed 's|: |/|g'
 494         return_value=1
 495     fi
 496 
 497     if [ -n "$ONLY_THIS" ]; then
 498         echo "        Only THIS $ZIP_FILE contains:"
 499         echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR|            |"g | sed 's|: |/|g'
 500         return_value=1
 501     fi
 502 
 503     if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
 504         DIFFING_FILES=$($GREP -e 'differ$' -e '^diff ' $CONTENTS_DIFF_FILE \
 505             | $SED -e 's/^Files //g' -e 's/diff -r //g' | $CUT -f 1 -d ' ' \
 506             | $SED "s|$OTHER_UNZIPDIR/||g")
 507     else
 508         DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
 509             | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
 510     fi
 511 

 512     $RM -f $WORK_DIR/$ZIP_FILE.diffs
 513     for file in $DIFFING_FILES; do
 514         if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
 515             diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
 516         fi
 517     done
 518 
 519     if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
 520         return_value=1
 521         echo "        Differing files in $ZIP_FILE"
 522         $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP 'differ$' | cut -f 2 -d ' ' | \
 523             $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
 524         $CAT $WORK_DIR/$ZIP_FILE.difflist
 525 
 526         if [ -n "$SHOW_DIFFS" ]; then
 527             for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
 528                 if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
 529                     LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
 530                 elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
 531                     LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
 532                 else
 533                     LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
 534                 fi
 535             done
 536         fi
 537     fi

 538 
 539     return $return_value
 540 }
 541 
 542 
 543 ################################################################################
 544 # Compare all zip files
 545 
 546 compare_all_zip_files() {
 547     THIS_DIR=$1
 548     OTHER_DIR=$2
 549     WORK_DIR=$3
 550 
 551     ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" -o -name "*.tar.gz" \
 552         | $SORT | $FILTER )
 553 
 554     if [ -n "$ZIPS" ]; then
 555         echo Zip/tar.gz files...
 556 
 557         return_value=0


1055     fi
1056 
1057     return $return_value
1058 }
1059 
1060 ################################################################################
1061 # Initiate configuration
1062 
1063 THIS="$SCRIPT_DIR"
1064 echo "$THIS"
1065 THIS_SCRIPT="$0"
1066 
1067 if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
1068     echo "bash ./compare.sh [OPTIONS] [FILTER]"
1069     echo ""
1070     echo "-all                Compare all files in all known ways"
1071     echo "-names              Compare the file names and directory structure"
1072     echo "-perms              Compare the permission bits on all files and directories"
1073     echo "-types              Compare the output of the file command on all files"
1074     echo "-general            Compare the files not convered by the specialized comparisons"
1075     echo "-zips               Compare the contents of all zip files"

1076     echo "-jars               Compare the contents of all jar files"
1077     echo "-libs               Compare all native libraries"
1078     echo "-execs              Compare all executables"
1079     echo "-v                  Verbose output, does not hide known differences"
1080     echo "-vv                 More verbose output, shows diff output of all comparisons"
1081     echo "-o [OTHER]          Compare with build in other directory. Will default to the old build directory"
1082     echo ""
1083     echo "--sort-symbols      Sort all symbols before comparing"
1084     echo "--strip             Strip all binaries before comparing"
1085     echo "--clean             Clean all previous comparison results first"
1086     echo ""
1087     echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
1088     echo "Example:"
1089     echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
1090     echo ""
1091     echo "-2zips <file1> <file2> Compare two zip files only"
1092     echo "-2bins <file1> <file2> Compare two binary files only"
1093     echo "-2dirs <dir1> <dir2> Compare two directories as if they were images"
1094     echo ""
1095     exit 10
1096 fi
1097 
1098 CMP_NAMES=false
1099 CMP_PERMS=false
1100 CMP_TYPES=false
1101 CMP_GENERAL=false
1102 CMP_ZIPS=false

1103 CMP_JARS=false
1104 CMP_LIBS=false
1105 CMP_EXECS=false
1106 
1107 while [ -n "$1" ]; do
1108     case "$1" in
1109         -v)
1110             VERBOSE=true
1111             ;;
1112         -vv)
1113             VERBOSE=true
1114             SHOW_DIFFS=true
1115             ;;
1116         -o)
1117             OTHER="$2"
1118             shift
1119             ;;
1120         -all)
1121             CMP_NAMES=true
1122             if [ "$OPENJDK_TARGET_OS" != "windows" ]; then


1126             CMP_GENERAL=true
1127             CMP_ZIPS=true
1128             CMP_JARS=true
1129             CMP_LIBS=true
1130             CMP_EXECS=true
1131             ;;
1132         -names)
1133             CMP_NAMES=true
1134             ;;
1135         -perms)
1136             CMP_PERMS=true
1137             ;;
1138         -types)
1139             CMP_TYPES=true
1140             ;;
1141         -general)
1142             CMP_GENERAL=true
1143             ;;
1144         -zips)
1145             CMP_ZIPS=true





1146             ;;
1147         -jars)
1148             CMP_JARS=true
1149             ;;
1150         -libs)
1151             CMP_LIBS=true
1152             ;;
1153         -execs)
1154             CMP_EXECS=true
1155             ;;
1156         -2dirs)
1157             THIS="$(cd "$2" > /dev/null && pwd )"
1158             OTHER="$(cd "$3" > /dev/null && pwd )"
1159             THIS_BASE_DIR="$THIS"
1160             OTHER_BASE_DIR="$OTHER"
1161             SKIP_DEFAULT=true
1162             shift
1163             shift
1164             ;;
1165         -2zips)




 492         echo "        Only OTHER $ZIP_FILE contains:"
 493         echo "$ONLY_OTHER" | sed "s|Only in $OTHER_UNZIPDIR|            |"g | sed 's|: |/|g'
 494         return_value=1
 495     fi
 496 
 497     if [ -n "$ONLY_THIS" ]; then
 498         echo "        Only THIS $ZIP_FILE contains:"
 499         echo "$ONLY_THIS" | sed "s|Only in $THIS_UNZIPDIR|            |"g | sed 's|: |/|g'
 500         return_value=1
 501     fi
 502 
 503     if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
 504         DIFFING_FILES=$($GREP -e 'differ$' -e '^diff ' $CONTENTS_DIFF_FILE \
 505             | $SED -e 's/^Files //g' -e 's/diff -r //g' | $CUT -f 1 -d ' ' \
 506             | $SED "s|$OTHER_UNZIPDIR/||g")
 507     else
 508         DIFFING_FILES=$($GREP -e "differ$" $CONTENTS_DIFF_FILE \
 509             | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
 510     fi
 511 
 512     if [ "$CMP_ZIPS_CONTENTS" = "true" ]; then
 513         $RM -f $WORK_DIR/$ZIP_FILE.diffs
 514         for file in $DIFFING_FILES; do
 515             if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
 516                 diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
 517             fi
 518         done
 519 
 520         if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
 521             return_value=1
 522             echo "        Differing files in $ZIP_FILE"
 523             $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP 'differ$' | cut -f 2 -d ' ' | \
 524                 $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
 525             $CAT $WORK_DIR/$ZIP_FILE.difflist
 526 
 527             if [ -n "$SHOW_DIFFS" ]; then
 528                 for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
 529                     if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
 530                         LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
 531                     elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
 532                         LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
 533                     else
 534                         LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
 535                     fi
 536                 done
 537             fi
 538         fi
 539     fi
 540 
 541     return $return_value
 542 }
 543 
 544 
 545 ################################################################################
 546 # Compare all zip files
 547 
 548 compare_all_zip_files() {
 549     THIS_DIR=$1
 550     OTHER_DIR=$2
 551     WORK_DIR=$3
 552 
 553     ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.zip" -o -name "*.tar.gz" \
 554         | $SORT | $FILTER )
 555 
 556     if [ -n "$ZIPS" ]; then
 557         echo Zip/tar.gz files...
 558 
 559         return_value=0


1057     fi
1058 
1059     return $return_value
1060 }
1061 
1062 ################################################################################
1063 # Initiate configuration
1064 
1065 THIS="$SCRIPT_DIR"
1066 echo "$THIS"
1067 THIS_SCRIPT="$0"
1068 
1069 if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1" = "/?" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ]; then
1070     echo "bash ./compare.sh [OPTIONS] [FILTER]"
1071     echo ""
1072     echo "-all                Compare all files in all known ways"
1073     echo "-names              Compare the file names and directory structure"
1074     echo "-perms              Compare the permission bits on all files and directories"
1075     echo "-types              Compare the output of the file command on all files"
1076     echo "-general            Compare the files not convered by the specialized comparisons"
1077     echo "-zips               Compare the contents of all zip files and files in them"
1078     echo "-zips-names         Compare the file names inside all zip files"
1079     echo "-jars               Compare the contents of all jar files"
1080     echo "-libs               Compare all native libraries"
1081     echo "-execs              Compare all executables"
1082     echo "-v                  Verbose output, does not hide known differences"
1083     echo "-vv                 More verbose output, shows diff output of all comparisons"
1084     echo "-o [OTHER]          Compare with build in other directory. Will default to the old build directory"
1085     echo ""
1086     echo "--sort-symbols      Sort all symbols before comparing"
1087     echo "--strip             Strip all binaries before comparing"
1088     echo "--clean             Clean all previous comparison results first"
1089     echo ""
1090     echo "[FILTER]            List filenames in the image to compare, works for jars, zips, libs and execs"
1091     echo "Example:"
1092     echo "bash ./common/bin/compareimages.sh CodePointIM.jar"
1093     echo ""
1094     echo "-2zips <file1> <file2> Compare two zip files only"
1095     echo "-2bins <file1> <file2> Compare two binary files only"
1096     echo "-2dirs <dir1> <dir2> Compare two directories as if they were images"
1097     echo ""
1098     exit 10
1099 fi
1100 
1101 CMP_NAMES=false
1102 CMP_PERMS=false
1103 CMP_TYPES=false
1104 CMP_GENERAL=false
1105 CMP_ZIPS=false
1106 CMP_ZIPS_CONTENTS=true
1107 CMP_JARS=false
1108 CMP_LIBS=false
1109 CMP_EXECS=false
1110 
1111 while [ -n "$1" ]; do
1112     case "$1" in
1113         -v)
1114             VERBOSE=true
1115             ;;
1116         -vv)
1117             VERBOSE=true
1118             SHOW_DIFFS=true
1119             ;;
1120         -o)
1121             OTHER="$2"
1122             shift
1123             ;;
1124         -all)
1125             CMP_NAMES=true
1126             if [ "$OPENJDK_TARGET_OS" != "windows" ]; then


1130             CMP_GENERAL=true
1131             CMP_ZIPS=true
1132             CMP_JARS=true
1133             CMP_LIBS=true
1134             CMP_EXECS=true
1135             ;;
1136         -names)
1137             CMP_NAMES=true
1138             ;;
1139         -perms)
1140             CMP_PERMS=true
1141             ;;
1142         -types)
1143             CMP_TYPES=true
1144             ;;
1145         -general)
1146             CMP_GENERAL=true
1147             ;;
1148         -zips)
1149             CMP_ZIPS=true
1150             CMP_ZIPS_CONTENTS=true
1151             ;;
1152         -zips-names)
1153             CMP_ZIPS=true
1154             CMP_ZIPS_CONTENTS=false
1155             ;;
1156         -jars)
1157             CMP_JARS=true
1158             ;;
1159         -libs)
1160             CMP_LIBS=true
1161             ;;
1162         -execs)
1163             CMP_EXECS=true
1164             ;;
1165         -2dirs)
1166             THIS="$(cd "$2" > /dev/null && pwd )"
1167             OTHER="$(cd "$3" > /dev/null && pwd )"
1168             THIS_BASE_DIR="$THIS"
1169             OTHER_BASE_DIR="$OTHER"
1170             SKIP_DEFAULT=true
1171             shift
1172             shift
1173             ;;
1174         -2zips)


< prev index next >