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