github.com/stulluk/snapd@v0.0.0-20210611110309-f6d5d5bd24b0/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      LXD_SNAP_CHANNEL: "latest/candidate"
    36      CORE_CHANNEL: '$(HOST: echo "${SPREAD_CORE_CHANNEL:-edge}")'
    37      BASE_CHANNEL: '$(HOST: echo "${SPREAD_BASE_CHANNEL:-edge}")'
    38      KERNEL_CHANNEL: '$(HOST: echo "${SPREAD_KERNEL_CHANNEL:-edge}")'
    39      GADGET_CHANNEL: '$(HOST: echo "${SPREAD_GADGET_CHANNEL:-edge}")'
    40      SNAPD_CHANNEL: '$(HOST: echo "${SPREAD_SNAPD_CHANNEL:-edge}")'
    41      REMOTE_STORE: '$(HOST: echo "${SPREAD_REMOTE_STORE:-production}")'
    42      SNAPPY_USE_STAGING_STORE: '$(HOST: if [ "$SPREAD_REMOTE_STORE" = staging ]; then echo 1; else echo 0; fi)'
    43      DELTA_REF: 2.50
    44      DELTA_PREFIX: snapd-$DELTA_REF/
    45      REPACK_KEEP_VENDOR: '$(HOST: echo "${REPACK_KEEP_VENDOR:-n}")'
    46      SNAPD_PUBLISHED_VERSION: '$(HOST: echo "$SPREAD_SNAPD_PUBLISHED_VERSION")'
    47      HTTP_PROXY: '$(HOST: echo "$SPREAD_HTTP_PROXY")'
    48      HTTPS_PROXY: '$(HOST: echo "$SPREAD_HTTPS_PROXY")'
    49      NO_PROXY: "127.0.0.1"
    50      NEW_CORE_CHANNEL: '$(HOST: echo "$SPREAD_NEW_CORE_CHANNEL")'
    51      SRU_VALIDATION: '$(HOST: echo "${SPREAD_SRU_VALIDATION:-0}")'
    52      # use the ppa_validation_name to install snapd from that ppa
    53      PPA_VALIDATION_NAME: '$(HOST: echo "${SPREAD_PPA_VALIDATION_NAME:-}")'
    54      PRE_CACHE_SNAPS: test-snapd-tools test-snapd-sh jq
    55      # always skip removing the rsync snap
    56      SKIP_REMOVE_SNAPS: '$(HOST: echo "${SPREAD_SKIP_REMOVE_SNAPS:-}") test-snapd-rsync test-snapd-rsync-core18 test-snapd-rsync-core20'
    57      # Use the installed snapd and reset the systems without removing snapd
    58      REUSE_SNAPD: '$(HOST: echo "${SPREAD_REUSE_SNAPD:-0}")'
    59  
    60      # Directory where the nested images and test assets are stored
    61      NESTED_WORK_DIR: '$(HOST: echo "${NESTED_WORK_DIR:-/tmp/work-dir}")'
    62      # Channel used to create the nested vm
    63      NESTED_CORE_CHANNEL: '$(HOST: echo "${NESTED_CORE_CHANNEL:-edge}")'
    64      # Use cloud init to make initial system configuration instead of user assertion
    65      NESTED_CORE_REFRESH_CHANNEL: '$(HOST: echo "${NESTED_CORE_REFRESH_CHANNEL:-edge}")'
    66      # Use cloud init to make initial system configuration instead of user assertion
    67      NESTED_USE_CLOUD_INIT: '$(HOST: echo "${NESTED_USE_CLOUD_INIT:-true}")'
    68      # Build and use snapd from current branch
    69      NESTED_BUILD_SNAPD_FROM_CURRENT: '$(HOST: echo "${NESTED_BUILD_SNAPD_FROM_CURRENT:-true}")'
    70      # Download and use an custom image from this url
    71      NESTED_CUSTOM_IMAGE_URL: '$(HOST: echo "${NESTED_CUSTOM_IMAGE_URL:-}")'
    72      # Configure nested images to be reused on the following tests
    73      NESTED_CONFIGURE_IMAGES: '$(HOST: echo "${NESTED_CONFIGURE_IMAGES:-false}")'
    74  
    75  backends:
    76      google:
    77          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
    78          location: snapd-spread/us-east1-b
    79          halt-timeout: 2h
    80          systems:
    81              - ubuntu-14.04-64:
    82                    workers: 6
    83              - ubuntu-16.04-32:
    84                    workers: 6
    85              - ubuntu-16.04-64:
    86                    workers: 8
    87              - ubuntu-18.04-64:
    88                    workers: 8
    89              - ubuntu-20.04-64:
    90                    workers: 8
    91              - ubuntu-core-16-64:
    92                    image: ubuntu-16.04-64
    93                    workers: 6
    94              - ubuntu-core-18-64:
    95                    image: ubuntu-16.04-64
    96                    workers: 6
    97              - ubuntu-core-20-64:
    98                    image: ubuntu-20.04-64
    99                    workers: 6
   100                    storage: 20G
   101              - ubuntu-secboot-20.04-64:
   102                    image: ubuntu-20.04-64
   103                    workers: 1
   104                    secure-boot: true
   105                    # XXX: old name, remove once new spread is deployed
   106                    secureboot: true
   107              - ubuntu-20.10-64:
   108                    workers: 8
   109              - ubuntu-21.04-64:
   110                    workers: 8
   111  
   112              - debian-9-64:
   113                    workers: 6
   114                    manual: true
   115              - debian-10-64:
   116                    workers: 6
   117              - debian-sid-64:
   118                    workers: 6
   119  
   120              - fedora-33-64:
   121                    workers: 6
   122              - fedora-34-64:
   123                    workers: 6
   124  
   125              - arch-linux-64:
   126                    workers: 6
   127              - amazon-linux-2-64:
   128                    workers: 6
   129                    storage: preserve-size
   130  
   131              - centos-7-64:
   132                    workers: 6
   133                    storage: preserve-size
   134                    image: centos-7-64
   135              # unstable systems below
   136              - opensuse-15.1-64:
   137                    workers: 6
   138              - opensuse-15.2-64:
   139                    workers: 6
   140              - opensuse-tumbleweed-64:
   141                    workers: 6
   142                    manual: true
   143              - centos-8-64:
   144                    workers: 6
   145                    storage: preserve-size
   146                    image: centos-8-64
   147  
   148      google-sru:
   149          type: google
   150          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
   151          location: snapd-spread/us-east1-b
   152          halt-timeout: 2h
   153          systems:
   154              - ubuntu-16.04-64:
   155                    workers: 6
   156              - ubuntu-18.04-64:
   157                    workers: 6
   158              - ubuntu-20.04-64:
   159                    workers: 6
   160              - ubuntu-20.10-64:
   161                    workers: 6
   162  
   163      google-nested:
   164          type: google
   165          key: '$(HOST: echo "$SPREAD_GOOGLE_KEY")'
   166          location: snapd-spread/us-east1-b
   167          plan: n2-standard-2
   168          halt-timeout: 2h
   169          systems:
   170              - ubuntu-16.04-64:
   171                    image: ubuntu-1604-64-virt-enabled
   172                    storage: 20G
   173                    workers: 3
   174              - ubuntu-18.04-64:
   175                    image: ubuntu-1804-64-virt-enabled
   176                    storage: 20G
   177                    workers: 3
   178              - ubuntu-20.04-64:
   179                    image: ubuntu-2004-64-virt-enabled
   180                    storage: 20G
   181                    workers: 7
   182              - ubuntu-20.10-64:
   183                    image: ubuntu-2010-64-virt-enabled
   184                    storage: 20G
   185                    workers: 6
   186  
   187      qemu-nested:
   188          memory: 4G
   189          type: qemu
   190          systems:
   191              - ubuntu-16.04-64:
   192                    username: ubuntu
   193                    password: ubuntu
   194              - ubuntu-18.04-64:
   195                    username: ubuntu
   196                    password: ubuntu
   197              - ubuntu-20.04-64:
   198                    username: ubuntu
   199                    password: ubuntu
   200  
   201      qemu:
   202          systems:
   203              - ubuntu-14.04-32:
   204                    username: ubuntu
   205                    password: ubuntu
   206              - ubuntu-14.04-64:
   207                    username: ubuntu
   208                    password: ubuntu
   209              - ubuntu-16.04-32:
   210                    username: ubuntu
   211                    password: ubuntu
   212              - ubuntu-16.04-64:
   213                    username: ubuntu
   214                    password: ubuntu
   215              - ubuntu-core-16-64:
   216                    image: ubuntu-16.04-64
   217                    username: ubuntu
   218                    password: ubuntu
   219              - ubuntu-core-18-64:
   220                    image: ubuntu-16.04-64
   221                    username: ubuntu
   222                    password: ubuntu
   223              - ubuntu-core-20-64:
   224                    image: ubuntu-20.04-64
   225                    username: ubuntu
   226                    password: ubuntu
   227                    flags: [virtio]
   228              - ubuntu-18.04-64:
   229                    username: ubuntu
   230                    password: ubuntu
   231              - ubuntu-18.04-32:
   232                    username: ubuntu
   233                    password: ubuntu
   234              - ubuntu-20.04-64:
   235                    username: ubuntu
   236                    password: ubuntu
   237              - ubuntu-20.04-32:
   238                    username: ubuntu
   239                    password: ubuntu
   240              - ubuntu-20.10-64:
   241                    username: ubuntu
   242                    password: ubuntu
   243              - ubuntu-21.04-64:
   244                    username: ubuntu
   245                    password: ubuntu
   246              - debian-sid-64:
   247                    username: debian
   248                    password: debian
   249              - debian-9-64:
   250                    username: debian
   251                    password: debian
   252              - debian-sid-64:
   253                    username: debian
   254                    password: debian
   255              - centos-7-64:
   256                    username: centos
   257                    password: centos
   258              - amazon-linux-2-64:
   259                    username: ec2-user
   260                    password: ec2-user
   261              - opensuse-15.2-64:
   262                    username: opensuse
   263                    password: opensuse
   264              - opensuse-tumbleweed-64:
   265                    username: opensuse
   266                    password: opensuse
   267      autopkgtest:
   268          type: adhoc
   269          allocate: |
   270              echo "Allocating ad-hoc $SPREAD_SYSTEM"
   271              if [ -z "${ADT_ARTIFACTS}" ]; then
   272                  FATAL "adhoc only works inside autopkgtest"
   273                  exit 1
   274              fi
   275              echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99-spread-users
   276              ADDRESS localhost:22
   277          discard: |
   278              echo "Discarding ad-hoc $SPREAD_SYSTEM"
   279          systems:
   280              # Trusty
   281              - ubuntu-14.04-amd64:
   282                    username: ubuntu
   283                    password: ubuntu
   284              - ubuntu-14.04-i386:
   285                    username: ubuntu
   286                    password: ubuntu
   287              # Xenial
   288              - ubuntu-16.04-amd64:
   289                    username: ubuntu
   290                    password: ubuntu
   291              - ubuntu-16.04-i386:
   292                    username: ubuntu
   293                    password: ubuntu
   294              - ubuntu-16.04-ppc64el:
   295                    username: ubuntu
   296                    password: ubuntu
   297              - ubuntu-16.04-armhf:
   298                    username: ubuntu
   299                    password: ubuntu
   300              - ubuntu-16.04-s390x:
   301                    username: ubuntu
   302                    password: ubuntu
   303              # Artful
   304              - ubuntu-17.10-amd64:
   305                    username: ubuntu
   306                    password: ubuntu
   307              - ubuntu-17.10-i386:
   308                    username: ubuntu
   309                    password: ubuntu
   310              - ubuntu-17.10-ppc64el:
   311                    username: ubuntu
   312                    password: ubuntu
   313              - ubuntu-17.10-armhf:
   314                    username: ubuntu
   315                    password: ubuntu
   316              - ubuntu-17.10-s390x:
   317                    username: ubuntu
   318                    password: ubuntu
   319              # Bionic
   320              - ubuntu-18.04-amd64:
   321                    username: ubuntu
   322                    password: ubuntu
   323              - ubuntu-18.04-i386:
   324                    username: ubuntu
   325                    password: ubuntu
   326              - ubuntu-18.04-ppc64el:
   327                    username: ubuntu
   328                    password: ubuntu
   329              - ubuntu-18.04-armhf:
   330                    username: ubuntu
   331                    password: ubuntu
   332              - ubuntu-18.04-s390x:
   333                    username: ubuntu
   334                    password: ubuntu
   335              - ubuntu-18.04-arm64:
   336                    username: ubuntu
   337                    password: ubuntu
   338              # Focal
   339              - ubuntu-20.04-amd64:
   340                    username: ubuntu
   341                    password: ubuntu
   342              - ubuntu-20.04-i386:
   343                    username: ubuntu
   344                    password: ubuntu
   345              - ubuntu-20.04-ppc64el:
   346                    username: ubuntu
   347                    password: ubuntu
   348              - ubuntu-20.04-armhf:
   349                    username: ubuntu
   350                    password: ubuntu
   351              - ubuntu-20.04-s390x:
   352                    username: ubuntu
   353                    password: ubuntu
   354              - ubuntu-20.04-arm64:
   355                    username: ubuntu
   356                    password: ubuntu
   357  
   358      external:
   359          type: adhoc
   360          environment:
   361              SPREAD_EXTERNAL_ADDRESS: '$(HOST: echo "${SPREAD_EXTERNAL_ADDRESS:-localhost:8022}")'
   362              MANAGED_DEVICE: "true"
   363              TRUST_TEST_KEYS: "false"
   364          allocate: |
   365              ADDRESS $SPREAD_EXTERNAL_ADDRESS
   366          systems:
   367              - ubuntu-core-16-64:
   368                    username: external
   369                    password: ubuntu
   370              - ubuntu-core-16-32:
   371                    username: external
   372                    password: ubuntu
   373              - ubuntu-core-16-arm-64:
   374                    username: external
   375                    password: ubuntu
   376              - ubuntu-core-16-arm-32:
   377                    username: external
   378                    password: ubuntu
   379              - ubuntu-core-18-64:
   380                    username: external
   381                    password: ubuntu
   382              - ubuntu-core-18-32:
   383                    username: external
   384                    password: ubuntu
   385              - ubuntu-core-18-arm-64:
   386                    username: external
   387                    password: ubuntu
   388              - ubuntu-core-18-arm-32:
   389                    username: external
   390                    password: ubuntu
   391              - ubuntu-core-20-64:
   392                    username: external
   393                    password: ubuntu
   394              - ubuntu-core-20-32:
   395                    username: external
   396                    password: ubuntu
   397              - ubuntu-core-20-arm-64:
   398                    username: external
   399                    password: ubuntu
   400              - ubuntu-core-20-arm-32:
   401                    username: external
   402                    password: ubuntu
   403  
   404  path: /home/gopath/src/github.com/snapcore/snapd
   405  
   406  exclude:
   407      - .git
   408      - cmd/snap/snap
   409      - cmd/snapd/snapd
   410      - cmd/snapctl/snapctl
   411      - cmd/snap-exec/snap-exec
   412      - cmd/autom4te.cache
   413      - "*.o"
   414      - "*.a"
   415      - ./vendor
   416      - "*.snap"
   417      - "*.img"
   418  
   419  debug-each: |
   420      if [ "$SPREAD_DEBUG_EACH" = 1 ]; then
   421          #shellcheck source=tests/lib/state.sh
   422          . "$TESTSLIB/state.sh"
   423          #shellcheck source=tests/lib/nested.sh
   424          . "$TESTSLIB/nested.sh"
   425  
   426          echo '# System information'
   427          cat /etc/os-release || true
   428  
   429          echo '# Kernel information'
   430          uname -a
   431  
   432          echo '# Go information'
   433          go version || true
   434  
   435          if nested_is_nested_system; then
   436              echo '# nested VM status'
   437              systemctl status nested-vm || true
   438              journalctl --no-pager -u 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              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          debug: |
   880              #shellcheck source=tests/lib/nested.sh
   881              . "$TESTSLIB/nested.sh"
   882              nested_print_serial_log
   883          prepare: |
   884              #shellcheck source=tests/lib/pkgdb.sh
   885              . "$TESTSLIB"/pkgdb.sh
   886              distro_update_package_db
   887              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   888              snap install ubuntu-image --classic
   889  
   890              # Install the snapd built
   891              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   892          prepare-each: |
   893              tests.backup prepare
   894              "$TESTSTOOLS"/nested-state prepare
   895          restore-each: |
   896              "$TESTSTOOLS"/nested-state remove-vm
   897              "$TESTSTOOLS"/nested-state restore
   898              tests.backup restore
   899          restore: |
   900              #shellcheck source=tests/lib/pkgdb.sh
   901              . "$TESTSLIB"/pkgdb.sh
   902              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   903  
   904      tests/nested/classic/:
   905          summary: Tests for nested images
   906          backends: [google-nested, qemu-nested]
   907          systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20*]
   908          environment:
   909              NESTED_TYPE: "classic"
   910              # Channel used to create the nested vm
   911              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-true}")'
   912              # Enable tpm in the nested vm in case it is supported
   913              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-false}")'
   914              # Enable secure boot in the nested vm in case it is supported
   915              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-false}")'
   916          manual: true
   917          debug: |
   918              #shellcheck source=tests/lib/nested.sh
   919              . "$TESTSLIB/nested.sh"
   920              nested_print_serial_log
   921          prepare: |
   922              #shellcheck source=tests/lib/pkgdb.sh
   923              . "$TESTSLIB"/pkgdb.sh
   924              distro_update_package_db
   925              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   926              snap install ubuntu-image --classic
   927  
   928              # Install the snapd built
   929              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   930  
   931              "$TESTSTOOLS"/nested-state prepare
   932              "$TESTSTOOLS"/nested-state build-image classic
   933          prepare-each: |
   934              tests.backup prepare
   935              "$TESTSTOOLS"/nested-state create-vm classic
   936          restore-each: |
   937              "$TESTSTOOLS"/nested-state remove-vm
   938              tests.backup restore
   939          restore: |
   940              "$TESTSTOOLS"/nested-state restore
   941  
   942              #shellcheck source=tests/lib/pkgdb.sh
   943              . "$TESTSLIB"/pkgdb.sh
   944              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   945  
   946      tests/nested/core/:
   947          summary: Tests for nested images
   948          backends: [google-nested, qemu-nested]
   949          systems: [ubuntu-16.04-64, ubuntu-18.04-64, ubuntu-20.04-64]
   950          environment:
   951              NESTED_TYPE: "core"
   952              # Enable kvm in the qemu command line
   953              NESTED_ENABLE_KVM: '$(HOST: echo "${NESTED_ENABLE_KVM:-}")'
   954              # Enable tpm in the nested vm in case it is supported
   955              NESTED_ENABLE_TPM: '$(HOST: echo "${NESTED_ENABLE_TPM:-}")'
   956              # Enable secure boot in the nested vm in case it is supported
   957              NESTED_ENABLE_SECURE_BOOT: '$(HOST: echo "${NESTED_ENABLE_SECURE_BOOT:-}")'
   958          manual: true
   959          debug: |
   960              #shellcheck source=tests/lib/nested.sh
   961              . "$TESTSLIB/nested.sh"
   962              nested_print_serial_log
   963          prepare: |
   964              #shellcheck source=tests/lib/pkgdb.sh
   965              . "$TESTSLIB"/pkgdb.sh
   966              distro_update_package_db
   967              distro_install_package snapd qemu qemu-utils genisoimage sshpass qemu-kvm cloud-image-utils ovmf kpartx xz-utils
   968              snap install ubuntu-image --classic
   969  
   970              # Install the snapd built
   971              dpkg -i "$SPREAD_PATH"/../snapd_*.deb
   972  
   973              "$TESTSTOOLS"/nested-state prepare
   974              "$TESTSTOOLS"/nested-state build-image core
   975          prepare-each: |
   976              tests.backup prepare
   977              "$TESTSTOOLS"/nested-state create-vm core
   978          restore-each: |
   979              "$TESTSTOOLS"/nested-state remove-vm
   980              tests.backup restore
   981          restore: |
   982              "$TESTSTOOLS"/nested-state restore
   983  
   984              #shellcheck source=tests/lib/pkgdb.sh
   985              . "$TESTSLIB"/pkgdb.sh
   986              distro_purge_package qemu genisoimage sshpass qemu-kvm cloud-image-utils xz-utils
   987  
   988  # vim:ts=4:sw=4:et