github.com/tompreston/snapd@v0.0.0-20210817193607-954edfcb9611/spread.yaml (about)

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