Commit Graph

51 Commits

Author SHA1 Message Date
Joaquim Rocha
1c8dd13f55 tests: Make the app ID in make-test-app.sh a parameter
This is in order to allow tests to make several apps if needed, and will
be useful when e.g. testing repos that have multiple apps with different
collection IDs.

This patch modifies the mentioned script as mentioned and updates the
places that call it.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Alexander Larsson
394130793c uninstall: Pick installation automatically
When uninstalling, if no specific installation was specified with e.g.
--user or --system, automatically chose any unique match, or error
out if there are multiple alternatives.

Fixes #1321
2018-04-04 17:25:20 +02:00
Gunnar Andersson
98c21473fc Fix whitespace issues (remove TAB usage)
Signed-off-by: Gunnar Andersson <gandersson@genivi.org>

Closes: #1107
Approved by: mwleeds
2017-10-17 06:21:07 +00: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
e65bcc9fcc Bring back skip_without_user_xattrs helper function
We'll need this to be able to skip system-mode tests without xattrs.
This partially reverts commit a53a752a35.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 16:22:18 +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
a53a752a35 tests: Don't require user xattrs
Since Flatpak 0.9.6, we use libostree in bare-user-only mode, which
does not rely on xattrs.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 13:35:54 +02:00
Alexander Larsson
52bd146561 Remove flatpak-builder from flatpak repo
This is now in a separate flatpak-builder repo
2017-08-25 11:10:50 +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
4cb47a2112 tests: Add a test for unsigned summary support
This relies on peer to peer support also being enabled; the test is
skipped otherwise.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02: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
Philip Withnall
5a0e10969f tests: Add base-64 GPG keys to libtest declarations
These will be useful in upcoming tests, as they are in the right format
to be substituted into a .flatpakref file.

Generated using `gpg2 --homedir test-keyring --armor --export
${FL_GPG_ID}`, then stripping the packet header and removing line
breaks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-06-30 10:17:34 +02:00
Philip Withnall
0062cf69c0 tests: Add TEST_SKIP_CLEANUP env var for skipping test cleanup
This mirrors the same environment variable in OSTree’s unit tests, which
keeps the temporary directory around after tests have completed (or
failed) so the developer can examine it.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-06-30 10:17:34 +02:00
Alexander Larsson
0bbb8354dc tests: Add tests for no world writable dirs & no setuid files 2017-06-19 19:41:00 +02:00
Alexander Larsson
bc7ebd20e2 builder: Allow .pyc files without .py
This is common for binary-only releases, for example as described
in:
https://lists.freedesktop.org/archives/flatpak/2017-June/000697.html
2017-06-13 11:17:06 +02:00
Alexander Larsson
ec89340a26 tests: Add a second gpg keyring 2017-05-10 11:54:27 +02:00
Alexander Larsson
b33d6fd04f tests: Allow overriding GPG args 2017-05-10 11:54:27 +02:00
Alexander Larsson
99a6200cab tests: Make it possible to create multiple test repos 2017-05-10 11:54:27 +02:00
Alexander Larsson
0d4fa486b5 Fix tests by setting XDG_CACHE_HOME
We use this now, so need to have it set to the test homedir
2017-05-09 13:24:54 +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
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
Alexander Larsson
25483378a9 tests: Run flatpak-builder under valgrind too 2016-10-26 21:43:32 +02:00
Alexander Larsson
5e4f46f9c2 tests: Make the valgrind based checks default to not checking for leaks
Use FLATPAK_TESTS_VALGRIND_LEAKS to check for leaks.
We're not currently passing the leak checks, so this helps letting
us make valgrind checks useful.
2016-10-19 13:13:30 +02: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
Alexander Larsson
78dae42509 Set MALLOC_CHECK_ and MALLOC_PERTURB_ during tests 2016-08-26 12:32:17 +02:00
Alexander Larsson
42fae1c5d1 tests: Fix python2 use 2016-08-22 14:43:16 +02:00
Alexander Larsson
9c57a5751e Add test for python .pyc/.pyo rewriting
This catches regressions in the fix in the previous commit, where old
stale .py[oc] files can wrongly become "unstale" when we change the
.py file mtime to 1.
2016-08-10 16:24:18 +02:00
Simon McVittie
6cc8062cfb libtest: replace dbus-launch with dbus-daemon
dbus-launch is X11-specific and contains a lot of legacy code to
support X11 autolaunching. It should not be part of the Wayland
(and/or Mir) future.

Start a dbus-daemon directly instead.
2016-08-01 11:29:50 +01:00
Alexander Larsson
ab64f70c59 tests: Test install/updates with static deltas 2016-06-28 17:36:54 +02:00
Simon McVittie
6f9915eade Run tests with a private XDG_RUNTIME_DIR
Otherwise, service activation will start a new xdg-document-portal
(because we're using a private DBUS_SESSION_BUS_ADDRESS), but because
XDG_RUNTIME_DIR is shared with the real system, it won't be able to
mount its filesystem.

We need to unmount the document portal before removing the private
XDG_RUNTIME_DIR.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-06-25 00:45:10 +01:00
Alexander Larsson
528b150162 Update valgrind test support 2016-06-10 12:59:11 +02:00
Alexander Larsson
20a737dc90 tests: Pull things via http instead of local pulls
This causes us to use the same codepaths as in real use.
Also, there seems to be an issue with partial pulls for local remotes.
2016-06-07 22:12:51 +02:00
Alexander Larsson
759bfaa0f4 tests: Only skip tests if no xattrs in /var/tmp
We explicitly put the checkouts in /var/tmp to avoid the common
case of /tmp being tmpfs and not supporting xattrs.
2016-05-31 09:18:08 +02:00
Simon McVittie
a461eb50fa Skip tests that make a repository if /var/tmp lacks user xattrs
Signed-off-by: Simon McVittie <smcv@debian.org>
2016-05-23 23:00:37 +01:00
Alexander Larsson
1216e0ea68 tests: Fix distcheck breaking on gpg dir not writable
We make a copy of the gpg homedir so that gpg can write (e.g. a lock file)
to the directory.
2016-05-18 10:26:11 +02:00
Simon McVittie
d4738cca16 tests: skip running flatpak at build time if bwrap doesn't work
Distribution autobuilders are often more locked-down than the
environment in which the distribution binaries actually run.

Signed-off-by: Simon McVittie <smcv@debian.org>
2016-05-17 18:05:12 +02:00
Alexander Larsson
aa11387031 tests: Add test-run-system.sh 2016-05-17 17:49:55 +02:00
Alexander Larsson
f36a57b3b1 tests: Use gpg signatures during test 2016-05-17 13:04:44 +02:00
Alexander Larsson
6b4e5dd903 tests: Put --user in an env var
This means we can optionally skip it
2016-05-17 10:50:02 +02:00
Alexander Larsson
c432c417c2 tests: Add test for update 2016-05-17 10:32:29 +02:00
Alexander Larsson
5e9b247d26 Migrate ~/.local/share/xdg-app to ~/.local/share/flatpak 2016-05-09 12:21:28 +02:00
Alexander Larsson
8abbc0186e Rename everything but the on-disk location to flatpak 2016-05-09 11:11:55 +02:00
Alexander Larsson
d680da8d59 Added xdg-app-builder test 2016-05-02 15:49:18 +02:00
Alexander Larsson
dcfb950c31 make-test-runtime.sh: Make this a bit more generic
We pass the id and contents on the commandline
2016-05-02 14:15:32 +02:00
Alexander Larsson
a68e3bba50 tests: Add tests for list/info commands 2016-05-02 12:38:12 +02:00
Alexander Larsson
e5fad0714e tests: Add namespace and overrides tests 2016-05-02 11:41:32 +02:00
Alexander Larsson
123f32015d tests/test-run.sh: Add tests for proper installation 2016-05-02 10:47:59 +02:00
Alexander Larsson
b330368761 Make installed tests work better
This involves e.g. having our own session bus with only our services in.
2016-04-28 13:04:14 +02:00