nashorn/bin/rundiff.sh
author vlivanov
Wed, 10 Sep 2014 19:19:51 +0400
changeset 26477 e095a2b8a1f8
parent 24719 f726e9d67629
permissions -rw-r--r--
8057654: Extract checks performed during MethodHandle construction into separate methods Reviewed-by: vlivanov, psandoz Contributed-by: john.r.rose@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24719
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     1
#!/bin/sh
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     2
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     3
# do two runs of a script, one optimistic and one pessimistic, expect identical outputs
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     4
# if not, display and error message and a diff
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     5
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     6
which opendiff >/dev/null
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     7
RES=$?
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     8
if [ $RES = 0 ]; then
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
     9
    DIFFTOOL=opendiff
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    10
else
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    11
    DIFFTOOL=diff
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    12
fi
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    13
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    14
OPTIMISTIC=out_optimistic
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    15
PESSIMISTIC=out_pessimistic
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    16
$JAVA_HOME/bin/java -ea -jar ../dist/nashorn.jar ${@} >$PESSIMISTIC
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    17
$JAVA_HOME/bin/java -ea -Dnashorn.optimistic -jar ../dist/nashorn.jar ${@} >$OPTIMISTIC
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    18
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    19
if ! diff -q $PESSIMISTIC $OPTIMISTIC >/dev/null ; then
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    20
    echo "Failure! Results are different"
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    21
    echo ""
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    22
    $DIFFTOOL $PESSIMISTIC $OPTIMISTIC
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    23
else
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    24
    echo "OK - Results are identical"
f726e9d67629 8035820: Optimistic recompilation
attila
parents:
diff changeset
    25
fi