2012-07-22 17:07:41 -07:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
if [ $# -ne 2 ]; then
|
2012-07-22 17:45:43 -07:00
|
|
|
|
if [ $# -ne 3 ]; then
|
|
|
|
|
echo "Usage: $0 <minetest git directory> <world directory> [<result file>]"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
resultfile_dst=$3
|
|
|
|
|
else
|
|
|
|
|
resultfile_dst=""
|
2012-07-22 17:07:41 -07:00
|
|
|
|
fi
|
|
|
|
|
gamedir=$1
|
|
|
|
|
worlddir=$2
|
|
|
|
|
|
|
|
|
|
#echo "-- Making world in $worlddir using $gamedir"
|
|
|
|
|
echo "-- Making world `basename $worlddir`"
|
|
|
|
|
|
2012-11-28 00:50:21 -08:00
|
|
|
|
pushd "$gamedir" &>/dev/null || exit 1
|
2012-07-22 17:07:41 -07:00
|
|
|
|
# Configuration file is the common runtime configuration method
|
|
|
|
|
echo -e "map-dir = $worlddir\nenable_mapgen_debug_info = true\n" > worldtest_config
|
2012-11-28 00:50:21 -08:00
|
|
|
|
mkdir -p "$worlddir" || exit 1
|
2012-07-22 17:45:43 -07:00
|
|
|
|
if ! [ -a "$worlddir/world.mt" ]; then
|
|
|
|
|
echo -e 'gameid = minimal' > "$worlddir/world.mt"
|
|
|
|
|
fi
|
2012-07-22 17:07:41 -07:00
|
|
|
|
"$gamedir/bin/minetestserver" --config worldtest_config
|
|
|
|
|
popd &>/dev/null
|
|
|
|
|
resultfile=$gamedir/worldtest_result.txt
|
2012-07-22 17:45:43 -07:00
|
|
|
|
# Copy result to wanted location
|
|
|
|
|
if [ "$resultfile_dst" != "" ]; then
|
|
|
|
|
cp "$resultfile" "$resultfile_dst"
|
|
|
|
|
fi
|
|
|
|
|
# Return based on result
|
2012-07-22 17:07:41 -07:00
|
|
|
|
if [ "`grep -c BAD: "$resultfile"`" != "0" ]; then
|
|
|
|
|
#echo `grep ERRORS: "$resultfile"`
|
2012-07-22 17:45:43 -07:00
|
|
|
|
exit 1
|
2012-07-22 17:07:41 -07:00
|
|
|
|
else
|
2012-07-22 17:45:43 -07:00
|
|
|
|
exit 0
|
2012-07-22 17:07:41 -07:00
|
|
|
|
fi
|
|
|
|
|
|