From e8cd9e35d3628ffb6689a4b40e5171cb7f6be8dc Mon Sep 17 00:00:00 2001 From: Ashod Nakashian Date: Sun, 26 Jun 2016 16:36:19 -0400 Subject: [PATCH] bccu#1909 - loolwsd command line options vs. config file and package upgrades Unit tests updated with new command-line arguments. Change-Id: I1a391255c44d4d22b8304129634ef7d16b606bce Reviewed-on: https://gerrit.libreoffice.org/26683 Reviewed-by: Ashod Nakashian Tested-by: Ashod Nakashian --- loolwsd/test/UnitPrefork.cpp | 12 ++++++++++-- loolwsd/test/run_unit.sh.in | 28 ++++++++++++++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/loolwsd/test/UnitPrefork.cpp b/loolwsd/test/UnitPrefork.cpp index 4bedaaacd..2b804ee7a 100644 --- a/loolwsd/test/UnitPrefork.cpp +++ b/loolwsd/test/UnitPrefork.cpp @@ -88,7 +88,7 @@ public: return true; } - void getMemory(const std::shared_ptr &socket, + bool getMemory(const std::shared_ptr &socket, size_t &totalPSS, size_t &totalDirty) { std::unique_lock lock(_mutex); @@ -100,10 +100,12 @@ public: { _failure = "Timed out waiting for child to respond to unit-memdump."; Log::error(_failure); + return false; } totalPSS = _totalPSS; totalDirty = _totalDirty; + return true; } virtual void newChild(const std::shared_ptr &socket) override @@ -121,7 +123,12 @@ public: // Skip the last one as it's not completely initialized yet. for (size_t i = 0; i < _childSockets.size() - 1; ++i) { - getMemory(_childSockets[i], totalPSSKb, totalDirtyKb); + Log::info() << "Getting memory of child #" << i + 1 << " of " << _childSockets.size() << Log::end; + if (!getMemory(_childSockets[i], totalPSSKb, totalDirtyKb)) + { + exitTest(TestResult::TEST_FAILED); + return; + } } Log::info() << "Memory use total " << totalPSSKb << "k shared " @@ -143,6 +150,7 @@ public: } else { + Log::error("UnitPrefork success."); exitTest(TestResult::TEST_OK); } } diff --git a/loolwsd/test/run_unit.sh.in b/loolwsd/test/run_unit.sh.in index 20b4ae726..88bfca07e 100755 --- a/loolwsd/test/run_unit.sh.in +++ b/loolwsd/test/run_unit.sh.in @@ -50,10 +50,12 @@ echo > $test_output if test "z$tst" == "z"; then echo "executing external tests" ${valgrind} \ - ${abs_top_builddir}/loolwsd --systemplate="$systemplate_path" \ - --lotemplate="$lo_path" \ - --childroot="$jails_path" \ - --allowlocalstorage > "$tst_log" 2>&1 & + ${abs_top_builddir}/loolwsd --o:sys_template_path="$systemplate_path" \ + --o:lo_template_path="$lo_path" \ + --o:child_root_path="$jails_path" \ + --o:storage.filesystem[@allow]=true \ + --o:admin_console.username=admin --o:admin_console.password=admin \ + > "$tst_log" 2>&1 & echo " executing test" @@ -78,11 +80,11 @@ if test "z$tst" == "z"; then else # newer unit tests. echo "Running $tst | $tst_log ..."; if ${valgrind} \ - ${abs_top_builddir}/loolwsd --systemplate="$systemplate_path" \ - --lotemplate="$lo_path" \ - --childroot="$jails_path" \ - --allowlocalstorage \ - --admincreds="admin/admin" \ + ${abs_top_builddir}/loolwsd --o:sys_template_path="$systemplate_path" \ + --o:lo_template_path="$lo_path" \ + --o:child_root_path="$jails_path" \ + --o:storage.filesystem[@allow]=true \ + --o:admin_console.username=admin --o:admin_console.password=admin \ --unitlib=".libs/$tst.so" > "$tst_log" 2>&1; then echo "Test $tst passed." echo ":test-result: PASS $tst" >> $test_output @@ -90,9 +92,11 @@ else # newer unit tests. 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 " $ gdb ${abs_top_builddir}/loolwsd --o:sys_template_path=\"$systemplate_path\" \\" + echo " --o:lo_template_path=\"$lo_path\" \\" + echo " --o:child_root_path=\"$jails_path\" \\" + echo " --o:storage.filesystem[@allow]=true \\" + echo " --o:admin_console.username=admin --o:admin_console.password=admin \\" echo " --unitlib=\".libs/$tst.so\"" echo "=============================================================" echo ":test-result: FAIL $tst" >> $test_output