Commit Graph

31 Commits

Author SHA1 Message Date
Alexander Larsson
237d91e1da Bump version to 0.9.98.1 2017-09-26 22:25:10 +02:00
Simon McVittie
f8e5c200bc tests: Use a more realistic bwrap invocation to check for support
The kernel used on some autobuilders for the Debian PA-RISC port
can do "bwrap --ro-bind / / /bin/true", but not the bwrap invocations
made during the actual testing, which fail with "Creating new namespace
failed: Invalid argument". Make the trial bwrap invocation more like
what Flatpak actually does, so that these tests will hopefully be
skipped on such kernels.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876743
Signed-off-by: Simon McVittie <smcv@debian.org>
2017-09-26 10:41:49 +02:00
Simon McVittie
6e46dc8076 Revert "tests: Don't force use of /var/tmp"
This reverts commit 0648452fca.
Unfortunately, it appears we still need xattrs on the system cache.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 16:22:18 +02:00
Simon McVittie
2cfeef6bcc Put FLATPAK_SYSTEM_CACHE_DIR alongside other test data
This makes it easier to reason about. In the absence of
FLATPAK_SYSTEM_CACHE_DIR, it would use /var/tmp even during tests that
prefer /tmp.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 16:22:18 +02:00
Simon McVittie
0648452fca tests: Don't force use of /var/tmp
Now that we don't need user xattrs, a tmpfs is good enough.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 13:35:54 +02:00
Simon McVittie
86fd56dce0 Improve test diagnostics
- Replace `if (g_test_verbose ()) g_print("...\n")` with
  `g_test_message ("...")`, which prints the message if the test is
  either verbose or in TAP mode. Otherwise, post-mortem debugging
  of failing tests on an autobuilder is very difficult.
  In some cases, since commit f1dbe9bc "tests: Print spawned program
  argv in testlibrary" we already had the g_test_message(), but
  still had the redundant g_print() too.

- Factor out running a subprocess into a helper function to reduce
  duplication.

- Capture invoked subprocesses' stderr and stdout where possible, so we
  can log it as diagnostics. Again, this should make it easier to carry
  out post-mortem debugging based on autobuilder logs.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-30 15:45:11 +02:00
Philip Withnall
15df314ca4 lib/remote: Add implementation of flatpak_remote_get_remote_type()
This is declared in the header file, but was never actually implemented.
Oops.

If anybody is hit by this issue, they can work around it by using
g_object_get() to get the FlatpakRemote:type property, which this is the
getter for.

Add it to the tests as well, so it gets exercised.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-23 16:59:11 +01:00
Philip Withnall
bcaec00e7a tests: Increase timeout values in testlibrary
1s is apparently not enough to install the test application on my
machine.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
f1dbe9bc50 tests: Print spawned program argv in testlibrary
This makes debugging failures a little easier.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
1932c66e0f tests: Drop use of GMainLoop in testlibrary
Use g_main_context_iteration() manually in a loop instead; this makes
the termination conditions more obvious. This does not change the
behaviour of the test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
9989188a1e tests: Add support for collection IDs to test-repo.sh
This adds variable support for collection IDs: they can either be
enabled on the server, on the server and client, or not at all. If
enabled on the server, apps and runtimes are built with collection IDs
and the repository has one set. If enabled on the client, the remote
config is added to the local repository with a collection ID and GPG
verification enabled. They are controlled with
USE_COLLECTIONS_IN_{SERVER,CLIENT}={yes,no}.

These variables are used in the new wrapper tests,
test-repo-collections.sh and test-repo-collections-server-only.sh.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
642a5a81a1 lib/remote: Add getter/setter for collection IDs
This isn’t really used internally, but will be used by gnome-software
for when it configures new flatpak remotes.

This is new public API, but is only declared if compiling with
--enable-p2p.

Includes some basic smoketests.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
4c395cec13 lib/ref: Add collection ID support to FlatpakRef
This adds a new collection-id property which is only enabled if
FLATPAK_ENABLE_P2P is defined. The internal machinery for handling it is
always enabled, to reduce the amount of #ifdef spam.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
95c3c942d3 tests: Move printf format string into printf() call to silence warning
Clang otherwise complains about the printf() format string not being a
string literal, which is a bit pants.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-06 15:05:58 +01:00
Simon McVittie
5de225e615 tests: Isolate tests from real home directory more thoroughly
The library test previously used the real ~/.cache, while the
library test and the shell-script tests would use the real ~/.config
to look up the XDG user-dirs.dirs. Other home-directory-related code
might have used the real $HOME.

As a general rule, build-time tests should not affect the real home
directory. Debian autobuilders run as a user whose home directory
does not exist, in order to catch packages whose build process could
affect or be affected by the contents of the home directory. This
caused testlibrary to fail when it tried to create that nonexistent
directory, which I think happened while trying to create ~/.cache.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-07-04 11:32:45 +01:00
Alexander Larsson
7ef78c8e2b tests: Increase timeouts waiting for file notification
For whatever reason .5 seconds was not enough time for me
to get a file notification message, so increase it to 1 sec.
2017-06-19 19:41:32 +02:00
Simon McVittie
7612232ab8 testlibrary: Call g_assert_no_error first
Failing tests produce much clearer diagnostics this way round.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-06-05 21:48:59 +01:00
Alexander Larsson
99a6200cab tests: Make it possible to create multiple test repos 2017-05-10 11:54:27 +02:00
Alexander Larsson
32eb260d24 Stop using ostree trivial-httpd
This isn't always available in recent ostree.
This work is based on https://github.com/flatpak/flatpak/pull/658 and
fixes https://github.com/ostreedev/ostree/pull/723
2017-03-27 12:30:38 +02:00
Simon McVittie
63daf2bb95 testlibrary: ensure that contents_array is NULL-terminated
Otherwise g_strjoinv() wanders off the end into uninitialized memory.

Signed-off-by: Simon McVittie <smcv@debian.org>
2017-01-18 08:41:03 +01:00
Alexander Larsson
0fb2f362a8 tests: Move the test repo to a subdirectory (repos/test)
This makes the ostree trivial-httpd --autoexit feature work better,
because it seems to exit whenever the root directory changes (i.e. not
only when its deleted).

This means the root dir can't be the repo (because then we can't
update the repo), or the base testdir (because we create files there
too), so instead we make the repo $testdir/repos/test and
$testdir/repos as the httpd root.
2017-01-12 00:04:36 +01:00
Mario Sanchez Prada
54d65aabc5 Fix CI build with clang: remove unused variable 2016-12-20 16:26:20 +01:00
Mario Sanchez Prada
29510ff4e0 Add unit tests to check the new feature to support multiple installations
Test all the new public APIs, making sure that the list of system-wide
installations is returned in the right order according to their priorities.
2016-12-20 09:54:39 +01:00
Simon McVittie
57bfce9a55 Terminate gpg-agent after using it for tests
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-07 22:08:03 +01:00
Simon McVittie
1769f8e8dc Tell build-time tests which bwrap we are going to use
In autobuilder environments that deprive the build of capabilities,
it is entirely possible that we have a system bwrap(1) but cannot
run it, for example because CAP_SYS_ADMIN has been excluded from
the capability bounding set. Tell the tests which bwrap we are
going to run, so we can run it in a simpler way and see whether
it works.

Debian's sbuild autobuilder currently suffers from a different
issue in which pivot_root(2) returns EINVAL, possibly caused by
sbuild being chroot-based and so not having the mount point
structure that is required for pivot_root. This avoids the
problematic build-time tests there too; they work on ci.debian.net,
which uses lxc instead of chroots, and in virtual machines.

Because $(BWRAP) might be non-absolute, we need to search PATH for it.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-07 17:02:04 +01:00
Simon McVittie
a5d70667b2 test_install_launch_uninstall: consistently check for GError first
An assertion failure that says res is FALSE is a lot less useful
than an assertion failure that says we got a specific GError.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-09-07 17:01:35 +01:00
Alexander Larsson
6e37155a3e testlibrary: Skip launch test is bwrap is not supported 2016-08-29 12:32:31 +02:00
Alexander Larsson
b1fcf792e1 testlibrary: Include libglnx before flatpak.h
This makes the code use the backport of g_auot* so that we can build
against older versions of glib.
2016-08-29 11:01:05 +02:00
Matthias Clasen
e50ea6f66a More library tests
Test launching of apps and uninstallation
2016-08-02 10:56:33 -04:00
Matthias Clasen
149cff9c5d More library tests
More tests, for FlatpakRef.
2016-08-01 23:05:19 -04:00
Matthias Clasen
109e6984e8 tests: Add library tests
Add a test binary that sets up a remote and exercises some of
the library apis against it.
2016-08-01 23:05:05 -04:00