Commit Graph

236 Commits

Author SHA1 Message Date
Simon McVittie
ea73d96e02 testlibrary: Correct a wrong string in a debug message
This always printed "setting HOME=(null)" because we didn't set
datadir yet, but it should have been looking at homedir anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Simon McVittie
2471f0552c testlibrary: Let the test web server's stderr go to the test's stderr
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Alexander Larsson
376a325eda tests: Test uninstall fail due to dependencies
Closes: #1750
Approved by: alexlarsson
2018-06-01 15:45:08 +00:00
Alexander Larsson
de5a713336 uninstall: Don't allow uninstalling a runtime with apps that need it
Closes: #1750
Approved by: alexlarsson
2018-06-01 15:45:08 +00:00
Alexander Larsson
bc4a2d8dbf uninstall: Add --all
Closes: #1744
Approved by: alexlarsson
2018-06-01 10:59:14 +00:00
Alexander Larsson
715cc173ef Transactions: Add uninstall operation and handle no-pull correctly
In the no-pull case and when uninstalling, we never want to do any network
i/o for e.g. detecting depenedencies.

Closes: #1744
Approved by: alexlarsson
2018-06-01 10:59:14 +00:00
Alexander Larsson
aff4c1f4fc tests: Fix some unused variable errors in non-p2p builds
Closes: #1745
Approved by: alexlarsson
2018-05-31 19:16:15 +00:00
Alexander Larsson
9757e4883e tests: Hacks to handle coreutils-single
In the Fedora 28 base container, `coreutils-single` is used and so
`/usr/bin/ls` is actually a "script":

```
$ file /usr/bin/ls
/usr/bin/ls: a /usr/bin/coreutils --coreutils-prog-shebang=ls script, ASCII text executable
```

We handle this by detecting shebangs in dependencies and recursively adding them.

Closes: #1741
Approved by: alexlarsson
2018-05-31 14:34:49 +00:00
Alexander Larsson
2642b55e91 libflatpak: Guard public headers for individual includes 2018-05-29 16:37:21 +02:00
Alexander Larsson
867d8f4007 tests: We need to update repo with flatpak build-update-repo, not just ostree summary -U
If not, there will not be the flatpak cache in the summary and we'll create a g_warning that
aborts the tests.
2018-05-29 16:37:21 +02:00
Alexander Larsson
45c9fb967a extensions: Respect versions (as well as version) when finding related refs
This allows one extension point to match multiple versions of an extension.
In particular, this is useful for OpenGL so that we can match the version matching the current
runtime, as well as the "magic" 1.4 version for nvidia.

Closes: #1722
Approved by: alexlarsson
2018-05-29 08:01:33 +00:00
Alexander Larsson
bad16e2158 test: Add some supressions to fix FLATPAK_TESTS_VALGRIND
Closes: #1720
Approved by: alexlarsson
2018-05-28 10:59:50 +00:00
Alexander Larsson
fb8122bae2 Tests: Ensure that all ostree commits produce valid bare-user-only repos
In particular the non-canonical checks were failing for me due to selinux
attributes being picked up.

Closes: #1698
Approved by: alexlarsson
2018-05-22 08:28:10 +00:00
Philip Withnall
3902a3fd32 common: Fix setting a collection ID on a repository
It was taking a copy of the repository configuration, modifying the
original repository configuration (not the copy), then saving the copy
to disk.

Add a test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1667
Approved by: mwleeds
2018-05-16 04:46:46 +00:00
Matthew Leeds
cdf7c459b8 tests: Forcefully kill the dbus daemon on exit
In the cleanup() function used after each unit test exits, we kill the
dbus daemon process and remove the temporary test directory. However, on
an Endless Mini the daemon doesn't always exit properly before we try to
remove the test directory, leading to an error like:

rm: cannot remove '/var/tmp/test-flatpak-AlmZul/runtime/.dbus-proxy': Device or resource busy

which causes some of the tests to fail with e.g.:

ERROR: tests/test-bundle.sh - exited with status 1

I don't think this is specific to the Mini or to ARM computers; it could
probably happen on any slow computer. So this commit uses "kill -9"
instead of just "kill" to make sure the daemon exits.

Closes: #1642
Approved by: alexlarsson
2018-05-14 07:27:47 +00:00
Simon McVittie
cce2a8dd78 make-test-runtime: Look in /{usr/,}sbin for ldconfig
Under normal circumstances ldconfig isn't required to be in ordinary
users' PATHs, but running this script is not a normal circumstance.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1630
Approved by: alexlarsson
2018-05-02 12:25:54 +00:00
Alexander Larsson
30bfc901d5 appstream: Allow system-helper update for local non-gpg remotes
This is safe as we do the pull locally, and root configured the local
path. We already do the same for regular installs, so its weird that
its not done for appstream.

Should fix https://github.com/flatpak/flatpak/issues/1580

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
ef80dd9947 appstream: Update appstream2 branch by default
By default we use the new appstream2 branch if it exists in the remote,
also in this case we compress the xml when deploying to be backwards
compat with the old deploys.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
7fd085acd7 appstream: Generate appstream2/$arch branches with uncompressed xml
These delta better, and the files will be downloaded as compressed
.filez objects anyway.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Matthew Leeds
9afca51507 remote-ls: Allow a URI instead of remote name
This fixes the ability of the remote-ls command to take a file:// URI
instead of a remote name, which is especially useful for repos on USB
drives (created via `ostree create-usb`) which are temporary and don't
warrant being added to the repo config. This commit also updates
relevant documentation, adds a unit test, and updates a few variable
names to improve readability.

I can't find a commit in the history where this was working, but it's
working on the Endless fork of flatpak so I think there was agreement at
some point that it's desired behavior.

Fixes https://github.com/flatpak/flatpak/issues/1588

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
c5e0e97395 lib/installation: Add a method to list remotes by type
Since we have several types of remotes, it is important to have the
option of choosing which types one wants when listing them because
depending on the type it may have an impact in the performance (e.g.
when listing LAN remotes).

For that reason this patch adds a new method
"flatpak_installation_list_remotes_by_type" that allows to specify
which types of remotes should be returned. When giving an empty array
of types, it means that all types should be returned instead, which can
be more useful than actually asserting or not doing anything.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
33f9029bb1 tests: Cover listing refs from a remote by URL
Listing refs from a remote can be done using a URL so we need to cover
this in the unit tests.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
2465cf49d4 tests: Cover listing refs with different collection IDs in remotes
This patch tests if refs of different collection IDs are returned
together when listing refs from remote.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
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
c33f842b70 lib: Add metadata info in FlatpakRemoteRef
This adds things like the size and the metadata, as well as eol strings
to FlatpakRemoteRef. We typically have this accessible anyway, in the
FlatpakRemoteState.

This makes flatpak_installation_fetch_remote_size/metadata_sync deprecated.

Closes: #1591
Approved by: alexlarsson
2018-04-19 08:17:46 +00:00
Alexander Larsson
534c7a2fc8 tests: Fix unused variable warning in non-p2p case
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
88edfda861 dir: Pass FlatpakRemoteState to flatpak_dir_pull/install/update
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Matthew Leeds
ee28165141 tests: Limit use of installation monitor
The GFileMonitor returned by flatpak_installation_create_monitor() is
already tested in test_install_launch_uninstall(), so there's not much
point in testing it again in test_list_updates, and for some reason it
is causing a test failure on OBS.

Closes: #1567
Approved by: alexlarsson
2018-04-12 17:50:30 +00:00
Alexander Larsson
fabe1e5ff4 Add tests for end-of-line
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
7a238f1860 tests/test-repo.sh: Ensure that appdata branch is built correctly
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Matthew Leeds
78199b066a lib: Add P2P support to list_installed_refs_for_update()
Currently flatpak_insallation_list_installed_refs_for_update() only
checks the configured remotes for updates. This means that updates from
peer sources such as USB drives or computers on the LAN are never seen,
which is especially problematic when the computer is offline. The end
result is that GNOME Software doesn't show an "Update" button to let you
update an app from a USB drive when you're offline.

This commit uses ostree API, primarily ostree_repo_find_remotes_async(),
to check peer sources for updates from any remotes that have a
collection ID configured. We're using an ostree 2018.5 feature from
https://github.com/ostreedev/ostree/pull/1518, but I used a version
check for that (it hasn't been released yet). Without it you can't tell
if an offered commit is an update or a downgrade, but that behavior is
still better than the status quo (no updates from P2P sources at all).

Closes: #1542
Approved by: alexlarsson
2018-04-06 15:38:21 +00:00
Matthew Leeds
73d1725bf2 testlibrary: Conditionally use a collection ID
Use a collection ID on the test repo if P2P support is enabled. This
will allow for testing of more API that makes use of collection IDs.

Closes: #1542
Approved by: alexlarsson
2018-04-06 15:38:21 +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
Matthew Leeds
e2c3157ea8 tests: Minor change to assertion ordering
Philip pointed out it's better to g_assert_no_error before g_assert_true
so the output shows the error message.

Closes: #1501
Approved by: pwithnall
2018-03-23 10:34:52 +00:00
Matthew Leeds
34c97c3d10 lib/remote: Make gpg-verify-summary dependent on collection-id
When a collection ID is set on a remote configuration,
gpg-verify-summary should be set to FALSE because flatpak uses signed
per-repo and per-commit metadata instead. The flatpak command line
already does this (use flatpak remote-modify --collection-id=... and
notice that gpg-verify-summary is then set to false). This commit
changes libflatpak to have the same behavior. Specifically, with a
collection ID set gpg-verify-summary is set to false and otherwise its
value matches that of gpg-verify. This commit also adds a test for this
in testlibrary.c.

Fixes https://github.com/flatpak/flatpak/issues/1479

Closes: #1501
Approved by: pwithnall
2018-03-23 10:34:52 +00:00
Alexander Larsson
f2a6c1db8d Remove document portal
This is now in xdg-desktop-portal. We keep a version of the document
portal dbus XML so that we avoid weird build dependencies.

Flatpak itself is technically not dependent on the document portal,
but it is very much recommended that you use it.

Closes: #1398
Approved by: alexlarsson
2018-02-09 09:23:26 +00:00
Philip Withnall
4ed08b24d1 tests: Fix failure with test-unsigned-summaries.sh
The test used to verify that metadata was coming from the
ostree-metadata ref rather than the summary file, by ensuring that
xa.title was set in one but not the other, by regenerating one
separately from the other. However, since the test was written, OSTree
has changed so that it now writes them both out, at the same time, with
no possibility of separating the two.

Trim down this test so it no longer tries to check the source of the
updated metadata, and instead just checks that it is updated.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1201
Approved by: alexlarsson
2017-12-14 10:30:34 +00:00
Alexander Larsson
3ade86b292 install: Add --reinstall
If you're installing something and its already installed, we undeploy
the old install first before deploying the new. This makes it very
easy to switch an application from one remote to another, without
having to uninstall first, which is both painful and could cause
the download to be unnecessary large.

Closes: #1241
Approved by: alexlarsson
2017-12-14 09:04:38 +00:00
Matthew Leeds
b3828eea46 app: Make remote commands smarter wrt installations
Currently "flatpak remotes" shows remotes across user and system
installations, but other remote commands (remote-delete, remote-modify,
remote-ls, remote-info) only work on one installation: the system one
unless overridden using --user or --installation. This commit changes
each command to infer the correct installation by checking which has
the specified remote. In case multiple installations have remotes by
the same name, the user is prompted to decide which to use.

This commit also adds unit tests and updates the man pages for the
aforementioned commands.

Fixes https://github.com/flatpak/flatpak/issues/787

Closes: #1205
Approved by: alexlarsson
2017-12-12 15:26:41 +00:00
Alexander Larsson
f61febd785 Drop OCI install tests
Its hard to test these since they rely on a registry to work.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00: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
Alexander Larsson
e7e1331653 Make tests work on debian
The regular ldconfig is some bash wrapper over /sbin/ldconfig.real
2017-10-09 15:45:25 +02:00
Alexander Larsson
f4de7fb4dd vlagrind suppression: Ignore FICLONE ioctl confusion 2017-10-05 10:34:48 +02:00
Valentin David
845a0b3bf7 Use ld.so.cache instead of LD_LIBRARY_PATH (when not building)
Instead of setting LD_LIBRARY_PATH to make the app load the right
libraries we run ldconfig to generate a ld.so.cache that we feed
to the sandbox as /etc/ld.so.cache. The cache itself is generated
by running ldconfig at run time, but for apps we cache the
result in $HOME/.var/app/$APPID/.ld.so/cache based on the
current app/runtime/extensions commit ids.

We also unset LD_LIBRARY_PATH, to ensure any host-side value
does not mess with the sandbox.

The default ld.so.conf we set (if the runtime has none, or an empty
one) is:

 include /run/flatpak/ld.so.conf.d/*.conf
 include /app/etc/ld.so.conf
 /app/lib

Additionally all the extension points that have add_ld_path set gets a
ld.so.conf snippet in /run/flatpak/ld.so.conf.d.

This allows applications and extensions to install their own paths if
needed, and if the runtime wants more location they can install a
custom ld.so.conf that includes the above.

In the flatpak build case we still use LD_LIBRARY_PATH like before,
because there is no good key (like the commit ids) for keeping the
cache up-to-date. Also, the behaviour is different when building an
app for instance. If /app/lib is not in LD_LIBRARY_PATH then the
sandbox-wide /etc/ld.so.cache must be updated for a newly installed
library to work, but the sandbox is not allowed to update
/etc/ld.so.cache.

This code was originally written by Valentin David <valentin.david@gmail.com>
with changes by Alexander Larsson <alexl@redhat.com>.

Closes: #1073
Approved by: alexlarsson
2017-10-04 10:27:14 +00:00
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
Alexander Larsson
5158a622f6 Fix OCI tests by exporting FLATPAK_ENABLE_EXPERIMENTAL_OCI=1 2017-09-22 11:48:06 +02:00
Simon McVittie
22f05803b9 Skip system-mode tests (only) if /var/tmp doesn't support xattrs
This partially reverts commit a53a752a35.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 16:22:18 +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