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