Skip to content

Commit

Permalink
Do not time out close_dialog_through_button
Browse files Browse the repository at this point in the history
If something goes wrong, better keep the testing Python and the tested soffice
process in a state in which the actual problem can (hopefully) be debugged
better.

I happened to run into a hung UITest_chart on Linux, where soffice.bin was still
at

> Thread 1 (Thread 0x7f2e2b280fc0 (LWP 1906251)):
> #0  futex_abstimed_wait_cancelable (private=0, abstime=0x7f2e27b59a80, clockid=<optimized out>, expected=0, futex_word=0x60e000024e8c) at /usr/src/debug/glibc-2.31-17-gab029a2801/sysdeps/nptl/futex-internal.h:320
> #1  __pthread_cond_wait_common (abstime=0x7f2e27b59a80, clockid=<optimized out>, mutex=0x60e000024e38, cond=0x60e000024e60) at /usr/src/debug/glibc-2.31-17-gab029a2801/nptl/pthread_cond_wait.c:520
> #2  __pthread_cond_clockwait (abstime=0x7f2e27b59a80, clockid=<optimized out>, mutex=0x60e000024e38, cond=0x60e000024e60) at /usr/src/debug/glibc-2.31-17-gab029a2801/nptl/pthread_cond_wait.c:677
> #3  __pthread_cond_clockwait (cond=0x60e000024e60, mutex=0x60e000024e38, clockid=<optimized out>, abstime=0x7f2e27b59a80) at /usr/src/debug/glibc-2.31-17-gab029a2801/nptl/pthread_cond_wait.c:665
> #4  0x00007f2e5fead808 in std::condition_variable::__wait_until_impl<std::chrono::duration<long, std::ratio<1l, 1000000000l> > >(std::unique_lock<std::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&) (this=0x60e000024e60, __lock=..., __atime=...) at include/c++/10.0.1/condition_variable:210
> #5  0x00007f2e5fead295 in std::condition_variable::wait_until<std::chrono::duration<long, std::ratio<1l, 1000000000l> > >(std::unique_lock<std::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&) (this=0x60e000024e60, __lock=..., __atime=...) at include/c++/10.0.1/condition_variable:120
> #6  0x00007f2e5fea8f05 in std::condition_variable::wait_until<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> >, SvpSalInstance::DoYield(bool, bool)::$_2>(std::unique_lock<std::mutex>&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > > const&, SvpSalInstance::DoYield(bool, bool)::$_2) (this=0x60e000024e60, __lock=..., __atime=..., __p=...) at include/c++/10.0.1/condition_variable:159
> #7  0x00007f2e5fea6e60 in std::condition_variable::wait_for<long, std::ratio<1l, 1000l>, SvpSalInstance::DoYield(bool, bool)::$_2>(std::unique_lock<std::mutex>&, std::chrono::duration<long, std::ratio<1l, 1000l> > const&, SvpSalInstance::DoYield(bool, bool)::$_2) (this=0x60e000024e60, __lock=..., __rtime=..., __p=...) at include/c++/10.0.1/condition_variable:186
> #8  0x00007f2e5fea5a8e in SvpSalInstance::DoYield(bool, bool) (this=0x611000001bc0, bWait=true, bHandleAllCurrentEvents=false) at vcl/headless/svpinst.cxx:497
> #9  0x00007f2e5f3a232d in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at vcl/source/app/svapp.cxx:454
> #10 0x00007f2e5f3a18e8 in Application::Yield() () at vcl/source/app/svapp.cxx:518
> #11 0x00007f2e5bf32c2d in Dialog::Execute() (this=0x61a000072080) at vcl/source/window/dialog.cxx:1032
> #12 0x00007f2e5efdcd62 in SalInstanceDialog::run() (this=0x619000091080) at vcl/source/app/salvtables.cxx:1480
> #13 0x00007f2dc37421fd in weld::DialogController::run() (this=0x61200077c5c0) at include/vcl/weld.hxx:2227
> #14 0x00007f2dc39672f2 in chart::CreationWizardUnoDlg::execute() (this=0x610000168d40) at chart2/source/controller/dialogs/dlg_CreationWizard_UNO.cxx:189
> #15 0x00007f2df91f2507 in FuInsertChart::FuInsertChart(ScTabViewShell&, vcl::Window*, ScDrawView*, SdrModel*, SfxRequest&) (this=0x7f2e27f1a300, rViewSh=..., pWin=0x61a0001e8a80, pViewP=0x61d0001f6880, pDoc=0x617000066a00, rReq=...) at sc/source/ui/drawfunc/fuins2.cxx:673
> #16 0x00007f2dfaf9a379 in ScTabViewShell::ExecDrawIns(SfxRequest&) (this=0x61d0001eaa80, rReq=...) at sc/source/ui/view/tabvwshb.cxx:336
> #17 0x00007f2dfaedf365 in SfxStubScTabViewShellExecDrawIns(SfxShell*, SfxRequest&) (pShell=0x61d0001eaa80, rReq=...) at workdir/SdiTarget/sc/sdi/scslots.hxx:1447
> #18 0x00007f2e8031ded6 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) (this=0x61d0001eaa80, pFunc=0x7f2dfaedf240 <SfxStubScTabViewShellExecDrawIns(SfxShell*, SfxRequest&)>, rReq=...) at include/sfx2/shell.hxx:197
> #19 0x00007f2e802a77ff in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) (this=0x6020002f3dd0, rShell=..., rSlot=..., rReq=..., bRecord=true) at sfx2/source/control/dispatch.cxx:251
> #20 0x00007f2e802aacb6 in SfxDispatcher::PostMsgHandler(std::unique_ptr<SfxRequest, std::default_delete<SfxRequest> >) (this=0x6020002f3dd0, pReq=std::unique_ptr<class SfxRequest> = {...}) at sfx2/source/control/dispatch.cxx:988
[...]

but the Python process was already at

> Traceback (most recent call first):
>   <built-in method waitpid of module object at remote 0x60800002d1c0>
>   File "instdir/program/python-core-3.7.7/lib/subprocess.py", line 1611, in _try_wait
>     (pid, sts) = os.waitpid(self.pid, wait_flags)
>   File "instdir/program/python-core-3.7.7/lib/subprocess.py", line 1653, in _wait
>     (pid, sts) = self._try_wait(0)
>   File "instdir/program/python-core-3.7.7/lib/subprocess.py", line 1019, in wait
>     return self._wait(timeout=timeout)
>   File "uitest/libreoffice/connection.py", line 133, in tearDown
>     ret = self.soffice.wait()
>   File "uitest/libreoffice/connection.py", line 178, in tearDown
>     self.connection.tearDown()
>   File "uitest/uitest/framework.py", line 46, in tearDown
>     self.connection.tearDown()
>   File "instdir/program/python-core-3.7.7/lib/unittest/case.py", line 631, in run
>     self.tearDown()
>   File "instdir/program/python-core-3.7.7/lib/unittest/case.py", line 676, in __call__
>     return self.run(*args, **kwds)
>   File "instdir/program/python-core-3.7.7/lib/unittest/suite.py", line 122, in run
>     test(result)
>   File "instdir/program/python-core-3.7.7/lib/unittest/suite.py", line 84, in __call__
>     return self.run(*args, **kwds)
>   File "instdir/program/python-core-3.7.7/lib/unittest/runner.py", line 176, in run
>     test(result)
>   File "uitest/test_main.py", line 128, in <module>
>     result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(test_suite)

and the relevant

> ======================================================================
> ERROR: test_tdf99069_chart_cancel_data_ranges_dialog (tdf99069.tdf99069)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "sc/qa/uitest/chart/tdf99069.py", line 32, in test_tdf99069_chart_cancel_data_ranges_dialog
>     self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
>   File "uitest/uitest/test.py", line 83, in execute_dialog_through_command
>     raise DialogNotExecutedException(command)
> uitest.test.DialogNotExecutedException: Dialog not executed for: .uno:InsertObjectChart

had not yet been written to workdir/UITest/chart/done.log (Python's unittest
appears to unhelpfully hold back such vital information until the very end of
the full test run).

That means DialogNotClosedException is unused now and can thus be removed.

Change-Id: I556ae52f05b1362f4e78f2de362a7b4f9b8a0cf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92959
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <[email protected]>
  • Loading branch information
stbergmann committed Apr 27, 2020
1 parent 5cff641 commit 19d3dba
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions uitest/uitest/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def __init__(self, command):
def __str__(self):
return "Dialog not executed for: " + self.command

class DialogNotClosedException(Exception):

def __str__(self):
return "Dialog was not closed"

class UITest(object):

def __init__(self, xUITest, xContext):
Expand Down Expand Up @@ -152,14 +147,11 @@ def create_doc_in_start_center(self, app):
def close_dialog_through_button(self, button):
with EventListener(self._xContext, "DialogClosed" ) as event:
button.executeAction("CLICK", tuple())
time_ = 0
while time_ < MAX_WAIT:
while True:
if event.executed:
time.sleep(DEFAULT_SLEEP)
return
time_ += DEFAULT_SLEEP
time.sleep(DEFAULT_SLEEP)
raise DialogNotClosedException()

def close_doc(self):
desktop = self.get_desktop()
Expand Down

0 comments on commit 19d3dba

Please sign in to comment.