[Libreoffice-commits] More temp copies of test docs in Python/UITests

Stephan Bergmann sbergman at redhat.com
Thu Sep 13 14:41:41 UTC 2018


Please keep the below in mind at least when writing new tests---don't 
open test documents directly from SRCDIR if the test may cause lock 
files to be written next to them.

On 13/09/2018 16:37, Libreoffice Gerrit user wrote:
> New commits:
> commit 5eb9dd46e9b3ba18afd4f6dac580c4b91e715f43
> Author:     Stephan Bergmann <sbergman at redhat.com>
> AuthorDate: Thu Sep 13 14:49:48 2018 +0200
> Commit:     Stephan Bergmann <sbergman at redhat.com>
> CommitDate: Thu Sep 13 16:36:58 2018 +0200
> 
>      More temp copies of test docs in Python/UITests
>      
>      ...similar to d76281864b0e83812c0edf7490b1e8271e89fff5 "Create temp copies of
>      test docs in Python/UITests", which only fixed those places that were broken
>      with a read-only SRCDIR.  However, I now ran into a deadlock on Linux (where
>      UITests are run with SAL_USE_VCLPLUGIN=svp) that suggests that /all/ documents
>      from SRCDIR that are opened by those tests should better first be copied to
>      WORKDIR sub-dirs (that are removed prior to running tests, so stale lock files
>      cannot exists).  This commit addresses just a small part of all those tests,
>      though.
>      
>      I had cancelled (ctrl-c) a `make check` midway, when it happened to be in the
>      middle of UITest_calc_tests2 and left beind a
>      sc/qa/uitest/calc_tests/data/.~lock.stableSorting.ods# lock file (which records,
>      among other things, the host name).  I then dropped off a VPN, which caused the
>      host name as seen by LO to switch from "alpha" to "alpha.fritz.box", then re-
>      started the build as `make check screenshot` (which was the thing I'd originally
>      intended, but forgotten the screenshot target).  The new built hung during
>      UITest_calc_tests2's sc/qa/uitest/calc_tests2/stableSorting.py, as loading
>      sc/qa/uitest/calc_tests/data/stableSorting.ods found the lock file with non-
>      matching host name in SfxMedium::LockOrigFileOnDemand, and hung in
>      SfxMedium::ShowLockedDocumentDialog -> UUIInteractionHandler::handle -> (switch
>      to main thread...) -> UUIInteractionHelper::handleLockedDocumentRequest -> ...
>      -> Dialog::Execute, which just blocks in svp mode (which, unlike --headless,
>      doesn't cause Application::IsDialogCancelEnabled).
>      
>      Change-Id: I999af50d6b1e5012d3978f5e476bcbfc9be6fd1d
>      Reviewed-on: https://gerrit.libreoffice.org/60439
>      Tested-by: Jenkins
>      Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
> 
> diff --git a/sc/qa/uitest/calc_tests2/stableSorting.py b/sc/qa/uitest/calc_tests2/stableSorting.py
> index dc20f7b45e76..986c7cc3d612 100644
> --- a/sc/qa/uitest/calc_tests2/stableSorting.py
> +++ b/sc/qa/uitest/calc_tests2/stableSorting.py
> @@ -4,6 +4,9 @@
>   # License, v. 2.0. If a copy of the MPL was not distributed with this
>   # file, You can obtain one at http://mozilla.org/MPL/2.0/.
>   #
> +
> +import org.libreoffice.unotest
> +import pathlib
>   from uitest.framework import UITestCase
>   from uitest.uihelper.common import get_state_as_dict
>   from uitest.uihelper.common import select_pos
> @@ -11,12 +14,11 @@ from uitest.uihelper.calc import enter_text_to_cell
>   from libreoffice.calc.document import get_sheet_from_doc
>   from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
>   from uitest.debug import sleep
> -from uitest.path import get_srcdir_url
>   from libreoffice.calc.document import get_cell_by_position
>   from libreoffice.uno.propertyvalue import mkPropertyValues
>   #Testcases Sorting TCS_Sorting Stable sorting
>   def get_url_for_data_file(file_name):
> -    return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name
> +    return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
>   
>   class CalcStableSorting(UITestCase):
>   


More information about the LibreOffice mailing list