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

#!/bin/sh

# do two runs of a script, one optimistic and one pessimistic, expect identical outputs
# if not, display and error message and a diff

which opendiff >/dev/null
RES=$?
if [ $RES = 0 ]; then
    DIFFTOOL=opendiff
else
    DIFFTOOL=diff
fi

OPTIMISTIC=out_optimistic
PESSIMISTIC=out_pessimistic
$JAVA_HOME/bin/java -ea -jar ../dist/nashorn.jar ${@} >$PESSIMISTIC
$JAVA_HOME/bin/java -ea -Dnashorn.optimistic -jar ../dist/nashorn.jar ${@} >$OPTIMISTIC

if ! diff -q $PESSIMISTIC $OPTIMISTIC >/dev/null ; then
    echo "Failure! Results are different"
    echo ""
    $DIFFTOOL $PESSIMISTIC $OPTIMISTIC
else
    echo "OK - Results are identical"
fi