1
0
Fork 0
arangodb/scripts/unittest

63 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
export PID=$$
export GLIBCXX_FORCE_NEW=1
if test -n "$ORIGINAL_PATH"; then
# running in cygwin...
PS='\'
export EXT=".exe"
else
export EXT=""
PS='/'
fi;
export PORT=`expr 1024 + $RANDOM`
NUMA=""
if `which numactl > /dev/null`; then
NUMA="numactl --interleave=all"
fi
if [ -z "${ARANGOSH}" ]; then
if [ -x build/bin/arangosh ]; then
ARANGOSH=build/bin/arangosh
elif [ -x bin/arangosh ]; then
ARANGOSH=bin/arangosh
elif [ -x usr/bin/arangosh ]; then
ARANGOSH=usr/bin/arangosh
else
ARANGOSH="$(find . -name arangosh -executable -type f | head -n 1)"
[ -x "${ARANGOSH}" ] || {
echo "$0: cannot locate arangosh"
exit 1
}
fi
fi
declare -a EXTRA_ARGS
if [ `uname -s` == "Darwin" ]; then
EXEC_PATH="$(dirname "$(dirname "$0")")"
else
EXEC_PATH="$(dirname "$(dirname "$(readlink -m "$0")")")"
[ -x "${ARANGOSH}" ] && ARANGOSH="$(readlink -m "${ARANGOSH}")"
fi
[[ " $@ " =~ "--build" ]] || {
BUILD_PATH="$(dirname "$(dirname "${ARANGOSH}")")"
BUILD_PATH="${BUILD_PATH#${EXEC_PATH}/}"
EXTRA_ARGS=("--build" "${BUILD_PATH}")
}
(
cd "${EXEC_PATH}"
exec $NUMA $ARANGOSH \
-c etc${PS}relative${PS}arangosh.conf \
--log.level warning \
--server.endpoint tcp://127.0.0.1:${PORT} \
--javascript.execute UnitTests${PS}unittest.js \
-- \
"$@" "${EXTRA_ARGS[@]}"
)