Skip to content

Commit

Permalink
8245032: Remove exceptions from compare.sh
Browse files Browse the repository at this point in the history
Reviewed-by: erikj
  • Loading branch information
magicus committed May 14, 2020
1 parent 014095c commit 43da9ff
Showing 1 changed file with 6 additions and 88 deletions.
94 changes: 6 additions & 88 deletions make/scripts/compare.sh
Expand Up @@ -133,30 +133,8 @@ diff_text() {
SUFFIX="${THIS_FILE##*.}"
NAME="${THIS_FILE##*/}"

TMP=1

if [[ "$THIS_FILE" = *"META-INF/MANIFEST.MF" ]]; then
# Filter out date string, ant version and java version differences.
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>] Ant-Version: Apache Ant .*/d' \
-e '/[<>] Created-By: .* (Oracle [Corpatin)]*/d' \
-e '/[<>] [Corpatin]*)/d' \
-e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d')
fi
if test "x$SUFFIX" = "xjava"; then
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>] \* from.*\.idl/d' \
-e '/[<>] .*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
-e '/[<>] .*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d' \
-e '/[<>] \*.*[0-9]\{4\} \(at \)*[0-9][0-9]*:[0-9]\{2\}:[0-9]\{2\}.*/d' \
-e '/\/\/ Generated from input file.*/d' \
-e '/\/\/ This file was generated AUTOMATICALLY from a template file.*/d' \
-e '/\/\/ java GenerateCharacter.*/d')
fi
# Ignore date strings in class files.
# Anonymous lambda classes get randomly assigned counters in their names.
TMP=$($DIFF $THIS_FILE $OTHER_FILE)

if test "x$SUFFIX" = "xclass"; then
if [ "$NAME" = "SystemModules\$all.class" ] \
|| [ "$NAME" = "SystemModules\$default.class" ]; then
Expand Down Expand Up @@ -184,42 +162,9 @@ diff_text() {
| eval "$MODULES_CLASS_FILTER" > ${THIS_FILE}.javap &
wait
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap)
# To improve performance when large diffs are found, do a rough filtering of classes
# elibeble for these exceptions
elif $GREP -R -e '[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}' \
-e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null
then
$JAVAP -c -constants -l -p "${OTHER_FILE}" > ${OTHER_FILE}.javap &
$JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap &
wait
TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d' \
-e '/[<>].*lambda\$[a-zA-Z0-9]*\$[0-9]*/d')
fi
fi
if test "x$SUFFIX" = "xproperties"; then
# Filter out date string differences.
TMP=$($DIFF $OTHER_FILE $THIS_FILE | \
$GREP '^[<>]' | \
$SED -e '/[<>].*[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}.*/d')
fi
if test "x$SUFFIX" = "xhtml"; then
# Some javadoc versions do not put quotes around font size
HTML_FILTER="$SED \
-e 's/<font size=-1>/<font size=\"-1\">/g'"
$CAT $THIS_FILE | eval "$HTML_FILTER" > $THIS_FILE.filtered
$CAT $OTHER_FILE | eval "$HTML_FILTER" > $OTHER_FILE.filtered
TMP=$($DIFF $OTHER_FILE.filtered $THIS_FILE.filtered | \
$GREP '^[<>]' | \
$SED -e '/[<>] <!-- Generated by javadoc .* on .* -->/d' \
-e '/[<>] <meta name="date" content=".*">/d' )
fi
if test "$NAME" = "BenchmarkList"; then
$SORT $THIS_FILE > $THIS_FILE.sorted
$SORT $OTHER_FILE > $OTHER_FILE.sorted
TMP=$($DIFF $THIS_FILE.sorted $OTHER_FILE.sorted)
fi

if test -n "$TMP"; then
echo Files $OTHER_FILE and $THIS_FILE differ
return 1
Expand Down Expand Up @@ -396,7 +341,7 @@ compare_general_files() {
! -name "*.zip" ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
! -name "modules" ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
! -name "*.cpl" ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
! -name "*.lib" ! -name "*.war" ! -name "*.jmod" ! -name "*.exe" \
! -name "*.lib" ! -name "*.jmod" ! -name "*.exe" \
! -name "*.obj" ! -name "*.o" ! -name "jspawnhelper" ! -name "*.a" \
! -name "*.tar.gz" ! -name "classes.jsa" ! -name "gtestLauncher" \
! -name "*.map" \
Expand All @@ -412,41 +357,14 @@ compare_general_files() {
if [ -e $OTHER_DIR/$f ]; then
SUFFIX="${f##*.}"
if [ "$(basename $f)" = "release" ]; then
# In release file, ignore differences in change numbers and order
# of modules in list.
# In release file, ignore differences in source rev numbers
OTHER_FILE=$WORK_DIR/$f.other
THIS_FILE=$WORK_DIR/$f.this
$MKDIR -p $(dirname $OTHER_FILE)
$MKDIR -p $(dirname $THIS_FILE)
RELEASE_FILTER="$SED \
-e 's/\:[0-9a-f]\{12,12\}/:CHANGE/g' \
-e 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6\}/<DATE>/g' \
-e 's/^#.*/#COMMENT/g' \
-e 's/MODULES=/MODULES=\'$'\n/' \
-e 's/,/\'$'\n/g' \
| $SORT
"
RELEASE_FILTER="$SED -e 's/SOURCE=".*"/SOURCE=<src-rev>/g'"
$CAT $OTHER_DIR/$f | eval "$RELEASE_FILTER" > $OTHER_FILE
$CAT $THIS_DIR/$f | eval "$RELEASE_FILTER" > $THIS_FILE
elif [ "x$SUFFIX" = "xhtml" ]; then
# Ignore time stamps in docs files
OTHER_FILE=$WORK_DIR/$f.other
THIS_FILE=$WORK_DIR/$f.this
$MKDIR -p $(dirname $OTHER_FILE) $(dirname $THIS_FILE)
# Older versions of compare might have left soft links with
# these names.
$RM $OTHER_FILE $THIS_FILE
#Note that | doesn't work on mac sed.
HTML_FILTER="$SED \
-e 's/20[0-9]\{2\}-[0-9]\{2\}-[0-9]\{2\}-[0-9]\{6,7\}/<DATE>/g' \
-e 's/20[0-9]\{2\}-[0-9]\{2\}-[0-9]\{2\}/<DATE>/g' \
-e 's/\(-- Generated by javadoc \).*\( --\)/\1(removed)\2/' \
-e 's/[A-Z][a-z]*, [A-Z][a-z]* [0-9][0-9]*, [0-9]\{4\} [0-9][0-9:]* [AMP]\{2,2\} [A-Z][A-Z]*/<DATE>/' \
-e 's/from .*\.idl/\.idl/' \
"
$CAT $OTHER_DIR/$f | eval "$HTML_FILTER" > $OTHER_FILE &
$CAT $THIS_DIR/$f | eval "$HTML_FILTER" > $THIS_FILE &
wait
elif [ "$SUFFIX" = "svg" ]; then
# GraphViz has non-determinism when generating svg files
OTHER_FILE=$WORK_DIR/$f.other
Expand Down

0 comments on commit 43da9ff

Please sign in to comment.