# This shell script compile, run and verify Nit program files
# Set lang do default to avoid failed tests because of locale
-export LANG=C
-export LC_ALL=C
+export LANG=C.UTF-8
+export LC_ALL=C.UTF-8
+if uname | grep Darwin 1>/dev/null 2>&1; then
+ export LANG=en_US.UTF-8
+ export LC_ALL=en_US.UTF-8
+fi
+
export NIT_TESTING=true
# Use the pid as a collision prevention
export NIT_TESTING_ID=$$
# Get the first Java lib available
if which_java=$(which javac 2>/dev/null); then
- JAVA_HOME=$(dirname $(dirname $(readlink -f "$which_java")))
+
+ if sh -c "readlink -f ." 1>/dev/null 2>&1; then
+ READLINK="readlink -f"
+ else
+ # Darwin?
+ READLINK="readlink"
+ fi
+ JAVA_HOME=$(dirname $(dirname $($READLINK "$which_java")))
shopt -s nullglob
paths=`echo $JAVA_HOME/jre/lib/*/{client,server}/libjvm.so`
- paths=($paths)
- JNI_LIB_PATH=`dirname ${paths[0]}`
+ if [ -n "$paths" ]; then
+ paths=($paths)
+ JNI_LIB_PATH=`dirname ${paths[0]}`
+ fi
shopt -u nullglob
fi
if [ -f "$ff.write" ]; then
cat -- "$ff.write" >> "$ff.res"
elif [ -d "$ff.write" ]; then
- LANG=C /bin/ls -F "$ff.write" >> "$ff.res"
+ /bin/ls -F "$ff.write" >> "$ff.res"
fi
cp -- "$ff.res" "$ff.res2"
cat -- "$ff.cmp.err" "$ff.err" "$ff.res2" > "$ff.res"
if [ -f "$fff.write" ]; then
cat -- "$fff.write" >> "$fff.res"
elif [ -d "$fff.write" ]; then
- LANG=C /bin/ls -F -- "$fff.write" >> "$fff.res"
+ /bin/ls -F -- "$fff.write" >> "$fff.res"
fi
if [ -s "$fff.err" ]; then
cp -- "$fff.res" "$fff.res2"