When writing tests, please make sure they work with a read-only source tree

Stephan Bergmann sbergman at redhat.com
Mon Mar 4 12:59:05 UTC 2019


See subject.  I had to just fix a bunch of UITests again, 
<https://gerrit.libreoffice.org/#/c/68683/> "Fix some UITests to use 
copies of SRCDIR documents".  This not only affects whether tests 
succeed with a read-only source tree, but also helps in other scenarios 
like documented in the commit message of 
<https://gerrit.libreoffice.org/plugins/gitiles/core/+/5eb9dd46e9b3ba18afd4f6dac580c4b91e715f43%5E!/> 
"More temp copies of test docs in Python/UITests":  "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)."

For reference, my script to do test builds with a read-only source tree 
on Linux is

> set -ex
> git clone https://git.libreoffice.org/core ~/lo-ro/core
> (cd ~/lo-ro/core && ./g -f clone)
> mkdir ~/lo-ro/source
> sudo mount -o bind,ro ~/lo-ro/core ~/lo-ro/source
> mkdir ~/lo-ro/build
> ln -s ../autogen.input ~/lo-ro/build/autogen.input
> cd ~/lo-ro/build
> ../source/autogen.sh


More information about the LibreOffice mailing list