3950 Commits

Author SHA1 Message Date
Alberto Mardegan
3a8206ec6d interfaces: custom-device
* i/b/custom_device: add new custom-device interface

* tests: spread tests for the custom-device interface

* tests: remove unused variable

* tests: add custom-device plug to interfaces-many-core-provided

* i/b/custom-device: fix base declaration

* i/b/custom-devices: error reporting, pattern handling

* i/b/custom_device: add unit test for ** check

* i/b/custom_device: add support for read-devices attribute

* i/b/custom_device: revert change on ** in paths

It's safer to be restrictive and keep the globbing to "*".

* i/b/custom_device: update comment on AppArmor globbing

* i/b/custom_device: minor formatting change

* i/b/custom_device: improve logic of slot attribute naming

* i/b/custom_device_test: add tests

* i/b/custom_device: update interface declaration

* interfaces/custom-device: mv read/write under a files key

As suggested by Samuele. Also update all the tests.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>

* i/b/custom_device: remove leftover comments

* i/b/custom_device: remove unneeded function parameter

* i/b/custom-devices: improve validation, error handling and tests

* i/b/custom_device: test more invalid characters

Co-authored-by: Michael Vogt <mvo@ubuntu.com>
Co-authored-by: Ian Johnson <ian.johnson@canonical.com>
2022-03-02 16:53:29 +01:00
Maciej Borzecki
d12d9822c0 data/env: more workarounds for even older fish shells, provide reasonable defaults (#11416)
with merge fixes

Tweak snapd.fish to be compatible with even older releases of fish, going back to 2.7, which was shipped with Ubuntu 18.04.

* data/env: make fish setup compatible with fish 2.7

Make the environment setup script compatible with fish 2.7 which was shipped
with Ubuntu 18.04.

Thanks to @faho for the review.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/main/user-session-env: verify env in fish shell

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/main/user-session-env: tweak comments

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* data/env: provide reasonable default if XDG_DATA_DIRS is unset in fish shell

Fixes: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1960702

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/main/user-session-env: verify that XDG_DATA_DIRS contains reasonable defaults

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2022-02-23 11:58:38 +01:00
Michael Vogt
8bc9d8ce8b tests: remove disabled snaps before calling save_snapd_state
The reset_all_snaps code will get confused if the state contains
disabled snaps. The reason is that importing `reset.sh` will remove
all disabled snaps first. Then the `reset_all_snaps` will call
`restore_snapd_state` which will restore the state and the snaps
but the mount unit of the removed snaps are not re-started so
the snap appears to be broken.

This happens on e.g. the external testflinger devices when the
device starts with a stable core20, then refreshes to a core20
from beta. In that configuration the `tests.invariant` test will
detect a broken core20 revision because of the above behavior.

There are various ways to fix this, the easiest is to just start
with a snapd state that contains no disabled snaps on core systems.
2022-02-03 15:46:37 +01:00
Alex Lewontin
dba3b4f42b i/builtin/xilinx-dma-host: add interface for Xilinx DMA driver 2022-01-18 15:02:59 +01:00
Michael Vogt
3bd12a35fc build-aux: detect/fix dirty git revisions while snapcraft building
* build-aux: error when a build is dirty

* generate-packaging-dir: fix packaging diff

* buid-aux: set version before calling ./generate-packaging-dir

* debian, generate-packging-dir: make symlinks consistent with the git defaults
2021-12-20 09:59:00 +01:00
Alberto Mardegan
efc6fd1378 tests: add spread test for shared-memory interface 2021-12-13 14:48:18 +03:00
Alberto Mardegan
05ff7931f8 tests: add a spread test for the mount-control interface 2021-12-08 09:54:04 +03:00
Alberto Mardegan
1b2d737609 interfaces/builtin: add mount-control interface
Very first draft, untested even.
2021-12-08 09:54:04 +03:00
Maciej Borzecki
29be5b7de9 tests/lib/tools/tests.invariant: use exeact process name match
Otherwise the check matches things like `dbus-daemon-launch-helper` which are
incorrectly reported as errors

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-07 15:15:47 +01:00
Maciej Borzecki
2243b82161 tests/lib/pkgdb: install dbus-user-session during prepare, drop dbus-x11
Use dbus-user-session to provide the session but, and drop dbus-x11 which
requires $DISPLAY and actual X to be running.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-07 13:06:11 +01:00
Michael Vogt
5f5e786ab3 Merge pull request #10977 from mardy/kernel-module-load
interfaces: kernel-module-load
2021-12-07 12:45:32 +01:00
Maciej Borzecki
6d46ca8622 tests/core/kernel-and-base-single-reboot-failover, tests/lib/fakestore: verify failover scenario
* tests/lib/fakestore: allow passing a snap blob file or dir to make-refreshable

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot-failover: verify failover handling

Verify failover handling when executing simultaneous refresh of kernel and base
with a single reboot.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/fakestore/refresh: strip quoting when faking a new version

Sometimes a snap version can be quoted, eg. version: '2021112' in core18 to
avoid ambiguity whether the value is a string or a number. However, when adding
+fake1 suffix, it's clearly a string, thus the quoting should be stripped,
otherwise we produce invalid yaml.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/fakestore: allow dots in original version

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot-failover: comments update

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/fakestore: provide help message for new make-refreshable options

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/fakestore: more improvements to make-refreshable command

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot-failover: tweak comments

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-06 15:48:27 +01:00
Michael Vogt
49d5548ec8 Merge pull request #11131 from bboozzoo/bboozzoo/nested-wait-for-serial
tests/nested/manual/core20-remodel: wait for device to have a serial before starting a remodel
2021-12-06 15:45:27 +01:00
Alberto Mardegan
75e8300574 interfaces: add kernel-module-load interface 2021-12-06 11:28:01 +03:00
Maciej Borzecki
fda586b928 tests: verify that simultaneous refresh of kernel and base triggers a single reboot only
* tests/lib/fakestore/refresh: strip quoting when faking a new version

Sometimes a snap version can be quoted, eg. version: '2021112' in core18 to
avoid ambiguity whether the value is a string or a number. However, when adding
+fake1 suffix, it's clearly a string, thus the quoting should be stripped,
otherwise we produce invalid yaml.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot: verify there is a single reboot when refreshing kernel and boot base

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot: comment tweaks

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot: check revisions, check reboots

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/core/kernel-and-base-single-reboot: fix keeping track of current revisions

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/fakestore: allow dots in original version

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-03 10:15:14 +01:00
Maciej Borzecki
126e099ed8 tests/lib/nested: trailing whitespace cleanup
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-01 14:27:28 +01:00
Maciej Borzecki
7d8591c189 tests/lib/nested: add helper that waits for device to be initialized
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-01 14:27:28 +01:00
Maciej Borzecki
3499332fc9 tests/lib/assertions: consisntently use latest/edge in the model for testing uc20 to uc22 remodel
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-12-01 09:08:45 +01:00
Maciej Borzecki
b25eec3884 Merge remote-tracking branch 'upstream/master' into bboozzoo/uc20-to-uc22-remodel-test 2021-12-01 09:01:08 +01:00
Maciej Borzecki
cafaa99f89 packaging/ubuntu, packaging/debian: depend on dbus-session-bus provider (#11111)
* packaging/ubuntu, packaging/debian: depend on dbus-session-bus provider

On a cgroup v2 system, we rely on being able to set up a systemd scope for the
snap applications. This is done by communicating with a proper systemd instance
over a dbus bus, which for user session is the session bus.

This only came up when one of the intermediate dependencies of ubuntu-server,
had their dependencies updated and no longer requires session bus and we
observed that it was impossible to launch snap applications that required device
access on Ubuntu 21.10.

Related to:
- https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1951491
- https://forum.snapcraft.io/t/cannot-launch-snap-applications-with-cgroup-v2/27700

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* spread: have ubuntu-core-18 be based on 18.04 images

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* packaging/ubuntu-16.04: depend on dbus-session-bus if not on 16.04

The (default-)dbus-session-bus was introduced only in 2018, so it's available in
18.04 but not in earlier releases, so revert to not having a special dependency
on that release. Not having a session bus and lack of snap app tracking is not
fatal on 16.04, but is a must on 21.10 where a snap specific cgroup created by
dbus user instance is required for device access filtering.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/pkgdb: dbus-user-session shall be pulled in through default-dbus-session-bus dependency

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/lib/pkgdb: fix indentation

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/main/lxd-snapfuse,lxd-try,lxd-mount-units: wait for container to be booted, run apt update before installing any packages

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>

* tests/main/lxd-try/task.yaml: fix typo

Co-authored-by: Ian Johnson <person.uwsome@gmail.com>
2021-11-30 19:13:04 -06:00
Ondrej
d6667c24dc interfaces/interfaces/scsi_generic: add interface for scsi generic de… (#10936)
* interfaces/interfaces/scsi_generic: add interface for scsi generic devices

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* interfaces/interfaces/scsi_generic: fixing formatting

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* interfaces/interfaces/scsi_generic: update summary

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* interfaces/interfaces/scsi_generic: restrict plug side with base declaration

Signed-off-by: Ondrej Kubik <ondrej.kubik@canonical.com>

* interfaces/builtin/scsi-generic: fix copyright date

Co-authored-by: Ian Johnson <person.uwsome@gmail.com>
2021-11-30 18:43:25 -06:00
Michael Vogt
e4099b423d Merge pull request #11089 from anonymouse64/feature/nested-uc18-allow-tests-to-use-custom-core18
tests/lib/nested.sh: allow tests to use their own core18 in extra-snaps-path
2021-11-29 14:02:38 +01:00
Maciej Borzecki
87bce1d295 Merge remote-tracking branch 'upstream/master' into bboozzoo/uc20-to-uc22-remodel-test 2021-11-29 12:19:32 +01:00
Maciej Borzecki
a8b32842e6 tests/nested/manual/core20-to-core22: spread test for remodeling from UC20 to UC22
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-11-25 12:15:41 +01:00
Sergio Cazzolato
9b7bd99c51 Merge pull request #11047 from sergiocazzolato/tests-query-mongodb-tool
tests: new tool used to retrieve data from mongo db
2021-11-24 08:32:02 -03:00