Commit graph

25 commits

Author SHA1 Message Date
Tor Lillqvist
f49aa533e0 Fix iOS build (and maybe Android, too)
Change-Id: Id6645ce7fe0f70d7e7cec0059ad25624d1057ad5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89319
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-02-24 08:54:22 +01:00
Ashod Nakashian
18ab1ccaed wsd: cleanly shutdown when unittest times out
Termination flag is a very harsh way of exiting.
It works in most cases, but not when we have a
modified document. What happens is the following:

Unit-test flags for termination.
During session cleanup we have to save the modified doc.
Because save is in progress we don't 'disconnect' the view.
This leaves the view in loaded state until saving is done.
But because of the termination flag we don't wait for saving.
DocBroker sends 'exit' to child to forcefully exit.
This causes at least one assertion due to active LOKWindows (Sidebar).

Instead of the above, we flag for graceful shutdown from unittests,
and after we wait to cleanup all DocBrokers, we flag for termination.
This way, we get clean shutdown and all assertions/validations
pass, while we guarantee never to deadlock the unittests,
in case we end up waiting forever for shutdown to complete.

Change-Id: I7fc34137ea373e329795b1ed0090261c085e955a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89308
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-02-23 21:48:07 +01:00
Miklos Vajna
c414b4a240 UnitBase::exitTest: make sure we flag for termination only once
It can happen that a test succeeds, but right after that, the timeout
thread still fails the test:

09:21:10.411840 [ loolwsd ] INF  exitTest: 1. Flagging for termination.| common/Unit.cpp:201
09:21:10.412016 [ loolwsd ] ERR  Timed out waiting for unit test to complete| common/Unit.cpp:212
09:21:10.412060 [ loolwsd ] INF  exitTest: 2. Flagging for termination.| common/Unit.cpp:201

(1 is TestResult::Ok, 2 is TestResult::TimedOut.)

Fix these cases by just ignoring the timeout invocation, we'll exit soon
anyway.

With this, finally a sanitizers-enabled 'make check' passes agains a
sanitizers-enabled core.git.

Change-Id: Id52c4b6f88a795d4ff2af7929a71d5eb83c56773
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88999
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-19 11:16:09 +01:00
Michael Meeks
9dfac6dab1 test: switch to parallel tests based on Unit framework.
Increase a few timeouts, bin old-style standalone unit tests,
fix a number of bugs.

Change-Id: Ia3d59466ecb9a9443807ba3445d04dd5f77e3dba
2020-01-21 15:07:54 +00:00
Jan Holesovsky
f0ea9701d8 killpoco: Use std::thread instead of Poco::Thread.
Change-Id: I533429412f269cff8714407f3b99aef0ff133abf
Reviewed-on: https://gerrit.libreoffice.org/82199
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-11-07 12:24:01 +01:00
Jan Holesovsky
5b5e29b430 killpoco: Don't use POCO for app exit values.
Change-Id: I2948ac45a7b4243f7afde08d5245530fdbf9a070
Reviewed-on: https://gerrit.libreoffice.org/82125
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2019-11-07 12:23:47 +01:00
Ashod Nakashian
7a976488f0 wsd: cleanup the global flag accessors
The following flags are affected:
ShutdownRequestFlag
TerminationFlag
DumpGlobalState

Since it's common to grep for all places
that set or reset these global flags, it
makes more sense to have explicit functions
for each operation. Now we have set and reset
accessors where appropriate and get is reserved
for read-only access.

This changes the getters to only return
the boolean value of these flags rather than
a reference to the atomic object, now that
they are read-only.

Also, a few Mobile-specific cases were folded
either with other Mobile-specific sections, or
they were now identical to the non-Mobile case
and therefore deduplicated, making the code
cleaner and more readable.

Change-Id: Icc852aa43e86695d4e7d5962040a9b5086d9d08c
Reviewed-on: https://gerrit.libreoffice.org/81978
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-11-06 03:43:45 +01:00
Miklos Vajna
bd4d72d41f common: wrap TerminationFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:

==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
  [1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
  [2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
  [1]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)

  [2]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)

Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
2019-08-08 09:10:59 +02:00
Tor Lillqvist
977ca9a353 Drop unused variable
Change-Id: I927440f3c05956f3f244f6bc657a76a58e839231
2019-05-23 13:26:05 +03:00
Michael Meeks
36e9d5b376 TileCache: re-factor API to work in terms of vectors, not file references.
Change-Id: Ia9d48773121ab965b79ddb16b55b5d3fdcd7fd5c
2019-02-14 21:46:39 +01:00
Michael Meeks
f98a7f0592 Improve unit test / SSL handling & detection.
Change-Id: I6bd3116ac94d3d2c61e2ec543cb17896834ef2df
2019-02-13 18:24:36 +01:00
Jan Holesovsky
7f0f6e5a36 android: Restart if anything goes wrong.
But sleep for a bit of time between the runs to avoid a busy loop.

Change-Id: I90a7bee052d82e8a0488e6a34fb1b6f43e6f6e64
2019-02-13 16:37:54 +01:00
Jan Holesovsky
f76b36193d android: #if(n)def MOBILEAPP -> #if (!)MOBILEAPP for better reliability.
Change-Id: I5f9c9420b6c83601db1c8fdba4ae5a10b17b2107
2019-02-12 12:20:11 +01:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
64c9115a75 Remove stray #include <ftw.h>
Change-Id: I1838ae1c40a6ddc8357963c32f5ccf2040e7da10
2018-09-17 18:05:43 +03:00
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Pranav Kant
5a12b68b01 Fix unit test timeout interfering with normal run
Otherwise, loolwsd exits immediately upon start

Change-Id: I3bdf438797be162b8a44bb47ee1ddde7626dcc64
2017-03-17 12:44:23 +05:30
Michael Meeks
ab67d605e6 Unit tests: use WSD's main socket-poll for test timeouts. 2017-03-16 18:52:49 +00:00
Michael Meeks
0eaef6c896 config.h - get includes right: must always be the first include. 2017-03-10 10:47:43 +01:00
Tor Lillqvist
11ae90cfcb No Hungarian notation please
Change-Id: Ia624de45a792db7e39f2245aaea7d940b30b0db2
2017-01-13 14:52:08 +02:00
Noel Grandin
0bb8ba8307 loplugin:staticaccess
Change-Id: I1abd6c2a28d3a8e4fb0cda2d35be94d787ff67b7
Reviewed-on: https://gerrit.libreoffice.org/32368
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:43:34 +00:00
Noel Grandin
4ed820d3d5 add a configure option for using clang compiler plugins
and apply the nullptr plugin.

Lots of hacking in my LO tree required to make this work, will probably
end up needing to add an extra parameter to the LO side.

Change-Id: I02ae1dcdece9d9ddf05f7757f6696e3a5d7d1f14
Reviewed-on: https://gerrit.libreoffice.org/32339
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 14:23:42 +00:00
Noel Grandin
4199efc91c convert enums to scoped
Change-Id: Ic3d4c09dbcec28b4638bb8888f812f970f40a1c5
Reviewed-on: https://gerrit.libreoffice.org/32331
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 09:51:56 +00:00
Michael Meeks
67fcc2f99c Turn termination off for Unit tests. 2016-12-03 23:02:29 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/Unit.cpp (Browse further)