github.com/kubiko/snapd@v0.0.0-20201013125620-d4f3094d9ddf/spread.yaml (about)

     1  project: snapd
     2  
     3  environment:
     4      GOHOME: /home/gopath
     5      GOPATH: $GOHOME
     6      REUSE_PROJECT: '$(HOST: echo "$REUSE_PROJECT")'
     7      PROJECT_PATH: $GOHOME/src/github.com/snapcore/snapd
     8      # /usr/lib/go-1.6/bin for trusty (needs to be last as we use
     9      # a different go in gccgo tests)
    10      PATH: $GOHOME/bin:/snap/bin:$PATH:/usr/lib/go-1.6/bin:/var/lib/snapd/snap/bin:$PROJECT_PATH/tests/bin
    11      TESTSLIB: $PROJECT_PATH/tests/lib
    12      TESTSTOOLS: $PROJECT_PATH/tests/lib/tools
    13      SNAPPY_TESTING: 1
    14      # we run the entire suite with re-exec on (the default) and modify
    15      # the core snap so that it contains our new code.  So we run new
    16      # snapd from the deb that re-execs into new snapd in core.  To
    17      # test purely from the deb, set "export SPREAD_SNAP_REEXEC=0"
    18      SNAP_REEXEC: '$(HOST: echo "${SPREAD_SNAP_REEXEC:-}")'
    19      MODIFY_CORE_SNAP_FOR_REEXEC: '$(HOST: echo "${SPREAD_MODIFY_CORE_SNAP_FOR_REEXEC:-1}")'
    20      SPREAD_STORE_USER: '$(HOST: echo "$SPREAD_STORE_USER")'
    21      SPREAD_STORE_PASSWORD: '$(HOST: echo "$SPREAD_STORE_PASSWORD")'
    22      SPREAD_STORE_EXPIRED_MACAROON: '$(HOST: echo "$SPREAD_STORE_EXPIRED_MACAROON")'
    23      SPREAD_STORE_EXPIRED_DISCHARGE: '$(HOST: echo "$SPREAD_STORE_EXPIRED_DISCHARGE")'
    24      SPREAD_DEBUG_EACH: '$(HOST: echo "${SPREAD_DEBUG_EACH:-1}")'
    25      LANG: "C.UTF-8"
    26      LANGUAGE: "en"
    27      # important to ensure adhoc and linode/qemu behave the same
    28      SUDO_USER: ""
    29      SUDO_UID: ""
    30      TRUST_TEST_KEYS: '$(HOST: echo "${SPREAD_TRUST_TEST_KEYS:-true}")'
    31      MANAGED_DEVICE: "false"
    32      LXD_SNAP_CHANNEL: "latest/candidate"
    33      CORE_CHANNEL: '$(HOST: echo "${SPREAD_CORE_CHANNEL:-edge}")'
    34      BASE_CHANNEL: '$(HOST: echo "${SPREAD_BASE_CHANNEL:-edge}")'
    35      KERNEL_CHANNEL: '$(HOST: echo "${SPREAD_KERNEL_CHANNEL:-edge}")'
    36      GADGET_CHANNEL: '$(HOST: echo "${SPREAD_GADGET_CHANNEL:-edge}")'
    37      SNAPD_CHANNEL: '$(HOST: echo "${SPREAD_SNAPD_CHANNEL:-edge}")'
    38      REMOTE_STORE: '$(HOST: echo "${SPREAD_REMOTE_STORE:-production}")'
    39      SNAPPY_USE_STAGING_STORE: '$(HOST: if [ "$SPREAD_REMOTE_STORE" = staging ]; then echo 1; else echo 0; fi)'
    40      DELTA_REF: 2.46
    41      DELTA_PREFIX: snapd-$DELTA_REF/
    42      REPACK_KEEP_VENDOR: '$(HOST: echo "${REPACK_KEEP_VENDOR:-n}")'
    43      SNAPD_PUBLISHED_VERSION: '$(HOST: echo "$SPREAD_SNAPD_PUBLISHED_VERSION")'
    44      HTTP_PROXY: '$(HOST: echo "$SPREAD_HTTP_PROXY")'
    45      HTTPS_PROXY: '$(HOST: echo "$SPREAD_HTTPS_PROXY")'
    46      NO_PROXY: "127.0.0.1"
    47      NEW_CORE_CHANNEL: '$(HOST: echo "$SPREAD_NEW_CORE_CHANNEL")'
    48      SRU_VALIDATION: '$(HOST: echo "${SPREAD_SRU_VALIDATION:-0}")'
    49      # use the ppa_validation_name to install snapd from that ppa
    50      PPA_VALIDATION_NAME: '$(HOST: echo "${SPREAD_PPA_VALIDATION_NAME:-}")'
    51      PRE_CACHE_SNAPS: test-snapd-tools test-snapd-sh jq
    52      # always skip removing the rsync snap
    53      SKIP_REMOVE_SNAPS: '$(HOST: echo "${SPREAD_SKIP_REMOVE_SNAPS:-}") test-snapd-rsync test-snapd-rsync-core18 test-snapd-rsync-core20'
    54      # Use the installed snapd and reset the systems without removing snapd
    55      REUSE_SNAPD: '$(HOST: echo "${SPREAD_REUSE_SNAPD:-0}")'
    56      PROFILE_SNAPS: '$(HOST: echo "${SPREAD_PROFILE_SNAPS:-0}")'
    57  
    58      # Directory where the nested images and test assets are stored
    59      NESTED_WORK_DIR: '$(HOST: echo "${NESTED_WORK_DIR:-/tmp/work-dir}")'
    60      # Channel used to create the nested vm
    61      NESTED_CORE_CHANNEL: '$(HOST: echo "${NESTED_CORE_CHANNEL:-edge}")'
    62      # Use cloud init to make initial system configuration instead of user assertion
    63      NESTED_CORE_REFRESH_CHANNEL: '$(HOST: echo "${NESTED_CORE_REFRESH_CHANNEL:-edge}")'
    64      # Use cloud init to make initial system configuration instead of user assertion
    65      NESTED_USE_CLOUD_INIT: '$(HOST: echo "${NESTED_USE_CLOUD_INIT:-true}")'
    66      # Build and use snapd from current branch
    67      NESTED_BUILD_SNAPD_FROM_CURRENT: '$(HOST: echo "${NESTED_BUILD_SNAPD_FROM_CURRENT:-true}")'
    68      # Download and use an custom image from this url
    69      NESTED_CUSTOM_IMAGE_URL: '$(HOST: echo "${NESTED_CUSTOM_IMAGE_URL:-}")'
    70      # Configure nested images to be reused on the following tests
    71      NESTED_CONFIGURE_IMAGES: '$(HOST: echo "${NESTED_CONFIGURE_IMAGES:-false}")'
    72  
    73  backends:
    74      google:
    75          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
    76          location: computeengine/us-east1-b
    77          halt-timeout: 2h
    78          systems:
    79              - ubuntu-14.04-64:
    80                    workers: 6
    81              - ubuntu-16.04-32:
    82                    workers: 6
    83              - ubuntu-16.04-64:
    84                    workers: 8
    85              - ubuntu-18.04-64:
    86                    workers: 8
    87              - ubuntu-20.04-64:
    88                    workers: 8
    89              - ubuntu-core-16-64:
    90                    image: ubuntu-16.04-64
    91                    workers: 6
    92              - ubuntu-core-18-64:
    93                    image: ubuntu-16.04-64
    94                    workers: 6
    95              - ubuntu-core-20-64:
    96                    image: ubuntu-2004-64-virt-enabled
    97                    workers: 6
    98                    storage: 20G
    99              - ubuntu-secboot-20.04-64:
   100                    image: ubuntu-20.04-64
   101                    workers: 1
   102                    secure-boot: true
   103                    # XXX: old name, remove once new spread is deployed
   104                    secureboot: true
   105  
   106              - debian-9-64:
   107                    workers: 6
   108              - debian-sid-64:
   109                    workers: 6
   110  
   111              - fedora-30-64:
   112                    workers: 6
   113                    manual: true
   114              - fedora-31-64:
   115                    workers: 6
   116              - fedora-32-64:
   117                    workers: 6
   118  
   119              - arch-linux-64:
   120                    workers: 6
   121              - amazon-linux-2-64:
   122                    workers: 6
   123                    storage: preserve-size
   124  
   125              - centos-7-64:
   126                    workers: 6
   127                    storage: preserve-size
   128                    image: centos-7-64
   129              # unstable systems below
   130              - opensuse-15.1-64:
   131                    workers: 6
   132              - opensuse-15.2-64:
   133                    workers: 6
   134              - opensuse-tumbleweed-64:
   135                    workers: 6
   136              - centos-8-64:
   137                    workers: 4
   138                    storage: preserve-size
   139                    image: centos-8-64
   140              - ubuntu-20.10-64:
   141                    workers: 6
   142                    image: ubuntu-os-cloud-devel/ubuntu-2010
   143  
   144      google-sru:
   145          type: google
   146          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
   147          location: computeengine/us-east1-b
   148          halt-timeout: 2h
   149          systems:
   150              - ubuntu-16.04-64:
   151                    workers: 6
   152              - ubuntu-18.04-64:
   153                    workers: 6
   154              - ubuntu-20.04-64:
   155                    workers: 6
   156  
   157      google-nested:
   158          type: google
   159          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
   160          location: computeengine/us-east1-b
   161          plan: n1-standard-2
   162          halt-timeout: 2h
   163          systems:
   164              - ubuntu-16.04-64:
   165                    image: ubuntu-1604-64-virt-enabled
   166                    storage: 20G
   167                    workers: 3
   168              - ubuntu-18.04-64:
   169                    image: ubuntu-1804-64-virt-enabled
   170                    storage: 20G
   171                    workers: 3
   172              - ubuntu-20.04-64:
   173                    image: ubuntu-2004-64-virt-enabled
   174                    storage: 20G
   175                    workers: 6
   176  
   177      qemu-nested:
   178          memory: 4G
   179          type: qemu
   180          systems:
   181              - ubuntu-16.04-64:
   182                    username: ubuntu
   183                    password: ubuntu
   184              - ubuntu-18.04-64:
   185                    username: ubuntu
   186                    password: ubuntu
   187              - ubuntu-20.04-64:
   188                    username: ubuntu
   189                    password: ubuntu
   190  
   191      qemu:
   192          # TODO:UC20: uc20 needs 2G or grub will not loopback the kernel snap
   193          memory: 2G
   194          systems:
   195              - ubuntu-14.04-32:
   196                    username: ubuntu
   197                    password: ubuntu
   198              - ubuntu-14.04-64:
   199                    username: ubuntu
   200                    password: ubuntu
   201              - ubuntu-16.04-32:
   202                    username: ubuntu
   203                    password: ubuntu
   204              - ubuntu-16.04-64:
   205                    username: ubuntu
   206                    password: ubuntu
   207              - ubuntu-core-16-64:
   208                    image: ubuntu-16.04-64
   209                    username: ubuntu
   210                    password: ubuntu
   211              - ubuntu-core-18-64:
   212                    image: ubuntu-16.04-64
   213                    username: ubuntu
   214                    password: ubuntu
   215              - ubuntu-core-20-64:
   216                    image: ubuntu-20.04-64
   217                    username: ubuntu
   218                    password: ubuntu
   219                    flags: [virtio]
   220              - ubuntu-18.04-64:
   221                    username: ubuntu
   222                    password: ubuntu
   223              - ubuntu-18.04-32:
   224                    username: ubuntu
   225                    password: ubuntu
   226              - ubuntu-20.04-64:
   227                    username: ubuntu
   228                    password: ubuntu
   229              - ubuntu-20.04-32:
   230                    username: ubuntu
   231                    password: ubuntu
   232              - ubuntu-20.10-64:
   233                    username: ubuntu
   234                    password: ubuntu
   235              - debian-sid-64:
   236                    username: debian
   237                    password: debian
   238              - debian-9-64:
   239                    username: debian
   240                    password: debian
   241              - debian-sid-64:
   242                    username: debian
   243                    password: debian
   244              - centos-7-64:
   245                    username: centos
   246                    password: centos
   247              - amazon-linux-2-64:
   248                    username: ec2-user
   249                    password: ec2-user
   250              - opensuse-15.2-64:
   251                    username: opensuse
   252                    password: opensuse
   253              - opensuse-tumbleweed-64:
   254                    username: opensuse
   255                    password: opensuse
   256      autopkgtest:
   257          type: adhoc
   258          allocate: |
   259              echo "Allocating ad-hoc $SPREAD_SYSTEM"
   260              if [ -z "${ADT_ARTIFACTS}" ]; then
   261                  FATAL "adhoc only works inside autopkgtest"
   262                  exit 1
   263              fi
   264              echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99-spread-users
   265              ADDRESS localhost:22
   266          discard: |
   267              echo "Discarding ad-hoc $SPREAD_SYSTEM"
   268          systems:
   269              # Trusty
   270              - ubuntu-14.04-amd64:
   271                    username: ubuntu
   272                    password: ubuntu
   273              - ubuntu-14.04-i386:
   274                    username: ubuntu
   275                    password: ubuntu
   276              # Xenial
   277              - ubuntu-16.04-amd64:
   278                    username: ubuntu
   279                    password: ubuntu
   280              - ubuntu-16.04-i386:
   281                    username: ubuntu
   282                    password: ubuntu
   283              - ubuntu-16.04-ppc64el:
   284                    username: ubuntu
   285                    password: ubuntu
   286              - ubuntu-16.04-armhf:
   287                    username: ubuntu
   288                    password: ubuntu
   289              - ubuntu-16.04-s390x:
   290                    username: ubuntu
   291                    password: ubuntu
   292              # Artful
   293              - ubuntu-17.10-amd64:
   294                    username: ubuntu
   295                    password: ubuntu
   296              - ubuntu-17.10-i386:
   297                    username: ubuntu
   298                    password: ubuntu
   299              - ubuntu-17.10-ppc64el:
   300                    username: ubuntu
   301                    password: ubuntu
   302              - ubuntu-17.10-armhf:
   303                    username: ubuntu
   304                    password: ubuntu
   305              - ubuntu-17.10-s390x:
   306                    username: ubuntu
   307                    password: ubuntu
   308              # Bionic
   309              - ubuntu-18.04-amd64:
   310                    username: ubuntu
   311                    password: ubuntu
   312              - ubuntu-18.04-i386:
   313                    username: ubuntu
   314                    password: ubuntu
   315              - ubuntu-18.04-ppc64el:
   316                    username: ubuntu
   317                    password: ubuntu
   318              - ubuntu-18.04-armhf:
   319                    username: ubuntu
   320                    password: ubuntu
   321              - ubuntu-18.04-s390x:
   322                    username: ubuntu
   323                    password: ubuntu
   324              - ubuntu-18.04-arm64:
   325                    username: ubuntu
   326                    password: ubuntu
   327              # Focal
   328              - ubuntu-20.04-amd64:
   329                    username: ubuntu
   330                    password: ubuntu
   331              - ubuntu-20.04-i386:
   332                    username: ubuntu
   333                    password: ubuntu
   334              - ubuntu-20.04-ppc64el:
   335                    username: ubuntu
   336                    password: ubuntu
   337              - ubuntu-20.04-armhf:
   338                    username: ubuntu
   339                    password: ubuntu
   340              - ubuntu-20.04-s390x:
   341                    username: ubuntu
   342                    password: ubuntu
   343              - ubuntu-20.04-arm64:
   344                    username: ubuntu
   345                    password: ubuntu
   346  
   347      external:
   348          type: adhoc
   349          environment:
   350              SPREAD_EXTERNAL_ADDRESS: '$(HOST: echo "${SPREAD_EXTERNAL_ADDRESS:-localhost:8022}")'
   351              MANAGED_DEVICE: "true"
   352              TRUST_TEST_KEYS: "false"
   353          allocate: |
   354              ADDRESS $SPREAD_EXTERNAL_ADDRESS
   355          systems:
   356              - ubuntu-core-16-64:
   357                    username: external
   358                    password: ubuntu
   359              - ubuntu-core-16-32:
   360                    username: external
   361                    password: ubuntu
   362              - ubuntu-core-16-arm-64:
   363                    username: external
   364                    password: ubuntu
   365              - ubuntu-core-16-arm-32:
   366                    username: external
   367                    password: ubuntu
   368              - ubuntu-core-18-64:
   369                    username: external
   370                    password: ubuntu
   371              - ubuntu-core-18-32:
   372                    username: external
   373                    password: ubuntu
   374              - ubuntu-core-18-arm-64:
   375                    username: external
   376                    password: ubuntu
   377              - ubuntu-core-18-arm-32:
   378                    username: external
   379                    password: ubuntu
   380              - ubuntu-core-20-64:
   381                    username: external
   382                    password: ubuntu
   383              - ubuntu-core-20-32:
   384                    username: external
   385                    password: ubuntu
   386              - ubuntu-core-20-arm-64:
   387                    username: external
   388                    password: ubuntu
   389              - ubuntu-core-20-arm-32:
   390                    username: external
   391                    password: ubuntu
   392  
   393  path: /home/gopath/src/github.com/snapcore/snapd
   394  
   395  exclude:
   396      - .git
   397      - cmd/snap/snap
   398      - cmd/snapd/snapd
   399      - cmd/snapctl/snapctl
   400      - cmd/snap-exec/snap-exec
   401      - cmd/autom4te.cache
   402      - "*.o"
   403      - "*.a"
   404      - ./vendor
   405      - "*.snap"
   406      - "*.img"
   407  
   408  debug-each: |
   409      if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
   410          #shellcheck source=tests/lib/state.sh
   411          . "$TESTSLIB/state.sh"
   412          #shellcheck source=tests/lib/nested.sh
   413          . "$TESTSLIB/nested.sh"
   414  
   415          echo '# System information'
   416          cat /etc/os-release || true
   417  
   418          echo '# Kernel information'
   419          uname -a
   420  
   421          echo '# Go information'
   422          go version || true
   423  
   424          if nested_is_nested_system; then
   425              echo '# nested VM status'
   426              systemctl status nested-vm || true
   427              journalctl --no-pager -u nested-vm || true
   428              nested_print_serial_log
   429                  # add another echo in case the serial log is missing a newline
   430                  echo
   431  
   432              nested_exec sudo journalctl --no-pager -u snapd || true
   433          fi
   434  
   435          echo '# journal messages for snapd'
   436          "$TESTSTOOLS"/journal-state get-log -u snapd
   437          case "$SPREAD_SYSTEM" in
   438              fedora-*|centos-*|amazon-*)
   439                  if [ -e "$RUNTIME_STATE_PATH/audit-stamp" ]; then
   440                      ausearch -i -m AVC --checkpoint "$RUNTIME_STATE_PATH/audit-stamp" --start checkpoint || true
   441                  else
   442                      ausearch -i -m AVC || true
   443                  fi
   444                  (
   445                      find /root/snap -printf '%Z\t%H/%P\n' || true
   446                      find /home -regex '/home/[^/]*/snap\(/.*\)?' -printf '%Z\t%H/%P\n' || true
   447                  ) | grep -v snappy_home_t || true
   448                  find /var/snap -printf '%Z\t%H/%P\n' | grep -v snappy_var_t || true
   449                  ;;
   450              *)
   451                 echo '# apparmor denials '
   452                 dmesg --ctime | grep DENIED || true
   453                 ;;
   454          esac
   455          echo '# seccomp denials (kills) '
   456          dmesg --ctime | grep type=1326 || true
   457          echo '# snap connections --all'
   458          snap connections --all || true
   459          echo '# tasks executed on system'
   460          cat "$RUNTIME_STATE_PATH/runs" || true
   461          echo '# free space'
   462          df -h || true
   463          echo '# mounts'
   464          # use ascii output to prevent travis from messing up the encoding
   465          findmnt --ascii -o+PROPAGATION || true
   466          echo "# processes"
   467          ps aux
   468          echo "# /var/lib/snapd"
   469          find /var/lib/snapd/ -not -path '/var/lib/snapd/snap/*' -ls || true
   470      fi
   471  
   472  rename:
   473      # Move content into a directory, so that deltas computed by repack benefit
   474      # from the content looking similar to codeload.github.com.
   475      - s,^,$DELTA_PREFIX,S
   476  
   477  repack: |
   478      # For Linode, compute a delta based on a known git reference that can be
   479      # obtained directly from GitHub. There's nothing special about that reference,
   480      # other than it will often be in the local repository's history already.
   481      # The more recent the reference, the smaller the delta.
   482      if ! echo "$SPREAD_BACKENDS" | grep -e linode -e google; then
   483          cat <&3 >&4
   484      elif ! git show-ref "$DELTA_REF" > /dev/null; then
   485          cat <&3 >&4
   486      else
   487          tmpdir="$(mktemp -d)"
   488          #shellcheck disable=SC2064
   489          trap "rm -rf delta-ref.tar current.delta repacked-current.tar $tmpdir" EXIT
   490          if [ "$REPACK_KEEP_VENDOR" = "n" ]; then
   491              tar -C "$tmpdir" -xvf - <&3
   492              find "$tmpdir/$DELTA_PREFIX/vendor/" ! -wholename "$tmpdir/$DELTA_PREFIX/vendor/" \
   493                  ! -wholename "$tmpdir/$DELTA_PREFIX/vendor/vendor.json" \
   494                  -delete
   495              tar -C "$tmpdir" -c "$DELTA_PREFIX" > repacked-current.tar
   496          else
   497              cat <&3 > repacked-current.tar
   498          fi
   499          git archive -o delta-ref.tar --format=tar --prefix="$DELTA_PREFIX" "$DELTA_REF"
   500          xdelta3 -S none -s delta-ref.tar repacked-current.tar > current.delta
   501          tar c current.delta >&4
   502      fi
   503  
   504  kill-timeout: 30m
   505  
   506  prepare: |
   507      # NOTE: This part of the code needs to be in spread.yaml as it runs before
   508      # the rest of the source code (including the tests/lib directory) is
   509      # around. The purpose of this code is to fix some connectivity issues and
   510      # then apply the delta of the git repository.
   511  
   512      # apt update is hanging on security.ubuntu.com with IPv6, prefer IPv4 over IPv6
   513      cat <<EOF > gai.conf
   514      precedence  ::1/128       50
   515      precedence  ::/0          40
   516      precedence  2002::/16     30
   517      precedence ::/96          20
   518      precedence ::ffff:0:0/96 100
   519      EOF
   520      if ! mv gai.conf /etc/gai.conf; then
   521          echo "/etc/gai.conf is not writable, ubuntu-core system? apt update won't be affected in that case"
   522          rm -f gai.conf
   523      fi
   524      if command -v restorecon ; then
   525          # restore proper context otherwise SELinux may complain
   526          restorecon -v /etc/gai.conf
   527      fi
   528  
   529      if [[ "$SPREAD_SYSTEM" == fedora-* ]]; then
   530          # The Fedora archive mirror seems to be unreliable.
   531          # Switch to the main archive by commenting out metalink and uncommenting
   532          # baseurl with a tweak to go to dl.fedoraproject.org which doens't redirect
   533          # to mirrors again.
   534          #
   535          # https://forum.snapcraft.io/t/issues-with-the-fedora-mirror-network/3489/
   536          sed -i -s -E -e 's@^#?baseurl=http://download.fedoraproject.org/@baseurl=http://dl.fedoraproject.org/@g' -e 's@^metalink=@#metalink@g' /etc/yum.repos.d/fedora*.repo
   537  
   538          dnf --refresh -y makecache
   539  
   540          # enable audit daemon
   541          systemctl enable --now auditd.service
   542      fi
   543      if [[ "$SPREAD_SYSTEM" == opensuse-* ]]; then
   544          # refresh metadatadata
   545          zypper ref
   546          # We seem to be hitting a flaky openSUSE mirror from time to time,
   547          # increase the number of download attempts libzypp will try to
   548          # workaround that.
   549          cat <<-EOF >> /etc/zypp/zypp.conf
   550      # added by spread tests
   551      download.max_silent_tries = 20
   552      EOF
   553      fi
   554  
   555      if [[ "$SPREAD_SYSTEM" == arch-* ]]; then
   556          # Possible that AppArmor was not started and is not enabled in the
   557          # image, do both now
   558          if systemctl show -p LoadState apparmor.service | MATCH 'LoadState=loaded' ; then
   559              if ! systemctl is-enabled apparmor.service; then
   560                  systemctl enable apparmor.service
   561              fi
   562              systemctl start apparmor.service
   563          else
   564              exit 1
   565          fi
   566      fi
   567  
   568      if [[ "$SPREAD_SYSTEM" == debian-* ]]; then
   569          apt-get update && apt-get install -y eatmydata
   570      fi
   571  
   572      if [[ "$SPREAD_SYSTEM" == centos-* ]]; then
   573          # make sure EPEL is enabled
   574          yum install -y epel-release
   575      fi
   576  
   577      # Unpack delta, or move content out of the prefixed directory (see rename and repack above).
   578      # (needs to be in spread.yaml directly because there's nothing else on the filesystem yet)
   579      if [ -f current.delta ]; then
   580          tf=$(mktemp)
   581          # NOTE: We can't use tests/lib/pkgdb.sh here as it doesn't exist at
   582          # this time when none of the test files is yet in place.
   583          case "$SPREAD_SYSTEM" in
   584              ubuntu-*|debian-*)
   585                  apt-get update >& "$tf" || ( cat "$tf"; exit 1 )
   586                  apt-get install -y xdelta3 curl eatmydata >& "$tf" || ( cat "$tf"; exit 1 )
   587                  ;;
   588              amazon-*|centos-7-*)
   589                  yum install -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
   590                  ;;
   591              fedora-*|centos-*)
   592                  dnf install --refresh -y xdelta curl &> "$tf" || (cat "$tf"; exit 1)
   593                  ;;
   594              opensuse-*)
   595                  zypper -q --gpg-auto-import-keys refresh
   596                  zypper -q install -y xdelta3 curl &> "$tf" || (cat "$tf"; exit 1)
   597                  ;;
   598              arch-*)
   599                  # NOTE: we ought to do pacman -Syu, but this may update the
   600                  # kernel which we will not detect at this stage and fail to
   601                  # reboot; actual distro upgrade is done later in prepare
   602                  pacman -Sy --noconfirm xdelta3 curl &> "$tf" || (cat "$tf"; exit 1)
   603                  ;;
   604          esac
   605          rm -f "$tf"
   606          curl -sS -o - "https://codeload.github.com/snapcore/snapd/tar.gz/$DELTA_REF" | gunzip > delta-ref.tar
   607          xdelta3 -q -c -d -s delta-ref.tar current.delta | tar x --strip-components=1
   608          rm -f delta-ref.tar current.delta
   609      elif [ -d "$DELTA_PREFIX" ]; then
   610          find "$DELTA_PREFIX" -mindepth 1 -maxdepth 1 -exec mv {} . \;
   611          rmdir "$DELTA_PREFIX"
   612      fi
   613  
   614      # Take the MATCH and REBOOT functions from spread and allow our shell
   615      # scripts to use them as shell commands. The replacements are real
   616      # executables in tests/lib/bin (which is on PATH) but they source
   617      # spread-funcs.sh written here, base on the definitions provided by SPREAD.
   618      # This ensures that 1) spread functions define the code 2) both MATCH and
   619      # REBOOT are executables and not functions, and can be called from any
   620      # context.
   621      type MATCH | tail -n +2 > "$TESTSLIB"/spread-funcs.sh
   622      unset MATCH
   623      type REBOOT | tail -n +2 >> "$TESTSLIB"/spread-funcs.sh
   624      unset REBOOT
   625  
   626      # NOTE: At this stage the source tree is available and no more special
   627      # considerations apply.
   628      "$TESTSLIB"/prepare-restore.sh --prepare-project
   629  prepare-each: |
   630      "$TESTSLIB"/prepare-restore.sh --prepare-project-each
   631  restore: |
   632      "$TESTSLIB"/prepare-restore.sh --restore-project
   633  restore-each: |
   634      "$TESTSLIB"/prepare-restore.sh --restore-project-each
   635  suites:
   636      tests/lib/tools/suite/:
   637          summary: Tests for tests/lib/tools tools
   638          prepare-each: |
   639              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each-minimal-no-snaps
   640          restore-each: |
   641              "$TESTSLIB"/prepare-restore.sh --restore-suite-each-minimal-no-snaps
   642      # The essential tests designed to run inside the autopkgtest
   643      # environment on each platform. On autopkgtest we cannot run all tests
   644      # as this is very slow and we run into timeouts.
   645      #
   646      # These tests are executed on all other plattforms as they
   647      # are designed to run on pristine systems
   648      tests/smoke/:
   649          summary: Essential system level tests for snapd
   650          prepare: |
   651              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   652          prepare-each: |
   653              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   654          restore-each: |
   655              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   656          restore: |
   657              "$TESTSLIB"/prepare-restore.sh --restore-suite
   658      # All other tests run now and will heavily modify the system.
   659      tests/main/:
   660          summary: Full-system tests for snapd
   661          systems: [-ubuntu-secboot-*]
   662          prepare: |
   663              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   664          prepare-each: |
   665              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   666          restore-each: |
   667              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   668          restore: |
   669              "$TESTSLIB"/prepare-restore.sh --restore-suite
   670          debug: |
   671              if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
   672                  systemctl status snapd.socket || true
   673                  journalctl -e
   674              fi
   675      tests/core/:
   676          summary: Subset of Ubuntu Core specific tests
   677          systems: [ubuntu-core-*]
   678          prepare: |
   679              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   680          prepare-each: |
   681              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   682          restore-each: |
   683              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   684          restore: |
   685              "$TESTSLIB"/prepare-restore.sh --restore-suite
   686      tests/completion/:
   687          summary: completion tests
   688          # ppc64el disabled because of https://bugs.launchpad.net/snappy/+bug/1655594
   689          systems: [-ubuntu-core-*, -ubuntu-*-ppc64el, -ubuntu-secboot-*]
   690          prepare: |
   691              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   692          prepare-each: |
   693              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   694          restore-each: |
   695              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   696          restore: |
   697              "$TESTSLIB"/prepare-restore.sh --restore-suite
   698          environment:
   699              _/plain: _
   700              _/plain_plusdirs: _
   701              _/funky: _
   702              _/files: _
   703              # dirs fails on indirection because of (mis)handling of trailing
   704              # slashes. This might be configuration-dependent.
   705              # _/dirs: _
   706              _/hosts: _
   707              _/hosts_n_dirs: _
   708              # twisted fails in travis (but not regular spread).
   709              # _/twisted: _
   710              _/func: _
   711              _/funkyfunc: _
   712              _/funcarg: _
   713  
   714      tests/regression/:
   715          summary: Regression tests for snapd
   716          systems: [-ubuntu-secboot-*]
   717          prepare: |
   718              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   719          prepare-each: |
   720              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   721          restore-each: |
   722              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   723          restore: |
   724              "$TESTSLIB"/prepare-restore.sh --restore-suite
   725  
   726      tests/upgrade/:
   727          summary: Tests for snapd upgrade
   728          # Test cases are not yet ported to openSUSE that is why we keep
   729          # it disabled. A later PR will enable most tests and
   730          # drop this blacklist.
   731          systems: [-ubuntu-core-*, -opensuse-*, -ubuntu-secboot-*]
   732          prepare-each: |
   733              # FIXME: this should really use prepare-restore.sh --prepare-suite-each
   734              # like other suites, needs more investigation
   735  
   736              # shellcheck source=tests/lib/state.sh
   737              . "$TESTSLIB"/state.sh
   738              mkdir -p "$RUNTIME_STATE_PATH"
   739              # save the job which is going to be executed in the system
   740              echo -n "$SPREAD_JOB " >> "$RUNTIME_STATE_PATH/runs"
   741          restore: |
   742              if [ "$REMOTE_STORE" = staging ]; then
   743                  echo "skip upgrade tests while talking to the staging store"
   744                  exit 0
   745              fi
   746          restore-each: |
   747              if [ "$REMOTE_STORE" = staging ]; then
   748                  echo "skip upgrade tests while talking to the staging store"
   749                  exit 0
   750              fi
   751              #shellcheck source=tests/lib/pkgdb.sh
   752              . "$TESTSLIB"/pkgdb.sh
   753              distro_purge_package snapd
   754              distro_purge_package snapd-xdg-open || true
   755      tests/cross/:
   756          summary: Cross-compile tests
   757          systems: [ubuntu-16.04-64, ubuntu-18.04-64]
   758  
   759      tests/unit/:
   760          summary: Suite to run unit tests (non-go and different go runtimes)
   761          # Test cases are not yet ported to Fedora/openSUSE/Arch that is why
   762          # we keep them disabled. A later PR will enable most tests and
   763          # drop this blacklist.
   764          systems:
   765              [
   766                  -ubuntu-core-*,
   767                  -fedora-*,
   768                  -opensuse-*,
   769                  -arch-*,
   770                  -amazon-*,
   771                  -centos-*,
   772                  -ubuntu-secboot-*,
   773              ]
   774          # unittests are run as part of the autopkgtest build already
   775          backends: [-autopkgtest]
   776          environment:
   777              # env vars required for coverage reporting from a spread task
   778              TRAVIS_BUILD_NUMBER: '$(HOST: echo "$TRAVIS_BUILD_NUMBER")'
   779              TRAVIS_BRANCH: '$(HOST: echo "$TRAVIS_BRANCH")'
   780              TRAVIS_COMMIT: '$(HOST: echo "$TRAVIS_COMMIT")'
   781              TRAVIS_JOB_NUMBER: '$(HOST: echo "$TRAVIS_JOB_NUMBER")'
   782              TRAVIS_PULL_REQUEST: '$(HOST: echo "$TRAVIS_PULL_REQUEST")'
   783              TRAVIS_JOB_ID: '$(HOST: echo "$TRAVIS_JOB_ID")'
   784              TRAVIS_REPO_SLUG: '$(HOST: echo "$TRAVIS_REPO_SLUG")'
   785              TRAVIS_TAG: '$(HOST: echo "$TRAVIS_TAG")'
   786              COVERMODE: '$(HOST: echo "$COVERMODE")'
   787          prepare: |
   788              #shellcheck source=tests/lib/prepare.sh
   789              . "$TESTSLIB"/prepare.sh
   790              prepare_classic
   791          prepare-each: |
   792              "$TESTSLIB"/reset.sh --reuse-core
   793              #shellcheck source=tests/lib/prepare.sh
   794              . "$TESTSLIB"/prepare.sh
   795              prepare_each_classic
   796          restore: |
   797              "$TESTSLIB"/reset.sh --store
   798              #shellcheck source=tests/lib/pkgdb.sh
   799              . "$TESTSLIB"/pkgdb.sh
   800  
   801              distro_purge_package snapd
   802              case "$SPREAD_SYSTEM" in
   803                  arch-*)
   804                      # there is no snap-confine and ubuntu-core-launcher
   805                      # in Arch
   806                      ;;
   807                  *)
   808                      distro_purge_package snap-confine ubuntu-core-launcher
   809                      ;;
   810              esac
   811  
   812      tests/nightly/:
   813          summary: Suite for nightly, expensive, tests
   814          manual: true
   815          # Test cases are not yet ported to Fedora/openSUSE/Arch/AMZN2 that is why
   816          # we keep them disabled. A later PR will enable most tests and
   817          # drop this blacklist.
   818          prepare: |
   819              "$TESTSLIB"/prepare-restore.sh --prepare-suite
   820          prepare-each: |
   821              "$TESTSLIB"/prepare-restore.sh --prepare-suite-each
   822          restore-each: |
   823              "$TESTSLIB"/prepare-restore.sh --restore-suite-each
   824          restore: |
   825              "$TESTSLIB"/prepare-restore.sh --restore-suite
   826  
   827      tests/nested/manual/:
   828          summary: Tests for nested images controlled manually from the tests
   829          backends: [google-nested, qemu-nested]
   830          systems:
   831              - ubuntu-16.04-64
   832              - ubuntu-18.04-64
   833              - ubuntu-20.04-64
   834          environment:
   835              NESTED_TYPE: "classic"
   836              # Enable kvm in the qemu command line
   837              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   838              # Enable tpm in the nested vm in case it is supported
   839              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-false}")'
   840              # Enable secure boot in the nested vm in case it is supported
   841              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-false}")'
   842          manual: true
   843          warn-timeout: 10m
   844          kill-timeout: 60m
   845          debug: |
   846              #shellcheck source=tests/lib/nested.sh
   847              . "$TESTSLIB/nested.sh"
   848              nested_print_serial_log
   849          prepare: |
   850              #shellcheck source=tests/lib/pkgdb.sh
   851              . "$TESTSLIB"/pkgdb.sh
   852              distro_update_package_db
   853              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   854              snap install ubuntu-image --classic
   855  
   856              # Install the snapd built
   857              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   858          prepare-each: |
   859              #shellcheck source=tests/lib/nested.sh
   860              . "$TESTSLIB/nested.sh"
   861              nested_prepare_env
   862          restore-each: |
   863              #shellcheck source=tests/lib/nested.sh
   864              . "$TESTSLIB/nested.sh"
   865              nested_destroy_vm
   866              nested_cleanup_env
   867          restore: |
   868              #shellcheck source=tests/lib/nested.sh
   869              . "$TESTSLIB/nested.sh"
   870              nested_cleanup_env
   871  
   872              #shellcheck source=tests/lib/pkgdb.sh
   873              . "$TESTSLIB"/pkgdb.sh
   874              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   875  
   876      tests/nested/classic/:
   877          summary: Tests for nested images
   878          backends: [google-nested, qemu-nested]
   879          systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64]
   880          environment:
   881              NESTED_TYPE: "classic"
   882              # Channel used to create the nested vm
   883              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   884              # Enable tpm in the nested vm in case it is supported
   885              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-false}")'
   886              # Enable secure boot in the nested vm in case it is supported
   887              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-false}")'
   888          manual: true
   889          debug: |
   890              #shellcheck source=tests/lib/nested.sh
   891              . "$TESTSLIB/nested.sh"
   892              nested_print_serial_log
   893          prepare: |
   894              #shellcheck source=tests/lib/pkgdb.sh
   895              . "$TESTSLIB"/pkgdb.sh
   896              distro_update_package_db
   897              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   898              snap install ubuntu-image --classic
   899  
   900              # Install the snapd built
   901              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   902  
   903              #shellcheck source=tests/lib/nested.sh
   904              . "$TESTSLIB/nested.sh"
   905              nested_prepare_env
   906              nested_create_classic_vm
   907          prepare-each: |
   908              #shellcheck source=tests/lib/nested.sh
   909              . "$TESTSLIB/nested.sh"
   910              nested_start_classic_vm
   911          restore-each: |
   912              #shellcheck source=tests/lib/nested.sh
   913              . "$TESTSLIB/nested.sh"
   914              nested_destroy_vm
   915          restore: |
   916              #shellcheck source=tests/lib/nested.sh
   917              . "$TESTSLIB/nested.sh"
   918              nested_cleanup_env
   919  
   920              #shellcheck source=tests/lib/pkgdb.sh
   921              . "$TESTSLIB"/pkgdb.sh
   922              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   923  
   924      tests/nested/core/:
   925          summary: Tests for nested images
   926          backends: [google-nested, qemu-nested]
   927          systems: [ubuntu-16.04-64, ubuntu-18.04-64]
   928          environment:
   929              NESTED_TYPE: "core"
   930              # Enable kvm in the qemu command line
   931              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   932              # Enable tpm in the nested vm in case it is supported
   933              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-false}")'
   934              # Enable secure boot in the nested vm in case it is supported
   935              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-false}")'
   936          manual: true
   937          debug: |
   938              #shellcheck source=tests/lib/nested.sh
   939              . "$TESTSLIB/nested.sh"
   940              nested_print_serial_log
   941          prepare: |
   942              #shellcheck source=tests/lib/pkgdb.sh
   943              . "$TESTSLIB"/pkgdb.sh
   944              distro_update_package_db
   945              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   946              snap install ubuntu-image --classic
   947  
   948              # Install the snapd built
   949              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   950  
   951              #shellcheck source=tests/lib/nested.sh
   952              . "$TESTSLIB/nested.sh"
   953              nested_prepare_env
   954              nested_create_core_vm
   955          prepare-each: |
   956              #shellcheck source=tests/lib/nested.sh
   957              . "$TESTSLIB/nested.sh"
   958              nested_start_core_vm
   959              nested_wait_for_snap_command
   960          restore-each: |
   961              #shellcheck source=tests/lib/nested.sh
   962              . "$TESTSLIB/nested.sh"
   963              nested_destroy_vm
   964          restore: |
   965              #shellcheck source=tests/lib/nested.sh
   966              . "$TESTSLIB/nested.sh"
   967              nested_cleanup_env
   968  
   969              #shellcheck source=tests/lib/pkgdb.sh
   970              . "$TESTSLIB"/pkgdb.sh
   971              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   972  
   973      tests/nested/core20/:
   974          summary: Tests for nested uc20 images
   975          backends: [google-nested, qemu-nested]
   976          systems: [ubuntu-20.04-64]
   977          environment:
   978              NESTED_TYPE: "core"
   979              # Enable kvm in the qemu command line
   980              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   981              # Enable secure boot in the nested vm in case it is supported
   982              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-true}")'
   983              # Enable secure boot in the nested vm in case it is supported
   984              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-true}")'
   985          manual: true
   986          debug: |
   987              #shellcheck source=tests/lib/nested.sh
   988              . "$TESTSLIB/nested.sh"
   989              nested_print_serial_log
   990          warn-timeout: 10m
   991          kill-timeout: 60m
   992          prepare: |
   993              #shellcheck source=tests/lib/pkgdb.sh
   994              . "$TESTSLIB"/pkgdb.sh
   995              distro_update_package_db
   996              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils haveged
   997              snap install ubuntu-image --classic
   998  
   999              # Install the snapd built
  1000              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
  1001  
  1002              #shellcheck source=tests/lib/nested.sh
  1003              . "$TESTSLIB/nested.sh"
  1004              nested_prepare_env
  1005              nested_create_core_vm
  1006              nested_start_core_vm
  1007              nested_wait_for_snap_command
  1008          restore: |
  1009              #shellcheck source=tests/lib/nested.sh
  1010              . "$TESTSLIB/nested.sh"
  1011              nested_destroy_vm
  1012              nested_cleanup_env
  1013  
  1014              #shellcheck source=tests/lib/pkgdb.sh
  1015              . "$TESTSLIB"/pkgdb.sh
  1016              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
  1017  
  1018  # vim:ts=4:sw=4:et