Commit graph

96 commits

Author SHA1 Message Date
Miklos Vajna
b148f15f40 test: fix sanitizers detection
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
2021-11-09 08:23:45 +01:00
Miklos Vajna
f67b8901dd test: double the timeout in isDocumentLoaded() for sanitizers
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I8627f16fb7ad67561312d3053d855bab8008ab75
2021-11-03 17:19:34 +01:00
Miklos Vajna
11adfc6f05 test: log timeout limit when the document fails to load
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
2021-11-02 11:25:59 +01:00
Miklos Vajna
f1de84a230 test: increase timeout in isDocumentLoaded()
https://cpci.cbg.collabora.co.uk:8080/job/online-master-sanitizer/2513/console
and in general
https://cpci.cbg.collabora.co.uk:8080/job/online-master-sanitizer/
regularly fails with a timeout, allow it to actually catch real badness.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic3862bc44d507afd34903be87f1019fc6d0e4b58
2021-10-12 11:13:26 +02:00
Michael Meeks
b043b6213d Move LOOLWebSocket into test/ - where it can be slowly removed.
Change-Id: I388690261d323377648a1502b927e73f862ad802
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Ashod Nakashian
347fd43f7c wsd: chunked transfer and tests
Change-Id: I07f7f126891f4d6b5137b45bf91cbcaa11796cda
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 866cb8f2f25e958f834adc51e2191fb60e2e85b9)
2021-09-26 17:02:01 -04:00
Ashod Nakashian
5a310a2232 wsd: separate client SSL context from the server
Change-Id: I4d86f733a16e6c76340b18ff836831ebe6acfd4d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-06-23 23:39:34 -04:00
Michael Meeks
783ccd97b1 Avoid 'DEL' in random strings.
Change-Id: I5385dfd2c7cf7b7638e11191c5320d0bc4e04a48
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-06-22 11:02:46 +01:00
Ashod Nakashian
17cdf3766d wsd: test: improve the stability of UnitCopyPaste
The .uno:Copy command has to get executed before
we can read the clipboard. Since .uno commands
are executed asynchronously, it possible to
invoke getClipboard before having the data
copied into it, thereby failing the test.

Here we wait for the first sign that the
.uno commands have been executed, although
we can't know if they have finished or not.

This improves the test reliability significantly.

Change-Id: I7da1e4a32092c05dfb533571ea50d5edbc07f554
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
5f6a717b8b wsd: test: simplify and reuse some helpers
Change-Id: I652a77523559f1dd123b56e1a776a8fc64a96bda
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
1159286fb2 wsd: test: killpoco in TileCacheTests
TileCacheTests now completely uses
async WebSockets. It is both more
stable and faster (by about 20-25%).

Change-Id: I6da0fd12ddf671a7ad666561249b6fb1c5d32a01
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
b47c81e7a8 wsd: improved WebSocketSession interface
SocketPoll is captured as weak_ptr into
WebSocketSession and a much better shutdown
support is now available. The new logic
can do async-shutdown after flushing and
will do sync-shutdown if SocketPoll is
no longer around.

Change-Id: Ia206cab58a13f20f7aeb3a6d8c57afee731c8231
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
358b30a682 wsd: test: fully enable loopback testing of http
Change-Id: Ia54f80bd76b2b7188608dd8df7947139564255dd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Miklos Vajna
e56e8ec30c test: tolerate missing minor core version
ProductVersion used to be "6.4" with core.git distro/collabora/cp-6.4,
but core.git distro/collabora/co-2021 sets it to just "2021".

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I08c1204c42bba21c8036975138e3d999b7357bdf
2021-04-19 11:20:45 +02:00
Ashod Nakashian
bf64465b4e wsd: test: killpoco in tile cache test
Change-Id: I0ad05b5b496c8b184b3bc4bd9c7b9e7167e26fc3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-12 09:06:38 -04:00
Ashod Nakashian
ad52aea7ba wsd: test: killpoco in crashtest
Change-Id: Iad87dcb6c25271df75a5b397bb94bb1aecfc7d38
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-12 09:06:38 -04:00
Ashod Nakashian
4333845728 wsd: test: killpoco in httpwstest
Change-Id: Ief228862d882ae96650708e30442693cc127f0c9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-12 09:06:38 -04:00
Ashod Nakashian
7a997afb5a wsd: test: WebSocketSession helper
Change-Id: I472282af94797ac59c6752bfd784c72012bec84f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-11 18:43:36 -04:00
Ashod Nakashian
da28578087 wsd: test: fixup helpers
Change-Id: I0ab30977bc7bf6556665c41a92d7dd586d519e50
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-11 18:43:36 -04:00
Ashod Nakashian
3a07b60b40 wsd: test: helpers for http::WebSocketSession in tests
Change-Id: I4c34add289160b3ff9af9f0f3d8cddecfffd1031
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-11 01:05:20 -04:00
Miklos Vajna
f38e0db765 test helpers: fix -Werror,-Wreturn-type
./test/helpers.hpp:211:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]

Perhaps it could go further and even call LOK_ASSERT_FAIL().

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I4f68f6d290bcb0a832ea71153d5f699d5366def9
2021-04-07 10:27:07 +02:00
Ashod Nakashian
8638970918 wsd: test: retry poco requests and check body
Change-Id: I42c59208f5df8cba039f8fe96e134787ab5a1ca0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-03 19:57:03 -04:00
Ashod Nakashian
f3b151132c wsd: test: use chrono for readable and safe time durations
Change-Id: I0e1b380af4cff8e364564d287c8291b206622f38
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
c00dce5a2e wsd: test: log connection security
Change-Id: Iaa81fa33dbbf5d82cdbb95ab39e6e5dbd6ef7104
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Ashod Nakashian
a1761c880f wsd: test: use config to decide what URI to use in tests
With this, tests use SSL connections not just based
on the build settings (and whether or not config.h
is included in the test translation-unit), but also
based on the actual config, which can be changed
by the test in question.

Change-Id: I6cce5949e7785cee481fdc805a1804df6fdd8b8d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 12:43:39 -04:00
Ashod Nakashian
72e2b1ac9a wsd: http: better test assertions
Change-Id: Ifccbc6f7a85515ca1d372755df28409fa5d7a26b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-16 08:27:46 -04:00
Ashod Nakashian
96f542a3be wsd: resuable http test helpers
Change-Id: Ib3419ad221bf957fb04d1a8112a2b1dc2ea549bd
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-11 09:15:40 -05:00
Ashod Nakashian
c215f203dd wsd: test: use unique_ptr
Change-Id: Ia00d90d83ad35de56b2563e80b20b575325b5745
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-11 09:15:40 -05:00
Ashod Nakashian
95bb52d945 wsd: test: better logging
Change-Id: I3d17afb2e76f1d4b2b27182a6419482801342e8c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-08 22:49:53 -05:00
Ashod Nakashian
a533627b5a wsd: test: improved logging
Change-Id: Iac80450cd88997572727ffe30e0b26737df96f46
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-03-08 22:49:53 -05:00
Ashod Nakashian
42f5ceae42 wsd: test: improvements
This reduces the execution time of some
long-running tests and improves stability.

A full debug build of Core and Online
now finishes on my machine in under 3 minutes,
down from slightly over 4 minutes. A significant
saving when running the tests frequently and
repeatedly.

Change-Id: I66c1b06ec3c9e8ab90a30f3a15c03f8d560ed3c6
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-01-23 23:55:43 +00:00
Miklos Vajna
ee37bd9c05 test: avoid garbage at the end of the message in getErrorCode()
'bytes' can be smaller than the size of the buffer, so go with that size
instead.

Change-Id: I025b56379ee449fe33710b660d845fa2dd0865ee
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
2021-01-04 15:46:39 +01:00
Ashod Nakashian
2edbf1c5e1 wsd: test: check if a WS Close Frame message exists
The text message in the WS Close Frame is optional.
Here we actually copy the remaining data after parsing
the status code, not assuming it exists or that the
status code was exactly 2 bytes (although in a well-
behaving WS implementation it always will be 2 bytes).

Also, no good reason to wait a full second between
socket reads in getErrorCode. However a small sleep
seems sensible to avoid logging "got 0 bytes" or so.

Change-Id: I162dfb0dd3ebf615a3e8e237006883388b9ff494
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Ashod Nakashian
7972ded44f wsd: test: log test assertions
Change-Id: Ibf9274b1812f70f54ccd4e7be991b08a11f36c86
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Ashod Nakashian
b4d9e1f413 wsd: test: use chrono types
Change-Id: Iec7f64a122126ae82af3bf16719081ea4ee645f3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Ashod Nakashian
9bbd273e91 wsd: test: leverage the log system in TST_LOG
This moves the test log macros into a new home,
test/testlog.hpp, to avoid cycling dependencies.

Change-Id: Iacb80e813a64ff830fa18f63ec4de2535ee702b7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-12-28 12:04:53 -04:00
Ashod Nakashian
f665816812 wsd: getTempFilePath -> getTempFileCopyPath
These helpers are for testing only. They should
ideally be moved to the test helpers, but because
of dependency on the FileDeleter in FileUtil they
remain in FileUtil.

Change-Id: I93c7e08823edec8f6a53419f0a6596f3255f23f9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2020-11-22 22:26:36 -05:00
Andras Timar
0002fdfd6c fix license headers
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
2020-10-01 11:56:43 +02:00
gokaysatir
1951fdbd42 lool: php proxy simulation.
Change-Id: I5ea5515e317242f2ad2abd3209ce0241d64b631b
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97820
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2020-09-09 15:50:10 +02:00
Ashod Nakashian
223a1d08f0 wsd: performance-unnecessary-value-param
Change-Id: I1eb092c676da8600e0f8ed70cbc7e1f37fdd5a02
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95338
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-06-02 20:01:29 +02:00
Ashod Nakashian
d2d0492245 wsd: move LOOLProtocol::tokenize to Util::tokenize
The tokenizer(s) are more generic than the protocol
logic, and are used from contexts that don't involve
the protocol as such.

Change-Id: Ie8c256bf11a91e466bff794021f41603c9596a7f
2020-06-02 18:03:36 +01:00
Ashod Nakashian
224ef08c7f wsd: single-char string literals -> char
More readable and typically more efficient.

Change-Id: I9bd5bfc91f4ac255bb8ae0987708fb8b56b398f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95285
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-06-02 01:31:26 +02:00
Michael Meeks
7fe1d60b95 Use https sessions for wss:// as well as https://
Change-Id: I1b3f193a51b538c423589276b4ae61ba760b241e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93595
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-05-07 13:15:01 +02:00
Michael Meeks
3e4ac31c7c killpoco: remove WebSocket includes from a couple of places.
Change-Id: I06740cd978bec8e6a74beb8ed9ef8f4f970a2535
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92470
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-18 18:29:04 +02:00
Tor Lillqvist
4eb598711c Use #pragma once
LibreOffice core uses that, too, and we support an even more
restricted set of compilers.

Change-Id: I0d0e2c8608e323eb5ef0f35ee8c46d02ab49a745
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92467
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-18 15:00:18 +02:00
Michael Meeks
5710c86323 Poll - switch to ppoll for closer to microsecond accuracy.
Change-Id: Ib8a2bb6f60302df8631edadbbb8db626894c457c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92000
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 10:06:23 +02:00
Miklos Vajna
a83dd9a160 test: increase load timeout in UnitLoadTorture
This test sometimes failed on me just because the load was aborted due
to the timeout, doubling the limit makes the problem go away.

Change-Id: Ided724d67a513391b86836065d4e627581857a92
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90771
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-20 10:47:59 +01:00
Ashod Nakashian
82560d9657 wsd: test assertion macros
Because the new-style tests are intrustive,
the exception that CppUnit throws on assertion
failures is caught and processed with the
application logic, which is far from ideal,
because it's very difficult to find the
cause of failure.

What we'd like is a way to control what happens
when an test assertion fails, such that we can
properly log/print the failure, and even break
in the debugger.

The new macros allow us to control the behavior
at compile-time and have added flexibility.
For now, they log an assertion failure before
invoking the CPPUNIT macro, and support a
compile-time directive to assert, which is
useful for breaking in the debugger.

Change-Id: If464ba246e3ec747f31496a4215cb73ef735dfaf
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-03-14 15:45:00 +01:00
Miklos Vajna
b8bd1990aa Rework LOOLProtocol::tokenize() to return a StringVector object
The bulk of this commit just changes std::vector<std::string> to
StringVector when we deal with tokens from a websocket message.

The less boring part of it is the new StringVector class, which is a
wrapper around std::vector<std::string>, and provides the same API,
except that operator[] returns a string, not a string&, and this allows
returning an empty string in case that prevents reading past the end of
the underlying array.

This means in case client code forgets to check size() before invoking
operator[], we don't crash. (See the ~3 previous commits which fixed
such crashes.)

Later the ctor could be changed to take a single underlying string to
avoid lots of tiny allocations, that's not yet done in this commit.

Change-Id: I8a6082143a8ac0b65824f574b32104d7889c184f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89687
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-02-28 16:07:56 +01:00
Ashod Nakashian
c742ca1011 wsd: improve test logging
Logs from test are now more atomic (less interleaving).
And each integration-test (old-style tests running from
new-style tests) will now print clearly when it begins
and when it fails, making it easier to find failures.
Misc other minor cleanups in test logging.

Change-Id: Iff664e42a04d1c6dbf1332b2884c35183ef85e21
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89309
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-02-23 22:04:04 +01:00