When the Kit dies and there is no data saved to
disk to upload, there is nothing to do but unload
DocBroker and log the fact.
With unit-test that simulates the situation by
killing the Kit of a modified document.
Change-Id: I7dcc0583c053d7166935d15d045fcf6624e43b4e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This is a follow up of feb672392 for the fix in 8af039251
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I6a1c754193cce4f7d11d17b9bbe1986a2b46ad86
For some reason the disk-space check wasn't
done for WOPI storage. Here we add the check
and bubble the exception up to stop loading.
UnitStorage has been updated and re-enabled.
Change-Id: I15a093554b662d6c0828da7683ca0190a8225fc9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Forkit takes significantly longer to start than
to fork. At the startup of WSD we do wait 4 times
as long for forkit than when forking kits.
Similarly, we should also wait that much when
forkit crashes and we recover.
This stabalizes the forkit crash tests, which
did fail rather frequently (in one example,
2 out of 10 runs had failed locally).
Change-Id: I990c8e595b64c34a8e202933be833c53d7ebfc01
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This allows us to use multiple hosts using same coolwsd instance.
added aliases configuration to coolwsd.xml to avoid
possibility of opening the same file as two if the
WOPI host is accessed using different aliases
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I32913015c15fd396cecc702b76e0dcaa8bcafad3
This is to guard against 'faileddocloading' or other error message(s)
sent after the correct 'passwordrequired:to-view' message when a
protected document is loaded without providing password.
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I13b1d4a805916fc7a209464f63cb2ecf883b11c4
All tests are now ordered to minimize
the time paralell runs take. And the
two longest-running tests are augmented
to take less time. They still take about
20x longer than the fast test, but they
do serve a purpose and we have 50+ other
tests to go through in parallel.
Total time is not much longer than the
longest test with -j8, at around 150
seconds, give or take, on an 8 core,
16 thread CPU.
Duplication in Makefile.am is reduced
with some minor clean ups.
Change-Id: I14530531485bf85d8b59e476aa933e5b2cc26c93
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Consolidate and reduce the messages printed
on stdout in the test driver, which also
makes interleaving the messages from
different tests less problematic.
Test output is more concise and cleaner now.
Change-Id: I4bb0de852a935614ebc3d9e663c5454cb10e404f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
We track the number of wopi requests done
during tests and compare with the expected,
in each test scenario. This ensures we don't
miss any expected/required wopi operation,
but also that we don't do more than the
necessary minimum.
Change-Id: I2474f54987a6a12c396b6c0566324772ee3300e6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
* Reduce stdout messages.
* Print the gdb command with --unattended since its
not useful to wait for gdb when running from gdb.
* Add comment about --unattended.
Change-Id: I2d173282abd9fc842483db70e04d5706edeb5a85
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
An initial set of seven of these, easy to add more as/when needed.
Change-Id: I6c65e052d00f9eaa10adee3c9464043e4c594848
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Now the remaining tests that didn't have a name
get one and the logs are unified between old-
and new-style tests. Mostly.
This makes sure that all logs and assertions
properly log the test name and make test
failures easier to debug and fix.
Change-Id: Id159ffacc81642a6ec594c5143498408adab67cf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
With --unattended, do not wait for a debugger
upon seg-faulting. This avoids the unnecessary wait
that prolongs failed unit-tests in automated runs.
Now run_unit.sh and Cypress Makefile set this flag.
Note that the wait only happens when in debug
builds, or when envar COOL_DEBUG is set. This
prevents us from waiting when running a debug
build where we can't see the output, or indeed
the run is on a CI build machine.
This flag can also be used by devs when reproducing
failures where there is no interest in attaching
a debugger. The logs are shorter and more
readable, too. At least in trace level.
Change-Id: Ice15482c6724abc47f5955402295198eb7f671ee
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Build-time unit-test output is now only
displayed when the test fails. This is to
reduce noise while building when not helpful.
Change-Id: I273d97dae192a24e9a1ae9f662b0fcd7ff555b75
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When saving and/or uploading fails, we have
to give up after a certain number of retries.
A new config entry, per_document.limit_store_failures,
controls the number of consecutive failures
before giving up. This prevents locking-up
documents while uploading.
Includes a new unit-test.
Change-Id: I1296df1691fcaa982df9e861d34cb946a2eda860
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Refactor UnitWOPIDocumentConflict.cpp into
WOPIUploadConflictCommon.hpp and reuse for both
DocumentConflict and SaveOnExit tests.
Change-Id: I54ec1e37e5e9c6298b12a2b2e596363683fb2e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Now we have multiple document conflict scenarios
that exercise different states of DocBroker and
verify correct behavior in all cases.
Change-Id: Ia1a65be686a0899776799c82c1ebfd405c92dcab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When the last client connection is closed,
there is UI (or user) to provide input
on the document conflict dialog. In this
case, we detect that the situation is final
and unresolvable and we simply give up.
We log a warning and dump the document state
before terminating.
Change-Id: I111a446b8743a0d16b7ed8b39751a419036c927f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Transitioning the state must happen before
fiting the events that require the new state.
This was a source of random failures.
Also, improved other aspects and added
more assertions and logs.
Change-Id: I55d5a7d5f13eeedaff7f309402baaae37b0134d6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When running this test against a debug core.git, then this test times
out for me. But if I increase the timeout, then it passes after 316s
just fine.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I1cd0d227dd9aac7279f991493b9aaa7c07468fdd
TileCacheTests::testTileInvalidatedOutside is failing
locally, even on very old tests, because the tileinvalidation
returned is EMPTY (i.e. everything is invalidated)
which isn't expected.
Change-Id: I5ff9a3771d95d7177b8a3aee260223c4a17f906a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This adds a better automatic test state
enum, with support for transitions.
It is intended to be used only in tests,
to simplify the writing of tests around
a state-machine.
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit bf5e8a2d9f3b2fe99f5b46bcbd4c9e3e28853af5)
Change-Id: I8805dad57ca3c71c26cc30236d4832710e1717f9
ChildSession::loKitCallback() may generate a message in the format
"invalidatetiles: EMPTY, 0". Handle it properly in tests.
Signed-off-by: Luboš Luňák <l.lunak@centrum.cz>
Change-Id: If8009be3c4ce031466ed304df7028848a8ab960f
Trying to construct a string using sprintf() and std::stringstream
is unnecessarily complicated for something as simple as this,
and it shows up in my profiling. This commit makes the hex values
change to uppercase because that's what hexFromByte() returns,
but I don't think it matters.
Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: I31c7b8e7cf4c2a495eca0bf03ae4cab53b26a04b
When I did the previous "C++17" commit I removed C++11 and C++14
from the checked list, but I missed the fact that the code checked
for C++17/14/11 and then did nothing with it. So actually do use
the detected required C++ standard.
Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: Ia82d14d11f81456abed7ee2609903afe5366f5e7
this test ensures that double encoded filenames are not a problem.
file names can already be encoded like a%20b and this was causing
problems and fixed with #3786
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ibaf0456f26c3a2e8d3c2863c2b925c7a5b9fc79c
Improves the stability of this test, which
for some reason has been very unstable.
Poco's receiveFrame would return -1 without
throwing any error or indicating what's wrong.
Retrying didn't help.
Change-Id: I26b4917884e97422aa19f3e5105730ded4a45f94
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
By configuring with --enable-logging-test-asserts,
which is enabled by default, passing assertions
in tests will be logged.
Can be disabled with --disable-logging-test-asserts
and enabled for individual translation-units via
#define LOK_LOG_ASSERTIONS 1
This should help with debugging failures that
happen at some arbitrary point in a test.
Logs should now be more readable, as in most cases
extra logs aren't needed to trace the test progression.
That is, the assertions become self-documenting.
Change-Id: I5498331cac63bfe6ab09566697ca324a064c4dbf
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The _STR version of the assertion gives a very informative
output in case of a failure, such as the following:
Expected: [1970-01-01T00:10:00.000000Z]
Actual: [1970-01-01T00:00:00.000000Z]
[ ^ ]
With minor cleanups.
Change-Id: I592d883c3967dc34473f8a58c5208c00b519edc0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The default behavior of LOK_ASSERT is that of assert,
which is to evaluate the argument(s) multiple times.
This obviously has side-effects, and is therefore
problematic. It seems it's not safe to assume all
uses of assertion is aware of this side-effect.
To prevent side-effect issues, now the LOK_ASSERT
family of macros evaluate the arguments only once.
Change-Id: I5827264ca7fcd77a7d7f5ad787353c6a7beb4fab
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
When issuing tile render requests proactively (upon
getting invalidatetile event), if the registered
request has no subscriber, TileCache::saveTileAndNotify
simply drops the tiles!
New call sequence:
ClientSession::handleTileInvalidation
docBroker->handleTileCombinedRequest
tileCache().subscribeToTileRendering //< fix
The end result was that we rendered tiles only
to discard them, potentially leaving the clients with
stale tiles (unless they requested new tiles themselves).
If they do request them, we still benefit from the cached
copies of the internal requests we had issued (and dropped).
The issue is that we are wasting an opportunity for efficiency
and relying on the client to request tiles when we normally
push on invalidation, adding latency and being inconsistent.
Change-Id: I4d3aa3739c5324ffca15c80b20dce29ac03eef73
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The old code worked for "gcc -fsanitize=address", but the sanitizers
tinderbox builds with "clang -fsanitize=address".
Follow-up to commit f67b8901dd (test:
double the timeout in isDocumentLoaded() for sanitizers, 2021-11-03).
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I4b802ec0d3d20516e3d58cc1c65d7e1422632b2b
Created trace for adding and editing slides and shapes in Impress. Also re-typing and adding bullet points using large Writer file
Signed-off-by: Nnamani Ezinne Martina <nnamani.ezinne@collabora.com>
Change-Id: I3541295fada230338acb934409c2bcb80730354b
Signed-off-by: Nnamani Ezinne Martina <nnamani.ezinne@collabora.com>
The sanitizers tinderbox regularly times out, and it's good to know if
the timeout value is an agressive one or the load is really that slow.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I2903481ea9efde68aca3f4ec00bd6e7e2d3b840a
SteamSocket::eraseFirstInputBytes() removes from the beginning
of std::vector, which is generally slow. If the buffer becomes
too big, which it may under a load, then the function will get
slow, which in turn will likely lead to the buffer getting even
bigger because of accumulated backlog.
The Buffer class is optimized for removal at the beginning,
so use it instead of std::vector, including some API additions
for it to be an in-place replacement where it's used.
Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: I4cf7ec56c908c7d3df391dc3f8e230ad32abb162
The startsWith method that receives a StringToken was doing a bounds
check on the wrong parameter. This caused most calls to return false.
This commit adds some tests to both versions of StringVector::startsWith.
Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: Icd4c648d681723ac66dba3c6a42ab7920850c619
Using mobile device, created traces for text document, Spreadsheet and Impress files in real editing sessions
Signed-off-by: Nnamani Ezinne Martina <nnamani.ezinne@collabora.com>
Change-Id: Ie1afa80b87963999a5a3520d67fb411624b7fdc9
Created traces for text document, Spreadsheet and Impress files using real editing sessions
Signed-off-by: Nnamani Ezinne Martina <nnamani.ezinne@collabora.com>
Change-Id: I99e290b1cc9c2d14e1341a211190d7d2a64b2ea4
test/lokassert.hpp:16:22: note: 'operator<<' should be declared prior to the call site
Change-Id: I7533490e64b1181b3349d0966b42eba4dcc88f05
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
This adds a new service render-search-result, which renders an
image of the position where, the search fund a hit. The search
result contains the information in which object or paragraph,
which is just the node id and node type from the document model.
The service takes the document and the search result (xml file)
as the input and returns a PNG image as the output.
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Iffc158c5b0a3c9a63f8d05830314c9bc1616b3b1
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
This can happen on an assertion failure, and causes noise while looking
for real memory errors.
Also disable an unstable test, it's not clear that it passes depending
on how loaded the machine is (just increasing timeouts doesn't seem to
help).
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I049bd0a06f41e2d43702ec12a2c35944bc5200d8
So it can be easy to analyze the backtrace of the
failing assertion.
Change-Id: Icdcf55b1404f858eba1d499bd65719a0e2da21db
Signed-off-by: Henry Castro <hcastro@collabora.com>
Otherwise the unit test will take too much time
to fail.
Change-Id: I9a85a79ad2ced5d220394cdf71a7f703265e50ef
Signed-off-by: Henry Castro <hcastro@collabora.com>
if make is killed or interrupted during the execution
of their recipes, the target is not deleted. So there is
an opportunity to check the logs, why are taking to long
time to finish the test.
Change-Id: I6e8176a48ff721ecb2b2efc01b1f149907dd359b
Signed-off-by: Henry Castro <hcastro@collabora.com>
At least I didn't fully understand what the old code actually was
checking.
Also, use sizeof instead of magic numbers.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I01602a2e256b1fbe39793c9f1439e025461c5a72
Our JS code does not send 'textinput' messages with a 'type' parameter
either, so it is pointless to do it in a unit test.
(We still have code that checks for the 'type' parameter in received
'textinput' messages. That is pointless, too, and should be removed.)
Also, document what testWriterTyping() apparently is doing.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I4954379339f14e4a310a76788521001048d84e37
remember correct URI so all the following communication
(eg. downloading the file, upload) will be performed on new location.
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: Id14c5209eb1d9ffc7c24d7e02f0c7c32a60568b7
With some loadbalancers it may happen that HTTP 302 Found
response with redirect location will appear.
Change-Id: I7bac807761423adcd827cf775bd1d3d2ba87a6cc
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Write to the Trace Event JSON file in just one place, protected by a
mutex.
Handle metadata events separately. We want them to propagate to the
output if Event Trace generation is just enabled, regardless whether
it has been turned on or not.
We can send the metadata for the Kit process only after we have opened
the docuemnt as sending a Trace Event to WSD uses the (singleton)
Document object in Kit.
Introduce some new functions for the above and adapt callers
appropriately.
Generate a Complete event for the handling of one image tile, from
setting the src attribute of the Image object to finishing the onload
function.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5978e0fb2495e0d2dc479bf861eb4ac7da03fa50
Move the generic dummy implementation of
TraceEvent::emitOneRecording() to a source file of its own. (That is
the one which is used in test and tool executables.)
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I81cab07e5a6852b42d278a5446c13c3825cf546e
This adds a test case for modifying the document after
the previous upload failed and verifying that the
subsequent save also uploads the modified document.
Change-Id: I05e17842399f9af48a029fdde72ce15c023bee3f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Tests uploading on document closing when
the previous upload had failed.
Change-Id: Iceeed041bd4e84ba8096be245b4fce1af496eb8f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Using for fuzzing and integration testing.
With unit-tests.
Change-Id: I23f8c619e239310d92c74c4d5e4157afb52a5e56
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Modelled on how it is done in core. ProfileZone is derived from
NamedEvent which is derived from TraceEvent. Here we don't keep any
separate ProfileZone.hpp, though.
This was needed to introduce generation of "instant" events here, too.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6583134e96001641c50339deb4197fca6ab7d5d5
Don't bother collecting them into a vector, like in core. Instead,
just call a static member function ProfileZone::addOneRecording() for
each Event Trace object (string) to be emitted. That function then
needs to be implemented separately in each executable. In WSD it logs
the object to the Event Trace file. In Kit it sends it to WSD for
logging. In Unit tests we use a dummy implementation.
(If Event Trace logging is not enabled at all in loolwsd.xml (the
default), nothing is done, of course.)
When receiving the "traceeventrecording start" or "traceeventrecording
stop" message from the client, turn ProfileZone recoring on or off in
the WSD and Kit process. (Probably in WSD the flag should be
per-client.)
Change-Id: Ie1127d65dd44ed77e7eeab4b0f0a90cce95dc4a2
Signed-off-by: Tor Lillqvist <tml@collabora.com>