1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/bin/sh
set -ex
# Autopkgtest may run in a special network where using the http proxy is mandatory.
mkdir -p /etc/systemd/system/snapd.service.d/
if [ "${http_proxy:-}" != "" ]; then
cat <<EOF | tee /etc/systemd/system/snapd.service.d/proxy.conf
[Service]
Environment=http_proxy=$http_proxy
Environment=https_proxy=$http_proxy
EOF
echo "http_proxy=$http_proxy" >> /etc/environment
echo "https_proxy=$http_proxy" >> /etc/environment
fi
systemctl daemon-reload
# Ensure we are not get killed too easily
printf '%s\n' "-950" > /proc/$$/oom_score_adj
echo "Memory information (for debugging)"
cat /proc/meminfo
echo "Snapd version (for debugging)"
snap version
# Map snapd deb package pockets to core snap channels. This is intended to cope
# with the autopkgtest execution when testing packages from the different pockets
if apt -qq list snapd | grep -q -- -proposed; then
export SPREAD_CORE_CHANNEL=candidate
elif apt -qq list snapd | grep -q -- -updates; then
export SPREAD_CORE_CHANNEL=stable
fi
# Spread requires password authentication to connect.
echo "${AUTOPKGTEST_NORMAL_USER}":"${AUTOPKGTEST_NORMAL_USER}" | chpasswd
sed -i 's/\(PermitRootLogin\|PasswordAuthentication\)\>.*/\1 yes/' /etc/ssh/sshd_config
systemctl reload ssh.service
# Build and run spread against the special autopkgtest backend, which connects
# back to localhost and runs the test locally on the same machine.
GOPATH=/tmp/go go install github.com/snapcore/spread/cmd/spread@latest
# Debian CI/CD should focus if the newly built debian package can work with the upstream snapd
# released in the snap store, as that is the realistic mode of operation. Here we cheat by telling
# the test suite that snapp from the store is the snapd that was "built" for CI, which is not true.
(
mkdir -p built-snap
cd built-snap
snap download snapd
mv snapd_*.snap snapd_1337.foo.snap.keep
)
(
# shellcheck disable=SC1091
. /etc/os-release
# SPREAD_DEBUG_EACH=0 disables noisy logs on each failure
# SPREAD_REUSE_SNAPD=1 causes snapd from the distribution to be used
# SPREAD_USE_PREBUILT_SNAPD_SNAP=true prevents building snapd with snapcraft in LXD.
SPREAD_DEBUG_EACH=0 SPREAD_REUSE_SNAPD=1 SPREAD_USE_PREBUILT_SNAPD_SNAP=true /tmp/go/bin/spread -v "autopkgtest:${ID:-linux}-${VERSION_ID:-sid}-$(dpkg --print-architecture)":tests/smoke/
)
# Store journal info for inspectsion
journalctl --sync
journalctl -ab > "$ADT_ARTIFACTS"/journal.txt
|