829 Commits

Author SHA1 Message Date
Razze
3f2e10e274 tests: add missing assertions after second flatpak_usb_parse_usb_list call
The call to flatpak_usb_parse_usb_list() lacked the
g_assert(ret) and g_assert_no_error(error) guards that are present
on the first call.
2026-04-18 20:33:07 +05:30
Sebastian Wick
3c843932aa tests: Use meson to enumerate the tests
This gets rid of the test-matrix generation, and instead enumerates all
the tests in meson.

Some people (including me) constantly modified the generated meson
instead of the test-matrix generator file because they find it so
uncommon and unusual that a meson file is generated.

This looses the combinatorial combination of the generated system, but
in practice, six lines of enumeration is not bad, and it makes things
easier to understand.
2026-04-16 12:00:46 +00:00
razzeee
655ddb42ec tests: add test-run-custom.sh to test matrix source
test-run-custom.sh was only manually appended to test-matrix/meson.build
and would be lost on regeneration. Add it to update-test-matrix so it is
properly managed.
2026-04-13 16:00:54 +00:00
Razze
51cff37bea tests: fix copy-paste bug checking mid_high instead of highest 2026-04-12 07:37:43 +05:30
Razze
758a096d72 tests: remove duplicate g_mkdir_with_parents call for dont_hide in test_full 2026-04-12 07:25:11 +05:30
razzeee
39dda201c9 tests: fix copy-paste bug using is_arch instead of is_branch in test_decompose 2026-04-10 16:01:35 +00:00
razzeee
f5f70a511e tests: Add messages for missing os-release and pre-create directory checks 2026-04-10 15:52:46 +00:00
razzeee
cff9812514 repair: disable auto-pin to preserve pin state across reinstalls
When repair (re)installs runtimes via a transaction, the transaction
auto-pins every runtime it touches. This causes repair --reinstall-all
to pin every installed runtime, cluttering the pin list with runtimes
that were never explicitly pinned by the user and preventing
flatpak remove --unused from cleaning them up.

Fix this by disabling auto-pinning on the repair transaction so that
the pin state is left exactly as it was before the repair.

Fixes https://github.com/flatpak/flatpak/issues/6565
2026-04-10 15:36:00 +00:00
Sebastian Wick
1364527683 tests: Check that flatpak-run fd-arguments do not leak to the command
flatpak-run takes a number of arguments which are file descriptor
numbers. Those file descriptors are supposed to set something up in the
way the instance gets spawned, but should never make it to the wrapper
command.
2026-04-10 14:50:21 +00:00
razzeee
3eadc2c379 tests: remove duplicate g_set_print_handler call in test_format_choices teardown 2026-04-10 14:50:09 +00:00
Simon McVittie
50dda82eb0 libtest: Allow adding a new ref to an existing temporary ostree repo
When we run `tests/test-run-custom.sh` as a build-time test,
we expect to already have the necessary runtimes, apps, etc. in
`${builddir}/tests/runtime-repo`. However, when running "as-installed"
tests, we're using a fresh temporary ostree repo for each test.
Merely having the repo exist is not enough: for some tests, and in
particular `tests/test-run-custom.sh`, it needs to have more than one
runtime available.

Resolves: https://github.com/flatpak/flatpak/issues/6591
Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-04-10 14:13:39 +00:00
bbhtt
79cb10e880 tests: Add test for NoRuntime extra-data app 2026-04-10 11:37:40 +00:00
Sebastian Wick
8599a5109c tests/test-run-custom: Test --bind-fd and --ro-bind-fd 2026-04-08 23:19:02 +00:00
Sebastian Wick
a8e3c72454 tests/test-run-custom: Test --usr-path, --usr-fd, --app-path, --app-fd 2026-04-08 23:19:02 +00:00
Kolja Lampe
3178d97321 common: allow automatic branch following for extensions
When an application or runtime is updated and its metadata requests a
new branch of an extension, Flatpak should automatically pull the new
branch if the user already has at least one branch of that extension
installed.

This ensures that "no-autodownload" extensions (like GIMP plugins)
stay functional after an update that requires a new branch, while still
respecting the user's explicit opt-in (the existing installation of
a previous branch).

Fixes: https://github.com/flatpak/flatpak/issues/4208
2026-03-29 19:25:09 +00:00
Kolja Lampe
f2ff272157 tests: Add test-preinstall.sh to the test matrix source
test-preinstall.sh was present in the generated test-matrix/meson.build
but missing from TEST_MATRIX_SOURCE in update-test-matrix, meaning it
would be dropped if the matrix were regenerated.
2026-03-28 14:23:02 +00:00
Simon McVittie
0c9a818f8d tests: Mention [systemd-]localed in debug messages, not "located"
This was not a typo for "located": the daemon is systemd-localed,
or localed for short.

Fixes: bb549168 "fix: cross typos, detail below"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-03-19 21:16:19 +05:30
rezky_nightky
bb54916814 fix: cross typos, detail below
What I did
Repository rules / “don’t edit” areas
From CONTRIBUTING.md and subprojects/README.md, subprojects/ contains vendored/submodule/copylib code (bubblewrap, libglnx, dbus-proxy, variant-schema-compiler). I treated subprojects/ as third-party and excluded it from typo fixing.

You already skip po/ (translations) and node_modules/, and I kept those exclusions.

Typos fixed (project-owned files only)
I ran codespell with write mode and exclusions, and fixed the reported typos across:

NEWS
app/…
common/…
doc/…
tests/…
session-helper/…
portal/…
data/…
Then I handled the remaining items individually:

NEWS: thse -> these
common/flatpak-utils-private.h: Thse -> These
app/flatpak-polkit-agent-text-listener.c: identies -> identities
tests/test-auth.sh: Propertly -> Properly
tests/testlibrary.c: remore -> remote
common/flatpak-transaction.c: improved wording to avoid the xwindows typo (X11 window ID)
Added .codespellrc
Created .codespellrc:

skip: node_modules,po,subprojects
ignore-regex: .*(ratatui|Affinitized|affinitized).*
ignore-words-list: nd,ot,THUR,IST,fo,hel,bu
(these were confirmed as legitimate tokens/abbreviations/namespace prefix/test strings in this repo, so they should not be “fixed”)
Verification:

codespell --config .codespellrc . now exits clean.

Signed-off-by: rezky_nightky <with.rezky@gmail.com>
2026-01-21 17:58:19 +00:00
Simon McVittie
c324778b07 tests: Tell "as-installed" tests where they can find triggers
Since commit d10e1148 "Add initial support for preinstalling flatpaks",
the test suite sets FLATPAK_DATA_DIR to a temporary directory, both
while running uninstalled and as-installed.

While running uninstalled we already set FLATPAK_TRIGGERSDIR to the
trigger scripts in the source tree, but when running "as-installed",
we need to run the triggers that the OS installs as part of the flatpak
package (or equivalent).

Not having this caused autopkgtests (automated as-installed tests) in
Debian to regress with 1.17.x.

Fixes: d10e1148 "Add initial support for preinstalling flatpaks"
Signed-off-by: Simon McVittie <smcv@debian.org>
2025-12-18 14:52:35 +00:00
Sebastian Wick
6667e1d361 context: Use the new permission system for shares and features
This gives us conditionals for shares and features. So far we have no
use case for this, but the system already exists, it makes the code
simpler, and when we need this in the future, we don't have to wait for
it to roll out.
2025-12-08 19:33:09 +00:00
Sebastian Wick
f242199eca tests: Test signed OCI images 2025-12-08 19:09:56 +00:00
Sebastian Wick
725fdc75ce tests/test-preinstall.sh: Add test for sideloading with network failure
If there is a sideload repo we should be able to pick it up when there
are non-sideload repos which cannot be reached.
2025-12-08 19:04:45 +00:00
Sebastian Wick
e807ca3539 tests/test-history.sh: Make testing for working journalctl more robust
journalctl also prints something when the message didn't make it to
whatever journalctl connects to. Check for the specific message showing
up instead to make sure it all works as expected.
2025-12-01 17:19:09 +00:00
Sebastian Wick
9ebe43a0c7 tests: Do not redirect stdout twice in test-unused.sh
The '&>' already redirects both stdout and stderr. Adding another '>'
makes it ambiguous where stdout gets redirected to.
2025-12-01 17:19:09 +00:00
Sebastian Wick
40640819d4 tests/asan: Update the asan suppression file
If gdk-pixbuf uses glycin, there might be a leak.
2025-11-21 14:21:13 +00:00
Sebastian Wick
e9e713fa0d tests: Add test-extra-data.sh to test extra-data installation
There are two sub-tests, one testing it with a ostree remote and one
with a OCI remote.
2025-11-20 23:14:18 +00:00
Sebastian Wick
e4edecdef5 utils-http: Drop libsoup2 support in favor of libcurl
A few years ago there was a very painful attempt at porting from
libsoup2 to libsoup3. Flatpak libsoup3 support never landed and it seems
like a large amount of distros have switched over to libcurl instead.

This commit removes libsoup2 support completely instead of growing
libsoup3 support.

Closes #5915
Closes #4582
2025-11-20 17:40:57 +00:00
Owen W. Taylor
c8e73a0993 test-oci-registry.sh: add a test for zstd layers 2025-11-20 17:30:07 +00:00
JakobDev
9b51edf31a portal: Allow passing device permissions to subsandbox 2025-11-20 17:19:42 +00:00
Sebastian Wick
842472d234 transaction: Preinstall from first remote with ref
We could previously just assume that the first enabled remote
(potentially matching the collection ID) contains the ref, but that
obviously is not always the case.

The change here looks up the remote state of the remotes to figure out
if they actually contain the ref, and adds the first matching remote to
the transaction.
2025-10-30 11:21:35 +00:00
Achill Gilgenast
bd468a8959 tests: Dont add locales to test runtime on musl
musl libc doesn't provides locales under /usr/share/locales. The tests
still run fine without copying locale under musl.
2025-10-14 09:53:05 +00:00
Sebastian Wick
8a21f2dfe1 tests/test-http-utils.sh: Only use have_xattr if we have setfattr
Otherwise we try to call setfattr which fails and have_xattr reports
that there is no xattr support. This might then obviously be wrong and
the test can fail because of that.
2025-10-13 18:42:55 +00:00
Sebastian Wick
78b3c47c13 tests/test-run.sh: Only test for trigger results if we have the deps
If the binaries are not available in the environment, the trigger will
not do anything. The tests will not know about this and fail. So only
test for the results of the triggers if they have the dependencies they
require.
2025-10-13 18:42:55 +00:00
Sebastian Wick
c38e481fb4 context: Handle x11-fallback by converting to a conditional
This internally converts `x11-fallback` to `if:x11:!has-wayland` at
the earliest place possible, and converts back when serializing to a
file.
2025-10-13 18:31:33 +00:00
Sebastian Wick
a92c5f686e context: Support condtional permissions for socket and devices
This uses the new FlatpakPermissions API to support the new
commandline options --socket-if= and --device-if=.
2025-10-13 18:31:33 +00:00
Alexander Larsson
5c12cd83a1 tests: Add support for adding internal tests
If the internal_tests option is enabled we build some internal tests
into the binary. These are added to the tests we run in testlibrary.

This is not intended to be enabled in production, as it adds size to
the real binary, but is useful for CI and development.
2025-10-13 18:31:33 +00:00
Adian Kozlica
4f8b935567 feat: json support for table printer 2025-10-13 13:53:15 +00:00
Mary Strodl
919d2922bf common: support reinstall option on bundle installations
Fixes #2489

Adds and wires up a `reinstall` option to
`flatpak_dir_install_bundle`. Previously, bundle install
transactions would silently drop the reinstall flag.
2025-09-08 12:57:40 +00:00
Simon Chopin
7399dea960 testlib: add expected argument to fcntl(F_DUPFD)
The F_DUPFD and its relative F_DUPFD_CLOEXEC both expect an int argument
as extra argument, being the minimal value for the new FD. This argument
must be within the accepted range (see ulimit -H -n).

This was detected in Ubuntu during testing against the latest glibc,
stracing resulted in:

107244 fcntl(1, F_DUPFD_CLOEXEC, 1847846346272) = -1 EINVAL (Invalid argument)

On the system in question (ppc64el machine running Ubuntu Questing), the
relevant limit is 524288.

For the fix we use 3 as a reasonable floor value, as in the first one
after stderr. It also happens to be the one used in revokefs/main.c.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/2121039
2025-08-28 11:21:18 +00:00
Kalev Lember
d10e11482d Add initial support for preinstalling flatpaks
This adds new FlatpakTransaction API, and a new top level CLI command to
preinstall flatpaks, that is to install flatpaks that are considered
part of the operating system.

A new drop-in directory /etc/flatpak/preinstall.d/ allows configuring
what apps should be preinstalled, and a new flatpak preinstall command
installs and removes apps based on the current configuration.

A drop-in loupe.preinstall file can look something like this:

[Flatpak Preinstall org.gnome.Loupe]
Branch=stable
IsRuntime=false

The corresponding API is flatpak_transaction_add_sync_preinstalled()
which can be implemented by GUI clients to drive the actual installs
on system startup.

Resolves: https://github.com/flatpak/flatpak/issues/5579
Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-08-26 11:51:07 +00:00
Sebastian Wick
555e9200d9 libtest.sh: Add have_working_bwrap to skip over parts of a test 2025-08-26 11:51:07 +00:00
Owen W. Taylor
a460dd5069 image-source: Support oci-archive: image sources
Add support for `oci-archive:` image sources by temporarily
unpacking the archive using libarchive.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-08-25 15:56:20 +00:00
Owen W. Taylor
eee21d5a27 builtins/install: Allow direct installation from OCI images
Similar to bundle installs, add:

 flatpak install [--image] docker://registry.example.com/image:latest
 flatpak install [--image] oci:/path/to/image

These is useful for testing purposes and in certain cases when installing
Flatpaks on disconnected systems.
2025-08-25 15:56:20 +00:00
Owen W. Taylor
a2aad56cd7 tests: Add tests for https OCI remotes 2025-05-08 16:08:21 +00:00
Owen W. Taylor
c75ba1c7e1 common: Implement /etc/containers/certs.d for OCI registries
Docker and podman can be configured to use mutual TLS authentication
to the registry by dropping files into system-wide and user
directories. Implement this in a largely compatible way.

(Because of the limitations of our underlying libraries, we
can't support multiple certificates within the same host config,
but I don't expect anybody actually needs that.)

The certs.d handling is extended so that certificates are separately
looked up when downloading the look-aside index. This is mostly
to simplify our tests, so we can use one web server for both -
in actual operation, we expect the indexes to be unauthenticated.

Also for testing purposes, FLATPAK_CONTAINER_CERTS_D is supported
to override the standard search path.

Co-authored-by: Sebastian Wick <sebastian.wick@redhat.com>
2025-05-08 16:08:21 +00:00
Owen W. Taylor
f439e83f2a tests/oci-registry: Add support for SSL to client and server 2025-05-08 16:08:21 +00:00
Sebastian Wick
59c2186703 tests/oci-registry-server.py: Always get bytes for the response
And sent the Content-Length header.
2025-05-08 16:08:21 +00:00
Owen W. Taylor
199f7ccac5 tests/oci-registry-server.py: Convert to argparse 2025-05-08 16:08:21 +00:00
Sebastian Wick
5945a18d97 tests/oci-registry-server.py: Clean up Python style 2025-05-08 16:08:21 +00:00
Owen W. Taylor
05e2b083ed tests/oci-registry-client.py: Convert to argparse 2025-05-08 16:08:21 +00:00