2016-04-16 15:27:10 -05:00
|
|
|
#!/usr/bin/env bash
|
2016-04-11 12:21:16 -05:00
|
|
|
#
|
|
|
|
# DO NOT EDIT - this file is generated from run_unit.sh.in.
|
|
|
|
#
|
2016-04-05 17:04:40 -05:00
|
|
|
|
2016-04-15 10:39:05 -05:00
|
|
|
# substituted variables in one place:
|
2016-04-16 15:27:10 -05:00
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
abs_top_builddir="${DIR}/.."
|
2016-04-15 10:39:05 -05:00
|
|
|
systemplate_path="@SYSTEMPLATE_PATH@"
|
|
|
|
enable_debug="@ENABLE_DEBUG@"
|
|
|
|
jails_path="@JAILS_PATH@"
|
|
|
|
lo_path="@LO_PATH@"
|
2016-04-05 17:04:40 -05:00
|
|
|
|
2016-04-30 12:15:41 -05:00
|
|
|
tst=
|
2016-04-15 10:39:05 -05:00
|
|
|
while test $# -gt 0; do
|
|
|
|
case $1 in
|
|
|
|
--test-name) tst=$2; shift;;
|
|
|
|
--log-file) tst_log=$2; shift;;
|
|
|
|
--trs-file) test_output=$2; shift;;
|
|
|
|
-*) ;; # ignore
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2016-04-30 12:15:41 -05:00
|
|
|
# drop .la suffix
|
|
|
|
tst=`echo $tst | sed s/\.la//`;
|
2016-04-11 12:21:16 -05:00
|
|
|
|
2016-04-15 16:04:15 -05:00
|
|
|
export LOOL_LOGLEVEL=trace
|
2016-04-12 04:00:33 -05:00
|
|
|
|
2016-04-15 10:39:05 -05:00
|
|
|
if test "z$enable_debug" != "ztrue"; then
|
2016-04-12 04:00:33 -05:00
|
|
|
echo ""
|
|
|
|
echo "It is necessary to configure with --enable-debug for unit tests to pass"
|
|
|
|
echo ""
|
|
|
|
echo ":test-result: FAIL $tst" > $test_output
|
|
|
|
exit 1;
|
|
|
|
fi
|
2016-04-06 13:50:55 -05:00
|
|
|
|
|
|
|
# result logging
|
2016-04-30 12:15:41 -05:00
|
|
|
echo "test output is '$test_output'"
|
2016-04-15 10:39:05 -05:00
|
|
|
echo > $test_output
|
|
|
|
|
2016-04-30 12:15:41 -05:00
|
|
|
if test "z$tst" == "z"; then
|
2016-04-15 10:39:05 -05:00
|
|
|
echo "executing external tests"
|
|
|
|
${abs_top_builddir}/loolwsd --systemplate="$systemplate_path" \
|
|
|
|
--lotemplate="$lo_path" \
|
|
|
|
--childroot="$jails_path" \
|
|
|
|
--allowlocalstorage 2> "$tst_log" &
|
|
|
|
|
|
|
|
echo " executing test"
|
|
|
|
|
|
|
|
oldpath=`pwd`
|
|
|
|
cd "${abs_top_builddir}/test"
|
|
|
|
if ./test; then
|
|
|
|
echo "Test run_test.sh passed."
|
|
|
|
echo ":test-result: PASS run_test.sh" >> $oldpath/$test_output
|
|
|
|
retval=0
|
|
|
|
else
|
|
|
|
echo "============================================================="
|
|
|
|
echo "Test failed on unit:"
|
|
|
|
echo "============================================================="
|
|
|
|
echo ":test-result: FAIL run_test.sh" >> $oldpath/$test_output
|
|
|
|
retval=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
kill $!
|
|
|
|
|
|
|
|
exit $retval
|
|
|
|
|
|
|
|
else # newer unit tests.
|
|
|
|
echo "Running $tst | $tst_log ...";
|
|
|
|
if ${abs_top_builddir}/loolwsd --systemplate="$systemplate_path" \
|
|
|
|
--lotemplate="$lo_path" \
|
|
|
|
--childroot="$jails_path" \
|
2016-04-18 08:29:17 -05:00
|
|
|
--allowlocalstorage \
|
2016-04-19 15:50:43 -05:00
|
|
|
--admincreds="admin/admin" \
|
2016-04-15 10:39:05 -05:00
|
|
|
--unitlib=".libs/$tst.so" 2> "$tst_log"; then
|
|
|
|
echo "Test $tst passed."
|
|
|
|
echo ":test-result: PASS $tst" >> $test_output
|
2016-04-05 17:04:40 -05:00
|
|
|
else
|
2016-04-15 10:39:05 -05:00
|
|
|
cat "$tst_log"
|
2016-04-06 13:50:55 -05:00
|
|
|
echo "============================================================="
|
2016-04-15 10:39:05 -05:00
|
|
|
echo "Test failed on unit: $tst re-run with:"
|
2016-05-02 06:37:38 -05:00
|
|
|
echo " $ gdb --args ../loolwsd --systemplate=\"$systemplate_path\" \\"
|
|
|
|
echo " --lotemplate=\"$lo_path\" \\"
|
|
|
|
echo " --childroot=\"$jails_path\" --allowlocalstorage --admincreds="admin/admin" \\"
|
|
|
|
echo " --unitlib=\".libs/$tst.so\""
|
|
|
|
echo "============================================================="
|
|
|
|
echo ":test-result: FAIL $tst" >> $test_output
|
2016-04-05 17:04:40 -05:00
|
|
|
fi
|
2016-04-15 10:39:05 -05:00
|
|
|
fi
|