Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into snapctl-is-connec…
Browse files Browse the repository at this point in the history
…ted-bad-plug-or-slot
  • Loading branch information
jhenstridge committed Aug 20, 2020
2 parents e6ae6dc + 86feee0 commit f086c71
Show file tree
Hide file tree
Showing 24 changed files with 41 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
matrix:
gochannel:
- 1.9
- latest/edge
- latest/stable
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
13 changes: 10 additions & 3 deletions cmd/snapd-generator/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,20 @@ static bool file_exists(const char *path) {
return stat(path, &buf) == 0 && (buf.st_mode & S_IFMT) == S_IFREG;
}

// PATH may not be set (the case on 16.04), in which case this is the fallback
// for looking up squashfuse / snapfuse executable.
// Based on what systemd uses when compiled for systems with "unmerged /usr"
// (see man systemd.exec).
static const char * const path_fallback = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";

static bool executable_exists(const char *name) {
char *path = getenv("PATH");
char *path_copy SC_CLEANUP(sc_cleanup_string) = NULL;
if (path == NULL) {
return false;
path_copy = sc_strdup(path_fallback);
} else {
path_copy = sc_strdup(path);
}
char *path_copy SC_CLEANUP(sc_cleanup_string) = NULL;
path_copy = sc_strdup(path);

char *ptr = NULL;
char *token = strtok_r(path_copy, ":", &ptr);
Expand Down
8 changes: 6 additions & 2 deletions secboot/encrypt_tpm.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ var (
sbAddRecoveryKeyToLUKS2Container = sb.AddRecoveryKeyToLUKS2Container
)

// FormatEncryptedDevice
// FormatEncryptedDevice initializes an encrypted volume on the block device
// given by node, setting the specified label. The key used to unlock the
// volume is provided using the key argument.
func FormatEncryptedDevice(key EncryptionKey, label, node string) error {
return sbInitializeLUKS2Container(node, label, key[:])
}

// AddRecoveryKey
// AddRecoveryKey adds a fallback recovery key rkey to the existing encrypted
// volume created with FormatEncryptedDevice on the block device given by node.
// The existing key to the encrypted volume is provided in the key argument.
func AddRecoveryKey(key EncryptionKey, rkey RecoveryKey, node string) error {
return sbAddRecoveryKeyToLUKS2Container(node, key[:], rkey)
}
6 changes: 0 additions & 6 deletions tests/lib/nested.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ get_google_image_url_for_nested_vm(){
ubuntu-18.04-64)
echo "https://storage.googleapis.com/spread-snapd-tests/images/cloudimg/bionic-server-cloudimg-amd64.img"
;;
ubuntu-19.10-64)
echo "https://storage.googleapis.com/spread-snapd-tests/images/cloudimg/eoan-server-cloudimg-amd64.img"
;;
ubuntu-20.04-64)
echo "https://storage.googleapis.com/spread-snapd-tests/images/cloudimg/focal-server-cloudimg-amd64.img"
;;
Expand All @@ -118,9 +115,6 @@ get_ubuntu_image_url_for_nested_vm(){
ubuntu-18.04-64*)
echo "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
;;
ubuntu-19.10-64*)
echo "https://cloud-images.ubuntu.com/eoan/current/eoan-server-cloudimg-amd64.img"
;;
ubuntu-20.04-64*)
echo "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
;;
Expand Down
8 changes: 0 additions & 8 deletions tests/lib/pkgdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -639,14 +639,6 @@ pkg_dependencies_ubuntu_classic(){
qemu-utils
"
;;
ubuntu-19.10-64)
echo "
evolution-data-server
fwupd
packagekit
qemu-utils
"
;;
ubuntu-20.04-64)
echo "
evolution-data-server
Expand Down
2 changes: 1 addition & 1 deletion tests/main/apt-hooks/task.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
summary: Ensure apt hooks work

# apt hook only available on 18.04+ and aws-cli only for amd64
systems: [ubuntu-18.04-64, ubuntu-19.10-64, ubuntu-2*-64]
systems: [ubuntu-18.04-64, ubuntu-2*-64]

manual: true

Expand Down
2 changes: 1 addition & 1 deletion tests/main/cgroup-tracking-failure/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ execute: |
# package pre-installed. To exercise the case that is similar to real
# systems, where snapd does not depend on this package and it is not
# pre-installed on standard images, we mask the dbus.socket for the user
# session. This is done for Ubuntu 16.04 and 18.04, because only 19.10
# session. This is done for Ubuntu 16.04 and 18.04, because only 20.04
# started shipping dbus-user-session in all the images.
echo "run a snap app as a root user, without session bus" >scenario.txt
find /run/user/0 >run.txt
Expand Down
3 changes: 1 addition & 2 deletions tests/main/desktop-portal-filechooser/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ description: |
# Only enable the test on systems we know portals to function on.
# Expand as needed.
# ubuntu-18.04-*: Ships xdg-desktop-portal 0.11
# ubuntu-19.10-*: Ships xdg-desktop-portal 1.2.0
systems: [ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-18.04-*, ubuntu-2*]

prepare: |
#shellcheck source=tests/lib/desktop-portal.sh
Expand Down
2 changes: 1 addition & 1 deletion tests/main/desktop-portal-open-file/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: |
# Only enable the test on systems we know portals to function on.
# Expand as needed.
systems: [ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-18.04-*, ubuntu-2*]

environment:
EDITOR_HISTORY: /tmp/editor-history.txt
Expand Down
2 changes: 1 addition & 1 deletion tests/main/desktop-portal-open-uri/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: |
# Only enable the test on systems we know portals to function on.
# Expand as needed.
systems: [ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-18.04-*, ubuntu-2*]

environment:
BROWSER_HISTORY: /tmp/browser-history.txt
Expand Down
2 changes: 1 addition & 1 deletion tests/main/desktop-portal-screenshot/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ description: |
# Only enable the test on systems we know portals to function on.
# Expand as needed.
systems: [ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-18.04-*, ubuntu-2*]

prepare: |
#shellcheck source=tests/lib/desktop-portal.sh
Expand Down
2 changes: 1 addition & 1 deletion tests/main/interfaces-audio-playback-record/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ summary: Ensure that the audio-playback/record interface works

# Only classic Ubuntu has the pulseaudio mediation patches. Ubuntu 14.04 is unsupported on the desktop.
# TODO: extend tests.session and run this test on 14.04 as well.
systems: [ubuntu-16.04-*, ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-16.04-*, ubuntu-18.04-*, ubuntu-2*]

environment:
PLAY_FILE: "/snap/test-snapd-audio-record/current/usr/share/sounds/alsa/Noise.wav"
Expand Down
5 changes: 2 additions & 3 deletions tests/main/interfaces-calendar-service/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ summary: Ensure that the calendar-service interface works
#
# FIXME: disable opensuse-tumbleweed until
# https://github.com/snapcore/snapd/pull/7230 is landed
# ubuntu-19.10+: test-snapd-eds is incompatible with eds version shipped with the distro
# ubuntu-20.04+: test-snapd-eds is incompatible with eds version shipped with the distro
# arch-linux: test-snapd-eds is incompatible with eds version shipped with the distro
# fedora-31: test-snapd-eds is incompatible with eds version shipped with the distro
# fedora-32: test-snapd-eds is incompatible with eds version shipped with the distro
Expand All @@ -18,8 +18,7 @@ systems:
- -fedora-32-* # test-snapd-eds is incompatible with eds version shipped with the distro
- -opensuse-tumbleweed-* # test-snapd-eds is incompatible with eds version shipped with the distro
- -ubuntu-14.04-* # no tests.session support, eds is too old
- -ubuntu-19.10-* # test-snapd-eds is incompatible with eds shipped with the distro
- -ubuntu-2*
- -ubuntu-2* # test-snapd-eds is incompatible with eds shipped with the distro
- -ubuntu-core-* # EDS is unsupported on core systems

# fails in the autopkgtest env with:
Expand Down
3 changes: 1 addition & 2 deletions tests/main/interfaces-contacts-service/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ systems:
- -fedora-32-* # test-snapd-eds is incompatible with eds version shipped with the distro
- -opensuse-tumbleweed-* # test-snapd-eds is incompatible with eds version shipped with the distro
- -ubuntu-14.04-* # no tests.session support, eds is too old
- -ubuntu-19.10-* # test-snapd-eds is incompatible with eds shipped with the distro
- -ubuntu-2*
- -ubuntu-2* # test-snapd-eds is incompatible with eds shipped with the distro
- -ubuntu-core-* # EDS is unsupported on core systems

# fails in autopkgtest environment with:
Expand Down
2 changes: 1 addition & 1 deletion tests/main/interfaces-pulseaudio/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ summary: Ensure that the pulseaudio interface works

# Only classic Ubuntu has the pulseaudio mediation patches. Ubuntu 14.04 is unsupported on the desktop.
# TODO: extend tests.session and run this test on 14.04 as well.
systems: [ubuntu-16.04-*, ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-16.04-*, ubuntu-18.04-*, ubuntu-2*]

environment:
PLAY_FILE: "/snap/test-snapd-pulseaudio/current/usr/share/sounds/alsa/Noise.wav"
Expand Down
4 changes: 0 additions & 4 deletions tests/main/interfaces-timeserver-control/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ prepare: |
apt-get remove -y ntp
tests.cleanup defer apt-get install -y ntp
;;
ubuntu-19.10-*)
apt-get remove -y chrony
tests.cleanup defer apt-get install -y chrony
;;
*)
case "$(busctl get-property org.freedesktop.timedate1 /org/freedesktop/timedate1 org.freedesktop.timedate1 NTP)" in
"b true")
Expand Down
5 changes: 3 additions & 2 deletions tests/main/interfaces-udisks2/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ details: |
The udisks2 interface allows operating as or interacting with the UDisks2 service
# Interfaces not defined for ubuntu core systems
# FIXME: fails in debian-sid for unknown reasons
systems: [-ubuntu-core-*, -debian-sid-*]
# FIXME: `udisksctl mount -b "$device"` fails on arch with:
# Object /org/freedesktop/UDisks2/block_devices/loop200 is not a mountable filesystem.
systems: [-ubuntu-core-*, -arch-linux-*]

prepare: |
snap install test-snapd-udisks2
Expand Down
6 changes: 4 additions & 2 deletions tests/main/lxd/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ execute: |
# prep two containers, the my-ubuntu normal container and the
# my-nesting-ubuntu nesting container
lxd.lxc launch --quiet "ubuntu:${VERSION_ID:-}" my-ubuntu
lxd.lxc launch --quiet "ubuntu:${VERSION_ID:-}" my-nesting-ubuntu -c security.nesting=true
VERSION_ID="$(. /etc/os-release && echo "$VERSION_ID" )"
lxd.lxc launch --quiet "ubuntu:$VERSION_ID" my-ubuntu
lxd.lxc launch --quiet "ubuntu:$VERSION_ID" my-nesting-ubuntu -c security.nesting=true
if [ "$(uname -m)" = x86_64 ] && lxd.lxc info my-ubuntu | grep "Architecture: i686"; then
echo "LXD spawned 32bit userspace container on a 64bit host, WAT?"
snap info lxd
Expand Down Expand Up @@ -143,6 +144,7 @@ execute: |
echo "Sanity check that mount overrides were generated inside the container"
lxd.lxc exec my-ubuntu -- find /var/run/systemd/generator/ -name container.conf | MATCH "/var/run/systemd/generator/snap-core-.*mount.d/container.conf"
lxd.lxc exec my-ubuntu -- test -f /var/run/systemd/generator/snap.mount
# Ensure that we can run lxd as a snap inside a nested container
Expand Down
10 changes: 2 additions & 8 deletions tests/main/preseed-reset/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: |
This test checks that preseeding of Ubuntu cloud images with snap-preseed
can be undone with --reset flag.
systems: [ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-2*]

environment:
IMAGE_MOUNTPOINT: /mnt/cloudimg
Expand Down Expand Up @@ -34,13 +34,7 @@ restore: |
execute: |
find_files() {
# ubuntu-19.10 doesn't have new snapd deb yet, so exclude applications dir for now
# TODO: remove after 2.44 is there.
if [[ "$SPREAD_SYSTEM" = ubuntu-19.10-64 ]]; then
find "$IMAGE_MOUNTPOINT/etc/" "$IMAGE_MOUNTPOINT/usr/" "$IMAGE_MOUNTPOINT/var/" | grep -v "/var/lib/snapd/desktop/applications"
else
find "$IMAGE_MOUNTPOINT/etc/" "$IMAGE_MOUNTPOINT/usr/" "$IMAGE_MOUNTPOINT/var/"
fi
find "$IMAGE_MOUNTPOINT/etc/" "$IMAGE_MOUNTPOINT/usr/" "$IMAGE_MOUNTPOINT/var/"
}
find_files > before-preseeding.txt
Expand Down
2 changes: 1 addition & 1 deletion tests/main/preseed/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: |
command works, up to the point where the image is ready to be booted.
The test assumes cloud image with a core and lxd snaps in its seeds/.
systems: [ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-2*]

environment:
IMAGE_MOUNTPOINT: /mnt/cloudimg
Expand Down
2 changes: 1 addition & 1 deletion tests/main/seccomp-statx/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ details: |
# This test will only pass on systems with seccomp 2.3.3 or newer which
# is available on all Ubuntu LTS releases.
systems: [ubuntu-16.04-*, ubuntu-18.04-*, ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-16.04-*, ubuntu-18.04-*, ubuntu-2*]

prepare: |
#shellcheck source=tests/lib/snaps.sh
Expand Down
2 changes: 1 addition & 1 deletion tests/main/snapd-slow-startup/task.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
summary: Test that snapd is not terminated by systemd on a slow startup

systems: [ubuntu-18.04-64, ubuntu-19.10-64]
systems: [ubuntu-18.04-64]

restore: |
# extra cleanup in case something in this test went wrong
Expand Down
1 change: 0 additions & 1 deletion tests/main/xdg-open-portal/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ systems:
# be problematic. OpenSUSE 15.2 will hopefully be fine.
- opensuse-tumbleweed-*
- ubuntu-18.04-*
- ubuntu-19.10-*
- ubuntu-2*

environment:
Expand Down
2 changes: 1 addition & 1 deletion tests/nested/manual/preseed/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: |
command works, and the resulting image boots and finalizes seeding.
The test assumes cloud image with a core and lxd snaps in its seeds/.
systems: [ubuntu-19.10-*, ubuntu-2*]
systems: [ubuntu-2*]

environment:
IMAGE_MOUNTPOINT: /mnt/cloudimg
Expand Down

0 comments on commit f086c71

Please sign in to comment.