24719
|
1 |
#!/bin/sh
|
|
2 |
|
|
3 |
# do two runs of a script, one optimistic and one pessimistic, expect identical outputs
|
|
4 |
# if not, display and error message and a diff
|
|
5 |
|
|
6 |
which opendiff >/dev/null
|
|
7 |
RES=$?
|
|
8 |
if [ $RES = 0 ]; then
|
|
9 |
DIFFTOOL=opendiff
|
|
10 |
else
|
|
11 |
DIFFTOOL=diff
|
|
12 |
fi
|
|
13 |
|
|
14 |
OPTIMISTIC=out_optimistic
|
|
15 |
PESSIMISTIC=out_pessimistic
|
|
16 |
$JAVA_HOME/bin/java -ea -jar ../dist/nashorn.jar ${@} >$PESSIMISTIC
|
|
17 |
$JAVA_HOME/bin/java -ea -Dnashorn.optimistic -jar ../dist/nashorn.jar ${@} >$OPTIMISTIC
|
|
18 |
|
|
19 |
if ! diff -q $PESSIMISTIC $OPTIMISTIC >/dev/null ; then
|
|
20 |
echo "Failure! Results are different"
|
|
21 |
echo ""
|
|
22 |
$DIFFTOOL $PESSIMISTIC $OPTIMISTIC
|
|
23 |
else
|
|
24 |
echo "OK - Results are identical"
|
|
25 |
fi
|