Commit graph

44 commits

Author SHA1 Message Date
Caolán McNamara
aebb43f48d set 'make run' to default to using mount namespaces
which don't use coolmount and coolforkit, but instead use linux
mount spaces with coolforkitns instead.

That doesn't need sudo, so drop automatically calling that in
make to setcaps on coolmount + coolforkit for an easier developer
experience.

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I6f8ddaf1053d084ec8c1f22adf830a677e80cadc
2024-07-18 09:54:06 +02:00
Caolán McNamara
9dd558ed56 fix UnitWOPISaveOnExit test with mount namespaces enabled
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8f6ac58b064ecff8a74a694736fd85c627be0a27
2024-07-16 07:09:42 +02:00
Caolán McNamara
6e73f37a7c disable mount_namespaces for tests for now
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I535ddda2a8c68f57a5f9372e6d452c8a0de63ef2
2024-07-16 07:09:42 +02:00
Miklos Vajna
fb82bcb8b5 test: avoid showing too large files
If it's this large, it will be some endless loop and the start will go
outside the console history anyway, but it can fill the disk with logs on
CI.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I89f9cc1afb6436210d825f1f60cbccb8ed5e48b3
2024-06-21 08:59:10 +01:00
Ashod Nakashian
6de46d746e wsd: test: better run_unit.sh
Unfotunately, if our custom test driver run_unit.sh
fails, the report isn't generated at all.

So, instead, we have to go back to parsing the trs
file to detect success and failure.

We now make fast-fail an option instead.

Also fixes a typo in run_unit_standalone.sh.

Change-Id: I337c2a3edceda01df5f9c13c83eb176930b07e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 09:20:32 +02:00
Ashod Nakashian
2bf9665d45 wsd: test: enable experimental features in tests
Change-Id: Idc5b838d241e734af8b404dbf2052a69b376540d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 08:58:39 +02:00
Ashod Nakashian
4407ac9136 wsd: test: improved single-test runner
The test now runs as many times as requested
and doesn't stop on first failure. Instead,
it reports the number of passing vs failing
runs.

Also simplifies the detection of the test
result by using the exit code instead
of grepping the output file.

Change-Id: Ie458b2963411632d566cd87d2dfb9137044d2b4b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-09-25 08:58:39 +02:00
Ashod Nakashian
0f173cfa8c wsd: test: cleanup and cosmetics
Change-Id: I5c72922b1090c920710d3208ab42044b859336c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-06-27 14:07:08 +01:00
Ashod Nakashian
d1a1c7fb1c wsd: test: reduce output from the test driver
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>
2022-03-09 19:24:40 -05:00
Ashod Nakashian
015b088d79 wsd: test: minor improvements to run_unit.sh.in
* 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>
2022-03-09 19:24:40 -05:00
Ashod Nakashian
f8b05a0f83 wsd: support unattended runs
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>
2022-02-17 18:52:48 -05:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Andras Timar
4d8b974df9 loolwsd -> coolwsd in run_unit.sh.in
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ie266dafb8bbd267c1ed134af056cd1733d6c3d0a
2021-11-17 18:08:19 +03:00
Henry Castro
e22f8f92f3 test: run test with capabilities disabled
Otherwise the unit test will take too much time
to fail.

Change-Id: I9a85a79ad2ced5d220394cdf71a7f703265e50ef
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-07-22 11:52:26 -04:00
Ashod Nakashian
cb26329ae4 wsd: test: add the seconds suffix to the output
Change-Id: Ia5d30882224dce22dff66a34f79b25d25cc64348
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-05-02 22:35:39 -04:00
Ashod Nakashian
91ca2e9775 test: make run_unit.sh more helpful on failure
This improves the output on test failures and
makes it more consistent with the actual command
that failed.

Change-Id: I7f1bc90163e53efb0bd7cfb3a5892c7d4f0dad45
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-02 13:18:41 -04:00
Henry Castro
177fdf0330 test: run unit test with disabled capabilities
Change-Id: I78dbdcb1ec3d960b283016d86e95614a8cb0255c
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-02-26 11:13:47 -04: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
Ashod Nakashian
9a427524d1 wsd: support --cleanup in loolwsd
Leaving behind jails with bind-mount
entries makes build-workspace removal
complicated, and jenkins builds start failing.

The cleanup stage is integrated in Makefiles
and should be transparent.

In the event that manual cleanup is necessary,
'loolwsd --cleanup' can be invoked.

Change-Id: Ia4b99b0c66e56dfa2d50e79b0ba98f714cf32886
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97470
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 06:14:39 +02:00
Ashod Nakashian
5c9988f2e3 wsd: faster jail setup via bind-mount
loolmount now works and supports mounting and
unmounting, plus numerous improvements,
refactoring, logging, etc..  When enabled,
binding improves the jail setup time by anywhere
from 2x to orders of magnitude (in docker, f.e.).

A new config entry mount_jail_tree controls
whether mounting is used or the old method of
linking/copying of jail contents. It is set to
true by default and falls back to linking/copying.
A test mount is done when the setting is enabled,
and if mounting fails, it's disabled to avoid noise.

Temporarily disabled for unit-tests until we can
cleanup lingering mounts after Jenkins aborts our
build job. In a future patch we will have mount/jail
cleanup as part of make.

The network/system files in /etc that need frequent
refreshing are now updated in systemplate to make
their most recent version available in the jails.
These files can change during the course of loolwsd
lifetime, and are unlikely to be updated in
systemplate after installation at all. We link to
them in the systemplate/etc directory, and if that
fails, we copy them before forking each kit
instance to have the latest.

This reworks the approach used to bind-mount the
jails and the templates such that the total is
now down to only three mounts: systemplate, lo, tmp.

As now systemplate and lotemplate are shared, they
must be mounted as readonly, this means that user/
must now be moved into tmp/user/ which is writable.

The mount-points must be recursive, because we mount
lo/ within the mount-point of systemplate (which is
the root of the jail). But because we (re)bind
recursively, and because both systemplate and
lotemplate are mounted for each jails, we need to
make them unbindable, so they wouldn't multiply the
mount-points for each jails (an explosive growth!)
Contrarywise, we don't want the mount-points to
be shared, because we don't expect to add/remove
mounts after a jail is created.

The random temp directory is now created and set
correctly, plus many logging and other improvements.

Change-Id: Iae3fda5e876cf47d2cae6669a87b5b826a8748df
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92829
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-07-01 05:42:43 +02:00
Miklos Vajna
6add8295bf test: remove documentation about no longer working CPPUNIT_TEST_NAME variant
This is not needed, the commandline to run the test is printed on
failure.

Change-Id: Ia4da4344ede4ad8c1627a5560f1bc1264f4203c7
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87288
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-01-24 00:09:34 +01:00
Miklos Vajna
abe076e56d test: restore ability to just run a single unit test
This was removed in commit 0599db3576
(copyFile: de-poco-ize and handle EINTR and short writes., 2020-01-18),
probably by accident.

Change-Id: I36bed5851fbfa0c37a007bedb6f318aaf4d8c64a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87233
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Miklos Vajna <vmiklos@collabora.com>
2020-01-23 09:19:43 +01:00
Michael Meeks
8f91659ae0 test: dung out redundant LOOL_TEST_CLIENT_PORT.
And cleanup other related oddities.

Change-Id: I2d179a2ece6a8553e10e406ad4e5da08a2ff58e5
2020-01-21 15:07:54 +00:00
Michael Meeks
0599db3576 copyFile: de-poco-ize and handle EINTR and short writes.
Change-Id: I2046881c786a9f31f45c53f282de9ddd9a9cebcf
2020-01-21 15:07:54 +00: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
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
Michael Meeks
6338bf2032 test: add --gdb option to run_unit.sh
Change-Id: Iff253d95a1a611536fe5c1244c33471e77c77c81
2019-09-05 14:10:20 +01:00
Tor Lillqvist
199c6e2918 Revert "Get rid of use of GNU libtool" and its follow-up
The change causes problems for people on various sad distros. Oh well,
whatever.

This reverts commit bd00d9fd05.
This reverts commit 054a9cdb04.

Change-Id: Ie439e4c655d02b6f34bdd1a9c1c5b6db6048b653
2019-05-27 10:25:51 +03:00
Tor Lillqvist
bd00d9fd05 Get rid of use of GNU libtool
It is is complicated enough to build the iOS app. Requiring GNU
libtool brings with it the risk of polluting the command environment
as there already is a completely different command in macOS with the
same name, /usr/bin/libtool. And as GNU libtool was used only to build
the unit tests for the "normal" server-based Online that are built and
run only on Linux anyway, we don't really need any of the
"portability" that GNU libtool brings.

Without GNU libtool, we compile all the $(wsd_sources) (see
test/Makefile.am) that the unit-* tests use into a single object file,
WsdSources.o. (Because they need to be compiled as PIC we can't use
the already compiled object files for the Online server programs.)
This required some additional minor changes to a few source files.

Change-Id: I20a2c523170376fa4c1a0d9d8d6b693a9779376f
Reviewed-on: https://gerrit.libreoffice.org/72840
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2019-05-24 09:50:16 +02:00
Michael Meeks
2943d09669 test: encourage the test script to sleep for the debugger too.
Change-Id: I538b2d80f57ecc8a342a38a64864d16b9128a04f
Reviewed-on: https://gerrit.libreoffice.org/71804
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-05-04 23:53:38 +02:00
Tor Lillqvist
8f71365f0f Remove unnecessary leftovers after Michael's removal of the on-disk tile cache
Change-Id: I435679b48f90d2580bb9c5c86a26c9a1d43c5b59
Reviewed-on: https://gerrit.libreoffice.org/67885
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2019-02-15 21:36:16 +01:00
Andras Timar
bf0e286cc9 Use absolute path to load unitlibs
I had a scenario when they were not found (tinderbox).

Change-Id: I48f40b62f74a1ffbab64ad9a9b677f8cf66a1232
2018-06-15 08:34:06 +02:00
Andras Timar
04feab241f use local tile cache directory for tests
Change-Id: I4c66a45df93bee22131c5950029cffa863d397b0
Reviewed-on: https://gerrit.libreoffice.org/54028
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-05-09 15:29:28 +02:00
Michael Meeks
5aed7e0814 Unit test script - add help and simplify usage.
Change-Id: I4687f9a39b1abcf5be7e7848c32dfd32c39e7707
2017-09-15 17:58:10 +01:00
Michael Meeks
097cc58d53 Run old-style unit tests as a new-style unit test.
This moves the code into the same process, for easier logging & debugging.

Disabled initially.

Change-Id: Id48b5649ba14deb0a2159ca59e321c7d0ae66dad
2017-06-02 18:33:26 +01:00
Ashod Nakashian
9c14446c88 wsd: re-enable a couple more tests that are stable
Change-Id: I01bc96ce7bde7cac10d0b4d023b0d5dd774ed058
Reviewed-on: https://gerrit.libreoffice.org/36602
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-17 07:12:16 +02:00
Jan Holesovsky
c562471302 Write the failures we got during the test run.
Change-Id: I2c05b6f2c890b3a67824f1ca612fa7f4e05d994f
2017-04-07 15:37:20 +02:00
Ashod Nakashian
1ad4037dd7 wsd: allow for slow startup of LOK
Change-Id: Idf821f2a3638e76e1a8b169d5672a2059b00491c
Reviewed-on: https://gerrit.libreoffice.org/36118
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-05 04:48:00 +00:00
Michael Meeks
23bf026a63 old style unit tests: re-direct output to log file & add --verbose. 2017-04-03 21:50:09 +01:00
Andras Timar
2a64ae7bc0 use SSL certs from build dir in unit tests
Change-Id: If0bf245d8acb6873802c9054cb8bb30aa1005ad4
2017-03-28 08:51:14 +02:00
Andras Timar
738792d5ff use key.pem from source directory for unit tests 2017-02-28 22:54:03 +01:00
Michael Meeks
07d385630b Cleanup unit test output a little. 2016-12-08 17:47:21 +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/test/run_unit.sh.in (Browse further)