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