030b59a5af
Without this, the unit-prefork gives unpredictable results depending on whether the entire unit test run output is redirected to another logfile or not (as then the stdout is inherited, and points to an unexpected place). Maybe we should just exclude the fd 0, 1, 2 from the testing; but this is good enough for now.
90 lines
2.8 KiB
Bash
Executable file
90 lines
2.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# DO NOT EDIT - this file is generated from run_unit.sh.in.
|
|
#
|
|
|
|
# substituted variables in one place:
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
abs_top_builddir="${DIR}/.."
|
|
systemplate_path="@SYSTEMPLATE_PATH@"
|
|
enable_debug="@ENABLE_DEBUG@"
|
|
jails_path="@JAILS_PATH@"
|
|
lo_path="@LO_PATH@"
|
|
|
|
tst=
|
|
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
|
|
|
|
# drop .la suffix
|
|
tst=`echo $tst | sed s/\.la//`;
|
|
|
|
export LOOL_LOGLEVEL=trace
|
|
|
|
if test "z$enable_debug" != "ztrue"; then
|
|
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
|
|
|
|
# result logging
|
|
echo "test output is '$test_output'"
|
|
echo > $test_output
|
|
|
|
if test "z$tst" == "z"; then
|
|
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" \
|
|
--allowlocalstorage \
|
|
--admincreds="admin/admin" \
|
|
--unitlib=".libs/$tst.so" > "$tst_log" 2>&1; then
|
|
echo "Test $tst passed."
|
|
echo ":test-result: PASS $tst" >> $test_output
|
|
else
|
|
cat "$tst_log"
|
|
echo "============================================================="
|
|
echo "Test failed on unit: $tst re-run with:"
|
|
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
|
|
fi
|
|
fi
|