nashorn/bin/rundiff.sh
author attila
Tue, 26 Aug 2014 11:45:36 +0200
changeset 26246 66c7c54fe70c
parent 24719 f726e9d67629
permissions -rw-r--r--
8055923: collect timings using System.nanoTime Reviewed-by: hannesw, lagergren
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