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
|
summary: Check version content.
details: |
Check that snap version output is as expected.
Snapd has a script that generates the version string based on the Debian
changelog file or on Git history, and the status of the git repository. When
Git-based version is computed, it could contain the word "dirty" if the
working directory contains uncommitted changes. We want to make sure this
doesn't happen in CI, where it could indicate that part of the tests
modified the code in unintended ways.
execute: |
snap version > version.out
# TODO: fix dirty version number on riscv
echo "Ensure the version number is not 'dirty'"
if not uname -m | MATCH riscv64; then
NOMATCH dirty < version.out
fi
echo "Ensure both version of snapd and the snap command is reported"
# repository package
MATCH '^snapd *.*2.*' < version.out
MATCH '^snap *.*2.*' < version.out
echo "Versions of snapd and snap are identical"
vers_snapd="$(awk '/snapd / { print $2 }' < version.out)"
vers_snap="$(awk '/snap / { print $2 }' < version.out)"
test "$vers_snapd" = "$vers_snap"
if ! os.query is-core; then
echo "Ensure distribution information is included in the output"
distro_id="$( . /etc/os-release; echo "$ID" )"
# distro_id better not contain any characters that may be treated as regex
# operators
MATCH "$distro_id *" < version.out
fi
echo "Ensure version output includes architecture"
MATCH "architecture *(amd64|arm64|armel|armhf|i386|ppc64el|riscv64|s390x)" < version.out
|