Permalink
...
Checking mergeability…
Don’t worry, you can still create the pull request.
Comparing changes
Open a pull request
- 18 commits
- 13 files changed
- 0 commit comments
- 1 contributor
Commits on Jun 13, 2017
Commits on Jun 16, 2017
Unified
Split
Showing
with
129 additions
and 62 deletions.
- +36 −21 spread.yaml
- +13 −11 tests/lib/pkgdb.sh
- +4 −1 tests/lib/prepare-project.sh
- +42 −22 tests/lib/prepare.sh
- +1 −1 tests/lib/reset.sh
- +9 −6 tests/lib/snaps.sh
- +5 −0 tests/main/debs-have-built-using/task.yaml
- +4 −0 tests/main/interfaces-alsa/task.yaml
- +4 −0 tests/main/interfaces-firewall-control/task.yaml
- +4 −0 tests/main/interfaces-network/task.yaml
- +1 −0 tests/main/interfaces-shutdown-introspection/task.yaml
- +1 −0 tests/main/security-setuid-root/task.yaml
- +5 −0 tests/main/static/task.yaml
View
57
spread.yaml
| @@ -195,6 +195,12 @@ backends: | ||
| - ubuntu-core-16-arm-32: | ||
| username: test | ||
| password: ubuntu | ||
| + - raspbian-8-arm-32: | ||
| + username: test | ||
| + password: ubuntu | ||
| + # Give system a bit more time to finish things as it's | ||
| + # quite slow at times | ||
| + kill-timeout: 40m | ||
| path: /home/gopath/src/github.com/snapcore/snapd | ||
| @@ -209,24 +215,27 @@ exclude: | ||
| prepare-each: | | ||
| # systemd on 14.04 does not know about --rotate or --vacuum-time. | ||
| - if [[ "$SPREAD_SYSTEM" != ubuntu-14.04-* ]]; then | ||
| - journalctl --rotate | ||
| - sleep .1 | ||
| - journalctl --vacuum-time=1ms | ||
| - else | ||
| - # Force a log rotation with small size | ||
| - sed -i.bak s/#SystemMaxUse=/SystemMaxUse=1K/g /etc/systemd/journald.conf | ||
| - systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service | ||
| + case "$SPREAD_SYSTEM" in | ||
| + ubuntu-14.04-*|raspbian-*) | ||
| + # Force a log rotation with small size | ||
| + sed -i.bak s/#SystemMaxUse=/SystemMaxUse=1K/g /etc/systemd/journald.conf | ||
| + systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service | ||
| - # Restore the initial configuration and rotate logs | ||
| - mv /etc/systemd/journald.conf.bak /etc/systemd/journald.conf | ||
| - systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service | ||
| + # Restore the initial configuration and rotate logs | ||
| + mv /etc/systemd/journald.conf.bak /etc/systemd/journald.conf | ||
| + systemctl kill --kill-who=main --signal=SIGUSR2 systemd-journald.service | ||
| - # Remove rotated journal logs | ||
| - systemctl stop systemd-journald.service | ||
| - find /run/log/journal/ -name "*@*.journal" -delete | ||
| - systemctl start systemd-journald.service | ||
| - fi | ||
| + # Remove rotated journal logs | ||
| + systemctl stop systemd-journald.service | ||
| + find /run/log/journal/ -name "*@*.journal" -delete | ||
| + systemctl start systemd-journald.service | ||
| + ;; | ||
| + *) | ||
| + journalctl --rotate | ||
| + sleep .1 | ||
| + journalctl --vacuum-time=1ms | ||
| + ;; | ||
| + esac | ||
| dmesg -c > /dev/null | ||
| debug-each: | | ||
| @@ -286,7 +295,7 @@ prepare: | | ||
| # NOTE: We can't use tests/lib/pkgdb.sh here as it doesn't exist at | ||
| # this time when none of the test files is yet in place. | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| apt-get update >& "$tf" || ( cat "$tf"; exit 1 ) | ||
| apt-get install -y xdelta3 curl >& "$tf" || ( cat "$tf"; exit 1 ) | ||
| ;; | ||
| @@ -312,7 +321,10 @@ restore: | | ||
| if [ "$SPREAD_BACKEND" = external ]; then | ||
| # start and enable autorefresh | ||
| if [ -e /snap/core/current/meta/hooks/configure ]; then | ||
| - systemctl enable --now snapd.refresh.timer | ||
| + # Can't use --now here as not all systems we target | ||
| + # have support for it (e.g. Raspbian 8 with systemd 215) | ||
| + systemctl enable snapd.refresh.timer | ||
| + systemctl start snapd.refresh.timer | ||
| snap set core refresh.disabled=false | ||
| fi | ||
| fi | ||
| @@ -424,7 +436,8 @@ suites: | ||
| exit 0 | ||
| fi | ||
| $TESTSLIB/reset.sh | ||
| - apt-get purge -y snapd | ||
| + . "$TESTSLIB/pkgdb.sh" | ||
| + distro_purge_package snapd | ||
| tests/unit/: | ||
| summary: Suite to run unit tests (non-go and different go runtimes) | ||
| @@ -452,7 +465,8 @@ suites: | ||
| prepare_each_classic | ||
| restore: | | ||
| $TESTSLIB/reset.sh --store | ||
| - apt-get purge -y snapd snap-confine ubuntu-core-launcher | ||
| + . "$TESTSLIB/pkgdb.sh" | ||
| + distro_purge_package snapd snap-confine ubuntu-core-launcher | ||
| tests/nightly/: | ||
| summary: Suite for nightly, expensive, tests | ||
| @@ -473,7 +487,8 @@ suites: | ||
| restore: | | ||
| $TESTSLIB/reset.sh | ||
| if [[ "$SPREAD_SYSTEM" != ubuntu-core-16-* ]]; then | ||
| - apt-get purge -y snapd | ||
| + . "$TESTSLIB/pkgdb.sh" | ||
| + distro_purge_package snapd | ||
| fi | ||
| tests/nested/: | ||
View
24
tests/lib/pkgdb.sh
| @@ -41,7 +41,7 @@ opensuse_name_package() { | ||
| distro_name_package() { | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| debian_name_package "$1" | ||
| ;; | ||
| fedora-*) | ||
| @@ -71,7 +71,7 @@ distro_install_local_package() { | ||
| done | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-14.04-*|debian-*) | ||
| + ubuntu-14.04-*|debian-*|raspbian-*) | ||
| # relying on dpkg as apt(-get) does not support installation from local files in trusty. | ||
| dpkg -i --force-depends --auto-deconfigure --force-depends-version "$@" | ||
| apt-get -f install -y | ||
| @@ -107,7 +107,7 @@ distro_install_package() { | ||
| fi | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| quiet apt-get install -y "$package_name" | ||
| ;; | ||
| fedora-*) | ||
| @@ -134,7 +134,7 @@ distro_purge_package() { | ||
| fi | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| quiet apt-get remove -y --purge -y "$package_name" | ||
| ;; | ||
| fedora-*) | ||
| @@ -153,7 +153,7 @@ distro_purge_package() { | ||
| distro_update_package_db() { | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| quiet apt-get update | ||
| ;; | ||
| fedora-*) | ||
| @@ -171,7 +171,7 @@ distro_update_package_db() { | ||
| distro_clean_package_cache() { | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| quiet apt-get clean | ||
| ;; | ||
| opensuse-*) | ||
| @@ -186,7 +186,7 @@ distro_clean_package_cache() { | ||
| distro_auto_remove_packages() { | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| quiet apt-get -y autoremove | ||
| ;; | ||
| fedora-*) | ||
| @@ -203,7 +203,7 @@ distro_auto_remove_packages() { | ||
| distro_query_package_info() { | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| apt-cache policy "$1" | ||
| ;; | ||
| fedora-*) | ||
| @@ -219,15 +219,17 @@ distro_install_build_snapd(){ | ||
| if [ "$SRU_VALIDATION" = "1" ]; then | ||
| apt install -y snapd | ||
| cp /etc/apt/sources.list sources.list.back | ||
| - echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -c -s)-proposed restricted main multiverse universe" | tee /etc/apt/sources.list -a | ||
| + if [[ "$SPREAD_SYSTEM" = ubuntu-* ]]; then | ||
| + echo "deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -c -s)-proposed restricted main multiverse universe" | tee /etc/apt/sources.list -a | ||
| + fi | ||
| apt update | ||
| apt install -y --only-upgrade snapd | ||
| mv sources.list.back /etc/apt/sources.list | ||
| apt update | ||
| else | ||
| packages= | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| packages="${GOHOME}/snapd_*.deb" | ||
| ;; | ||
| fedora-*) | ||
| @@ -256,7 +258,7 @@ distro_install_build_snapd(){ | ||
| # system to provide a basic build environment for snapd. | ||
| export DISTRO_BUILD_DEPS=() | ||
| case "$SPREAD_SYSTEM" in | ||
| - debian-*|ubuntu-*) | ||
| + debian-*|ubuntu-*|raspbian-*) | ||
| DISTRO_BUILD_DEPS=(build-essential curl devscripts expect gdebi-core jq rng-tools git netcat-openbsd) | ||
| ;; | ||
| fedora-*) | ||
View
5
tests/lib/prepare-project.sh
| @@ -153,7 +153,10 @@ if [ "$SPREAD_BACKEND" = external ]; then | ||
| fi | ||
| # stop and disable autorefresh | ||
| if [ -e "$SNAPMOUNTDIR/core/current/meta/hooks/configure" ]; then | ||
| - systemctl disable --now snapd.refresh.timer | ||
| + # Can't use --now here as not all systems we target | ||
| + # have support for it (e.g. Raspbian 8 with systemd 215) | ||
| + systemctl stop snapd.refresh.timer | ||
| + systemctl disable snapd.refresh.timer | ||
| snap set core refresh.disabled=true | ||
| fi | ||
| chown test.test -R "$PROJECT_PATH" | ||
View
64
tests/lib/prepare.sh
| @@ -109,7 +109,7 @@ prepare_classic() { | ||
| echo "Package build incorrect, 'snap-confine --version' mentions 'unknown'" | ||
| $LIBEXECDIR/snapd/snap-confine --version | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| apt-cache policy snapd | ||
| ;; | ||
| fedora-*) | ||
| @@ -120,11 +120,12 @@ prepare_classic() { | ||
| fi | ||
| START_LIMIT_INTERVAL="StartLimitInterval=0" | ||
| - if [[ "$SPREAD_SYSTEM" = opensuse-42.2-* ]]; then | ||
| - # StartLimitInterval is not supported by the systemd version | ||
| - # openSUSE 42.2 ships. | ||
| - START_LIMIT_INTERVAL="" | ||
| - fi | ||
| + case "$SPREAD_SYSTEM" in | ||
| + opensuse-42.2-*|raspbian-8-*) | ||
| + # StartLimitInterval is not supported by the systemd version | ||
| + # openSUSE 42.2 / Raspbian ship | ||
| + START_LIMIT_INTERVAL="" | ||
| + esac | ||
| mkdir -p /etc/systemd/system/snapd.service.d | ||
| cat <<EOF > /etc/systemd/system/snapd.service.d/local.conf | ||
| @@ -152,11 +153,16 @@ EOF | ||
| # Snapshot the state including core. | ||
| if [ ! -f "$SPREAD_PATH/snapd-state.tar.gz" ]; then | ||
| - ! snap list | grep core || exit 1 | ||
| - # use parameterized core channel (defaults to edge) instead | ||
| - # of a fixed one and close to stable in order to detect defects | ||
| - # earlier | ||
| - snap install --"$CORE_CHANNEL" core | ||
| + if snap list | grep core ; then | ||
| + # If core is already installed we ensure it's the lastest from | ||
| + # the configured channel. | ||
| + snap refresh --"$CORE_CHANNEL" core | ||
| + else | ||
| + # use parameterized core channel (defaults to edge) instead | ||
| + # of a fixed one and close to stable in order to detect defects | ||
| + # earlier | ||
| + snap install --"$CORE_CHANNEL" core | ||
| + fi | ||
| snap list | grep core | ||
| systemctl stop snapd.{service,socket} | ||
| @@ -174,6 +180,11 @@ EOF | ||
| fedora-*|opensuse-*) | ||
| GRUB_EDITENV=grub2-editenv | ||
| ;; | ||
| + raspbian-*) | ||
| + # There is no grub-editenv on raspbian and no package seems to | ||
| + # provide it so we set a command here which will never fail. | ||
| + GRUB_EDITENV=/bin/true | ||
| + ;; | ||
| esac | ||
| echo "Ensure that the grub-editenv list output does not contain any of the snap_* variables on classic" | ||
| @@ -207,18 +218,27 @@ EOF | ||
| systemctl start snapd.socket | ||
| fi | ||
| - if [[ "$SPREAD_SYSTEM" == debian-* || "$SPREAD_SYSTEM" == ubuntu-* ]]; then | ||
| - if [[ "$SPREAD_SYSTEM" == ubuntu-* ]]; then | ||
| - quiet apt install -y -q pollinate | ||
| - pollinate | ||
| - fi | ||
| + case "$SPREAD_SYSTEM" in | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| + if [[ "$SPREAD_SYSTEM" == ubuntu-* ]]; then | ||
| + quiet apt install -y -q pollinate | ||
| + pollinate | ||
| + fi | ||
| - # Improve entropy for the whole system quite a lot to get fast | ||
| - # key generation during our test cycles | ||
| - apt-get install -y -q rng-tools | ||
| - echo "HRNGDEVICE=/dev/urandom" > /etc/default/rng-tools | ||
| - /etc/init.d/rng-tools restart | ||
| - fi | ||
| + HWRNGDEVICE=/dev/urandom | ||
| + if [[ "$SPREAD_SYSTEM" == raspbian-* ]]; then | ||
| + # On Raspberry Pi devices we have a real hardware random number | ||
| + # generator available. | ||
| + HWRNGDEVICE=/dev/hwrng | ||
| + fi | ||
| + | ||
| + # Improve entropy for the whole system quite a lot to get fast | ||
| + # key generation during our test cycles | ||
| + apt-get install -y -q rng-tools | ||
| + echo "HRNGDEVICE=$HWRNGDEVICE" > /etc/default/rng-tools | ||
| + /etc/init.d/rng-tools restart | ||
| + ;; | ||
| + esac | ||
| disable_kernel_rate_limiting | ||
| } | ||
View
2
tests/lib/reset.sh
| @@ -13,7 +13,7 @@ reset_classic() { | ||
| systemctl stop snapd.service snapd.socket | ||
| case "$SPREAD_SYSTEM" in | ||
| - ubuntu-*|debian-*) | ||
| + ubuntu-*|debian-*|raspbian-*) | ||
| sh -x "${SPREAD_PATH}/debian/snapd.postrm" purge | ||
| ;; | ||
| fedora-*|opensuse-*) | ||
View
15
tests/lib/snaps.sh
| @@ -23,12 +23,15 @@ mksnap_fast() { | ||
| dir="$1" | ||
| snap="$2" | ||
| - if [[ "$SPREAD_SYSTEM" == ubuntu-14.04-* ]]; then | ||
| - # trusty does not support -Xcompression-level 1 | ||
| - mksquashfs "$dir" "$snap" -comp gzip | ||
| - else | ||
| - mksquashfs "$dir" "$snap" -comp gzip -Xcompression-level 1 | ||
| - fi | ||
| + case "$SPREAD_SYSTEM" in | ||
| + ubuntu-14.04-*|raspbian-*) | ||
| + # trusty/raspbian does not support -Xcompression-level 1 | ||
| + mksquashfs "$dir" "$snap" -comp gzip | ||
| + ;; | ||
| + *) | ||
| + mksquashfs "$dir" "$snap" -comp gzip -Xcompression-level 1 | ||
| + ;; | ||
| + esac | ||
| } | ||
| install_generic_consumer() { | ||
View
5
tests/main/debs-have-built-using/task.yaml
| @@ -1,6 +1,11 @@ | ||
| summary: Ensure that our debs have the "built-using" header | ||
| systems: [-ubuntu-core-*] | ||
| execute: | | ||
| + if [ "$SRU_VALIDATION" -eq 1 ]; then | ||
| + # Do not run test case when we're running for SRU validation | ||
| + # as in that case we don't have a package available. | ||
| + exit 0 | ||
| + fi | ||
| out=$(dpkg -I $GOHOME/snapd_*.deb) | ||
| if [[ "$SPREAD_SYSTEM" = ubuntu-* ]]; then | ||
| # Apparmor & seccomp is only compiled in on Ubuntu for now. | ||
View
4
tests/main/interfaces-alsa/task.yaml
| @@ -62,6 +62,10 @@ execute: | | ||
| snap disconnect generic-consumer:alsa | ||
| snap interfaces | MATCH "$DISCONNECTED_PATTERN" | ||
| + if [ "$(snap debug confinement)" = none ]; then | ||
| + exit 0 | ||
| + fi | ||
| + | ||
| echo "The snap is not able to access snd devices" | ||
| if generic-consumer.cmd touch /dev/snd/mysnd-dev 2>snd-create.error; then | ||
| echo "Create snd device with disconnected plug should fail" | ||
View
4
tests/main/interfaces-firewall-control/task.yaml
| @@ -79,6 +79,10 @@ execute: | | ||
| snap disconnect firewall-control-consumer:firewall-control | ||
| snap interfaces | MATCH "$DISCONNECTED_PATTERN" | ||
| + if [ "$(snap debug confinement)" = none ]; then | ||
| + exit 0 | ||
| + fi | ||
| + | ||
| echo "Then the snap is not able to configure the firewall" | ||
| if firewall-control-consumer.create 2>firewall-create.error; then | ||
| echo "Expected permission error creating firewall rules with disconnected plug" | ||
View
4
tests/main/interfaces-network/task.yaml
| @@ -64,6 +64,10 @@ execute: | | ||
| echo "Then the snap is able to access a network service" | ||
| network-consumer http://127.0.0.1:$PORT | grep -Pqz "ok\n" | ||
| + if [ "$(snap debug confinement)" = none ]; then | ||
| + exit 0 | ||
| + fi | ||
| + | ||
| echo "============================================" | ||
| echo "When the plug is disconnected" | ||
Oops, something went wrong.