Commit graph

382 commits

Author SHA1 Message Date
Miklos Vajna
1bff9e7bf8 Convert load torture testcase to a new-style one
So that they are in-process, which means it's easier to debug when they
fail.

Change-Id: I6b33887fbe8dd6071ee767f24d4776a694fb62f7
2019-10-21 09:04:12 +02:00
Miklos Vajna
b97789eb76 Convert paste testcase to a new-style one
Change-Id: Ie4d8c2431bc12b94af83b802d4a627cbfb7a72e0
2019-10-18 09:06:53 +02:00
mert
a5000034cd Added normalizedViewId to the tests with tilemsg
Change-Id: I479246a2c592b7e4f50b613a0fb0f96af761198c
2019-10-15 18:13:03 +03:00
Miklos Vajna
bba5b1e7e4 test: don't validate ssl certificates while running unit tests
Which was the case before commit
5d57f5aef3 (storage.ssl.enable should be
in sync with ssl.enable by default, 2019-10-11), otherwise we fail to
connect to the test wsd, since its certificate is typically not trusted.

With this

	make check CPPUNIT_TEST_NAME="unit-copy-paste"

passes again.

Change-Id: If3a8a293831313e74eacc1cbc092922d2c72f08c
2019-10-14 10:04:36 +02:00
Andras Timar
d1ae1b36c2 typo fixes in comments and code
Change-Id: Idd98516d30d98dea18eda9bbec8ac9777063b553
2019-10-08 11:49:45 +02:00
Andras Timar
2835fbd845 typo: randonly -> randomly
Change-Id: I07b5a322ec3d8f149b2e4a45588bfedfcd28da37
2019-10-08 10:42:23 +02:00
Andras Timar
db176ee45b Remove lo_template_path option
It was not very useful to let this setting configurable by the user.
On the other hand, old path in config file caused issues after
upgrade. It is better to decide the location of LOKit core
during compilation. From now on the --with-lo-path configure
option is compulsory.

Change-Id: Icdcbc21bde5dad329fdb6e30ed17efde6b0e73de
Reviewed-on: https://gerrit.libreoffice.org/79943
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2019-10-08 09:36:44 +02:00
Miklos Vajna
a6eff7ed2d Convert large paste testcase to a new-style one
And fix run_unit.sh to to do the quoting properly, so -la does not match
the \.la pattern.

Change-Id: I6fd81166abc43f87d82123c104ee4e74238bd714
2019-10-08 08:51:03 +02:00
Tamás Zolnai
10a0ee1cfe Fix up TileCacheTests::testTileInvalidateWriterPage() test
The part number in case of writer has no actual meaning, since
for writer we have only one part (the whole document).
It seems the code is not consistent in that it is 0 or 1.

Change-Id: I9e56079f7861f7e0d5794e6f711045cd9448dfa7
Reviewed-on: https://gerrit.libreoffice.org/79851
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2019-10-01 13:03:31 +02:00
DarkByt31
ef90709ad1 tdf#107038 Poco::Timestamp replacement with std::chrono
Change-Id: I55ba23fb104a90c882bc2af068b835e30877bc1e
Reviewed-on: https://gerrit.libreoffice.org/78925
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-09-28 12:51:18 +02:00
DarkByt31
dd014e7029 tdf#107038 Poco::Timestamp replacement with std::chrono
Util added getHttpTime
WhiteBoxTests added test for getHttpTime

Change-Id: Ifb6a3fb2dc9b059b925e7b881362b72759a8b56b
Reviewed-on: https://gerrit.libreoffice.org/79754
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-09-28 12:26:32 +02:00
Ashod Nakashian
45a7dccbf8 wsd: test: don't leak the test listener
Change-Id: Ibc658ff68696f865071a4ef0c78e1886d8bf0d2c
Reviewed-on: https://gerrit.libreoffice.org/79353
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:25:28 +02:00
Ashod Nakashian
3c52aff8cf wsd: test: support test command-line args in any order
No longer is it necessary to run with --verbose
in case we need --debugrun.

Also, by default the log level is now warning instead
of error, which should hopefully be more useful in
troubleshooting issues (or at least to force us
better categorize log messages).

Change-Id: Iad4279ecf3bf77780adcd786d4f46d9c964f302d
Reviewed-on: https://gerrit.libreoffice.org/79351
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:23:49 +02:00
Ashod Nakashian
720c26176a wsd: improved kit thread naming
Now the wsd docbroker thread and its peer kit
thread are trivial to match, since they are called
docbroker_xxx and kitbroker_xxx (where xxx is the
instance ID) respectively.

Also, label spare kit instances as kit_spare_xxx
to differentiate from ones with actual documents,
where xxx is a running counter to differentiate
spare instances from one another.

Now we are able to easily see (and count) the number
of spare kit instances, and match wsd and kit threads
handling a given document.

Unit-test logic updated to reflect the new thread
naming scheme.

Change-Id: I154dc8f200fbe0e65f3f5984e6dad2cef1b52e22
Reviewed-on: https://gerrit.libreoffice.org/79328
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:23:27 +02:00
Miklos Vajna
7f98a61367 UnitTiffLoad: remove not needed config.h include
And also others, pointed out by IWYU.

Finally, it's not needed to force-enable HTTPS after all, it seems.

Change-Id: I4d9984d2485b1519bd5a9cc44834735e09a87058
2019-09-16 09:06:38 +02:00
Miklos Vajna
08f5d74f63 Convert TIFF load testcase to a new-style one
This was originally added in commit
c2c7982e5e (Add TIFF load testcase,
2019-07-04), and still fails without the core.git fix.

Change-Id: I798b82ea8212dfeafc162e4b73f6fff707ac3de2
2019-09-12 23:10:04 +02:00
Miklos Vajna
24615d9dd0 test: avoid writing to cerr directly in TileCacheTests
So that we always know which line comes from which test, to make the
output more readable.

Change-Id: Icabfb45b719daf733fb4cff99f364a574cbdb65d
2019-09-12 23:09:54 +02:00
Miklos Vajna
e310e76cfc test: fix memory leak
==18134==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x514db8 in operator new(unsigned long) /git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_new_delete.cc:105
    #1 0x9f836c in runClientTests(bool, bool) /git/libreoffice/online-san/test/test.cpp:113:28
    #2 0x9f7975 in main /git/libreoffice/online-san/test/test.cpp:77:12

Change-Id: Ib93625e2a77e37733b9bb052dd73ec3333bc2a71
2019-09-12 11:43:49 +02:00
Tomaž Vajngerl
0189fb10fb fix HTTPWSTest::testInactiveClient test failure
Change-Id: I0974e289ecb48354fbc038dafe92b74da38fb25c
2019-09-07 19:15:09 +02:00
Andras Timar
69140fcdbb CPPUNIT_ASSERT_GREATEREQUAL is not available in cppunit of older distros
Change-Id: I37001791e05df9a55c25b48fff3bbe5d6bd050e2
2019-09-05 23:02:18 +02:00
Michael Meeks
6338bf2032 test: add --gdb option to run_unit.sh
Change-Id: Iff253d95a1a611536fe5c1244c33471e77c77c81
2019-09-05 14:10:20 +01:00
Michael Meeks
81aa1a0782 test: print out the correct way to run all-local test.
Change-Id: I2a9a90beff7b2dc689dc2de7df86404018b514fb
2019-09-05 14:10:20 +01:00
DarkByt31
d24071e91b WhiteBoxTests: testTime corrections
Change-Id: Ia73a69396ba12921370fa12b57c249593c36e3d8
2019-09-04 22:09:50 +01:00
Ashod Nakashian
8f312862ca leaflet: fire Doc_ModifiedStatus with modified state of the document
When .uno:ModifiedStatus is received, now Doc_ModifiedStatus
is fired to inform the client of the modified state of the document.

This is useful in case the integration needs to prompt the user to save
before closing the document (which they can catch with the onunload or
onbeforeunload events in the browser, as well as with our
UI_Close when the default handler is disabled).

Includes working sample and documentation.

Change-Id: Ief30483e2f078b0aa9f3c006a1ecb4093375174c
Reviewed-on: https://gerrit.libreoffice.org/74891
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2019-09-03 01:53:12 -04:00
Ashod Nakashian
df6cc01c32 leaflet: support disabling default action
Clients often need to handle certain commands themselves.
This is especially true for Action_Save and Action_Close.

A new postMessage command, Disable_Default_UIAction, is
now available to support disabling/enabling the default
action for certain commands (as of this patch, only
Action_Save and Action_Close are supported).

The actions in question issue a notification and,
when the default handler is disabled, the client
is expected to handle the notification for which
they disabled the default handler and act as necessary.

See reference.html for more details.

Change-Id: Ia6ce4e2d7578f79cc2069097e0b968e6c4aeabd1
Reviewed-on: https://gerrit.libreoffice.org/74136
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2019-09-03 01:53:12 -04:00
DarkByt31
22f1656e08 tdf#107038 Poco::Timestamp replacement with std::chrono
Added functions to get file timestamp and to convert
chrono timestamp in ISO8601 fraction format and some
test cases.

Change-Id: I58961a31f7262b367cff9f33cffdec7571a2f8f7
2019-09-02 15:50:37 -04:00
Miklos Vajna
51b8ed7309 Try to avoid a timing problem in HTTPCrashTest::testRecoverAfterKitCrash()
In case we fail to open the document, try again in 2 seconds (same value
as in HTTPServerTest::testConvertTo()). This seems to be needed fore
core.git dbgutil builds, but don't do that unconditionally, in case the
sleep is not needed for optimized core.git.

Change-Id: I4585d1f273bfa5fffc4b02bc6107f27a2c9e1280
2019-08-30 12:22:11 +02:00
Miklos Vajna
38e06bf94e test: add --debugrun switch
Normally we use getgrp() to find out which lool* processes are ours when
running 'make check', to support running multiple of these in parallel.

However, in case you try to debug a failure, it's handy to start loolwsd
manually and invoke ./test manually in two different shells.

So add a switch which allows this: the result is that the failing test
doesn't fail early in an uninteresting way (complaining that it can't
find any loolkit processes) but fails the same way as during 'make
check'.

Let's call this --debugrun, since core has similar
gb_UITest_DEBUGRUN/gb_JunitTest_DEBUGRUN switches, which also allow
connecting to an already running "main" process.

Change-Id: Ic7e29eb143ae70f199ef3a09ec9d6b6f8ee0650d
2019-08-29 09:00:16 +02:00
Michael Meeks
327869fffe re-factor childsession onLoad callback to cleanup parameter clutter.
Change-Id: I0665db05845a910abf1cc56e13d2f9845cc5c373
2019-08-26 16:29:12 -04:00
Miklos Vajna
7bad7d2076 Try to avoid connection refused error in HTTPServerTest::testConvertTo()
In case we fail to send the request, try again in 2 seconds (same value
as the session timeout) before giving up. This seems to be needed for
core.git dbgutil builds; but don't do that unconditionally, in case the
sleep is not needed for optimized core.git.

Change-Id: Ie9ad8c066b7988ca37729f797c4b8dbb0ae2cbd6
2019-08-23 08:36:27 +02:00
Miklos Vajna
1b27ed045d Fix TileCacheTests::testClientPartImpress()
After commit 8e118889cb (wsd: leaflet:
support statusupdate: messages to sync clients, 2019-08-17), which added
a new hiddenparts= key, but forgot to adapt tests accordingly.

Change-Id: Ia5baefff37b88f5b173d65ae80a126f94b420cb0
2019-08-22 09:06:02 +02:00
Ashod Nakashian
d45ecd586c wsd: leaflet: track multi-selection
Change-Id: I17c092e950fb4d7a0cb4129c537d60a8e5edd06a
Reviewed-on: https://gerrit.libreoffice.org/69636
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71100
2019-08-17 04:41:36 +02:00
Ashod Nakashian
919a93cd4b wsd: improved anonymization algorithm
Better hashing algorithm based on FNV-1a.
Adds support for salting the hash, and
for providing salt via configuration.

More unit-tests added, and better formatting.

Change-Id: I2be42675d0cdbaa73c3d7faed99e07631a9c20fc
Reviewed-on: https://gerrit.libreoffice.org/70034
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/71091
2019-08-17 04:26:35 +02:00
Miklos Vajna
d0db456dc3 test: avoid ODR violation in UnitCopyPaste
As far as I understand, it is not necessary to link symbols of the wsd
process into unit-copy-paste.so, since we link it with the -module
libtool flag and then load it using dlopen, see
<https://www.gnu.org/software/libtool/manual/html_node/Building-modules.html#Building-modules>.

It seems this is the only test that links ${test_base_source}.

This fixes the following ODR violation:

==18174==ERROR: AddressSanitizer: odr-violation (0x000002090b20):
  [1] size=40 'SigHandlerTrap' ../common/SigUtil.cpp:76:12
  [2] size=40 'SigHandlerTrap' common/SigUtil.cpp:76:12
These globals were registered at these points:
  [1]:
    #0 0x5f9a68 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f60335f1e4b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ae4b)

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

Change-Id: Ic990a1885777e198e59cbc85156c7e5231bac524
2019-08-14 09:05:23 +02:00
Miklos Vajna
59c9f70c1f test: avoid UB in unit-wopi
==16414==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address 0x7f81f8df5510 at pc 0x0000005eb5a4 bp 0x7f81f8df54b0 sp 0x7f81f8df4c60
READ of size 23 at 0x7f81f8df5510 thread T3 (websrv_poll)
    #0 0x5eb5a3 in __interceptor_strlen.part.34 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:365
    #1 0x7f8201d22e47 in std::char_traits<char>::length(char const*) /home/vmiklos/git/libreoffice/lode/packages/gccbuild/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/char_traits.h:320
    #2 0x7f8201d22e47 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) /home/vmiklos/git/libreoffice/lode/packages/gccbuild/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:511
    #3 0x7f81fcaa59c3 in WopiTestServer::handleHttpRequest(Poco::Net::HTTPRequest const&, Poco::MemoryInputStream&, std::shared_ptr<StreamSocket>&) /home/vmiklos/git/libreoffice/online-san/test/./WopiTestServer.hpp:237:28

Problem was that the test code assumed a 0-terminated buffer, but that
was not the reality. So specify the buffer size explicitly.

Change-Id: I9a9edfe5623a1136aa77c381d1d3d8b8e1ca2258
2019-08-07 09:11:09 +02:00
Michael Meeks
9e791fb0d4 clipboard: persist selections for a while after a view closes.
re-factor ClientSession state to be a simpler state machine.
Have a nice disconnect / disconnected handshake on view close.

Change-Id: Ie933cc5c7dfab46c66f4d38a4d75c459aa1cff87
2019-08-05 22:21:54 -04:00
Michael Meeks
b3415abea0 clipboard: test two separate views' clipboards.
Change-Id: Ie6f2eeb1f1dd3c762cca847f4c77a5cd7d39f70a
2019-08-05 21:36:49 -04:00
Michael Meeks
095edb28e2 Adapt to new 'getClipboard' API - works on clipboard not selection.
Vital for a working 'cut'.

Change-Id: I980a4d65ef14eb922343d1d321177a9b3e1629f3
2019-08-05 21:28:09 -04:00
Michael Meeks
13469e8b00 clipboard - set it with a post now.
Change-Id: I6b9234988185984335408da502f479ccda8a95a7
2019-08-05 21:18:44 -04:00
Michael Meeks
15af6cf042 clipboard: test for set-clipboard endpoint (disabled).
Change-Id: I3bc31dfb231aaacc01ddd717b39abdebd26a76bb
2019-08-05 21:18:36 -04:00
Michael Meeks
4347883c65 clipboard: add more unit tests.
Change-Id: Id1841935927e451e6aa15489c303dd9f01ac21b4
2019-08-05 21:18:31 -04:00
Michael Meeks
149b861975 clipboard: a more helpful calc test.
Change-Id: Ibe0e583a2019e7bc5968dd8f73cf4e4a07d363b2
2019-08-05 21:18:27 -04:00
Michael Meeks
ba4907b791 clipboard: factor out parsing, and add checks in unit test.
Change-Id: I8c23b10769293b07cc94fdc0d6110e9d540a16b9
2019-08-05 21:18:20 -04:00
Michael Meeks
9726ce6f77 Various copy/paste fixes, unit test passing, parsing of result.
Change-Id: I9168853dd011e86896c3bd474a4d05ee82c0e336
2019-08-05 21:18:12 -04:00
Michael Meeks
c7956349f6 More work getting the unit test closer to passing.
Change-Id: If2ec0d5465a84e11dec1f5c5b9839a369b393784
2019-08-05 21:16:37 -04:00
Michael Meeks
245e509413 clipboard: start of rotating clipboard key management.
Change-Id: I8caab267ec5391e2cd7cb20907fa080111cc70dd
2019-08-05 21:16:37 -04:00
Michael Meeks
c36da1cd97 Implement getClipboard and start of a unit test.
includes Change-Id: I47d38f9285c855dcc6fbeeb73d35f22a46a30c05

Change-Id: I60b84bef1cf832ec5c191d664afd90a080b7ffbc
2019-08-05 20:25:49 -04:00
Miklos Vajna
003c98ff93 fakesockettest: respect CPPUNIT_TEST_NAME
This was running unconditionally.

Change-Id: I3de4241230d0f06f7836756e2d9b7fdf84d3477f
2019-08-02 09:57:20 +02:00
Miklos Vajna
773080eb74 Fix failing HTTPWSTest::testInactiveClient()
It seems to me that in this case the test was poor, if other
invalidation types are expected, then this one should be fine, too.

Change-Id: Iae7597eef081acdfb5d6f9152747204a71bd2b66
2019-08-02 09:35:20 +02:00
Jan Holesovsky
635f0627f2 Fix build.
Change-Id: I3e7dc00a8acdaf0ad1a07c0cd55ff7bff7b64295
2019-07-25 07:58:19 +02:00