jdk-24/nashorn/bin/rundiff.sh
Attila Szegedi e9e7dd2ec1 8035820: Optimistic recompilation
Co-authored-by: Marcus Lagergren <marcus.lagergren@oracle.com>
Reviewed-by: hannesw, jlaskey, sundar
2014-02-26 13:17:57 +01:00

26 lines
657 B
Bash

#!/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