nashorn/bin/rundiff.sh
author ppunegov
Sat, 19 Jul 2014 00:29:20 +0400
changeset 25732 e2c1d053a55f
parent 24719 f726e9d67629
permissions -rw-r--r--
8048882: Some regression tests are not robust with VM output Reviewed-by: kvn, iignatyev
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