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