nashorn/bin/rundiff.sh
author lana
Fri, 18 Jul 2014 08:25:26 -0700
changeset 25597 6073de33135f
parent 24719 f726e9d67629
permissions -rw-r--r--
Merge
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