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