Commit Graph

248 Commits

Author SHA1 Message Date
Alexander Larsson
3f4518b15c Run uncrustify
Closes: #1870
Approved by: alexlarsson
2018-07-08 10:05:37 +00:00
Alexander Larsson
c0f9d81fb0 tests: Fix up ioctl suppressions for tests
The FICLONE ioctl suppression was hit via a different
codepath too, so tweak the callstack for the
suppression.
2018-07-07 16:38:24 +02:00
Simon McVittie
3ed522c057 testlibrary: Capture stderr from more commands
This is the equivalent of commit 86fd56dce for the commands added
in commit 2465cf4 to test #1587.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #1864
Approved by: alexlarsson
2018-07-07 08:35:50 +00:00
Simon McVittie
07a225b90e testlibrary: Remove unused argv_str
This was left over after commit 86fd56d.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #1864
Approved by: alexlarsson
2018-07-07 08:35:50 +00:00
Alexander Larsson
fad723dbc4 tests: Run tests on /tmp (not /var/tmp)
Since we now are ok with no-xattrs this means we can run on tmpfs.

Closes: #1839
Approved by: alexlarsson
2018-06-29 09:59:50 +00:00
Alexander Larsson
aa55665ae1 tests: Don't skip if no user xattrs
We don't require these anymore

Closes: #1839
Approved by: alexlarsson
2018-06-29 09:59:50 +00:00
Owen W. Taylor
8f73dbd32d Include appstream and icons in OCI bundles as annotations
Include annotations:

 org.freedesktop.appstream.appdata
 org.freedesktop.appstream.icon-{64,128}

into OCI bundles. This not only makes the bundle self-describing, but also
if the bundle is imported into a registry, it becomes possible to browse
the registry and recreate an appstream by only retrieving the annotations
for relevant images, without having to download the actual images.

The icon annotations are formatted as data: URI's with base64 data. The idea
is that a server-side process to collect annotations could extract the icons
to separate storage and rewrite the URI's to remote URL's.

Closes: #1834
Approved by: alexlarsson
2018-06-29 08:43:31 +00:00
Matthew Leeds
85726180a1 tests: Run P2P tests unconditionally
Now that Flatpak always has P2P support enabled, the tests that are
dependent on it can always run.

Closes: #1804
Approved by: alexlarsson
2018-06-20 07:40:53 +00:00
Alexander Larsson
491d174879 Make p2p build non-optional
Closes: #1800
Approved by: alexlarsson
2018-06-19 18:10:56 +00:00
Alexander Larsson
ffaf2d5386 Cli transaction: Print the full uninstall/install/update lists in ready
This lets you see what operations will happen and you can confirm
it before starting the heavy operations.

Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Simon McVittie
69bc824813 test-webserver.sh: Wait longer for web server to start
When under load (for example running parallel tests) it can take a
while to get the web server ready.

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

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Simon McVittie
acb33b4a0e test-webserver: Print http server output
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
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