Merge ~smoser/ubuntu/+source/lvm2:feature/autopkg-test into ubuntu/+source/lvm2:ubuntu/devel

Proposed by Scott Moser
Status: Needs review
Proposed branch: ~smoser/ubuntu/+source/lvm2:feature/autopkg-test
Merge into: ubuntu/+source/lvm2:ubuntu/devel
Diff against target: 435 lines (+370/-1)
8 files modified
debian/changelog (+8/-0)
debian/control (+21/-1)
debian/lvm2-testsuite.install (+3/-0)
debian/lvm2-testsuite.lintian-overrides (+3/-0)
debian/rules (+5/-0)
debian/tests/control (+3/-0)
debian/tests/testsuite (+223/-0)
debian/tests/testsuite-skips (+104/-0)
Reviewer Review Type Date Requested Status
Dan Bungert Pending
git-ubuntu import Pending
Review via email: mp+455141@code.launchpad.net

Commit message

Add autopkg tests for lvm2 based on upstream 'lvm2' test suite.

Description of the change

The lvm2 package currently does not have any autopkg tests. This makes it
hard to have any confidence in an SRU. The changes package the upstream
provided testsuite, and provide the ability to run those tests from
autopkgtest.

The same merge request has been submitted to debian [1].

Running the upstream testsuite in an autopackage test has has some
failures. I posted about those failures upstream at [2].

Rather than root-cause and fix each of the tests, I have added a file
debian/tests/testsuite-skips which contains a list of tests that will be
skipped and comments describing what failed.

The testsuite runner in (debian/test/testsuite) will read that file and
not execute the tests that have known issues. Running all the tests can
be accomplished by removing or truncating the file. To run all tests
without changes to the package you can do:

    autopkgtest --setup-commands="touch /run/lvm2-testsuite-skips"

--
 [1] https://salsa.debian.org/lvm-team/lvm2/-/merge_requests/6
 [2] https://listman.redhat.com/archives/linux-lvm/2023-June/026372.html

To post a comment you must log in.
ea5b449... by Scott Moser

releasing package lvm2 version 2.03.16-2ubuntu2

Revision history for this message
Scott Moser (smoser) wrote (last edit ):

An upload of d6f1d737aaa13395ce3f1be0337b2b8f4a624a86
with series noble and version 2.03.16-2ubuntu2~ppa2
is being built in smoser/ppa here

https://launchpad.net/~smoser/+archive/ubuntu/ppa/+build/26957152

4ab5cf6... by Scott Moser

update changelog - Remove obsolete dependency on lsb-base

dfbdb55... by Scott Moser

Add failures/skips found running on noble.

These added skips failed today running the ppa build on official
infrastruture as described in
https://wiki.ubuntu.com/ProposedMigration#Testing_against_a_PPA

Revision history for this message
Scott Moser (smoser) wrote :

ea5b449884b26ed9df21d575c4189859b66ec328 is pushed to smoser/ppa as ~ppa4
https://launchpad.net/~smoser/+archive/ubuntu/ppa/+packages

I requested test of it just now (Fri, 03 Nov 2023 15:30:22 -0400)
it just started building https://autopkgtest.ubuntu.com/running#pkg-lvm2

So hopefully in about 1hr results will be in
https://autopkgtest.ubuntu.com/results/autopkgtest-noble-smoser-ppa/?format=plain

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks for working on this Scott! At this point we need to target this upload to the next development release (OO series), since Noble was released today. Or make this a SRU.

This type of change would be really good to land first in Debian, I saw that the Debian maintainer did not reply in your salsa MR yet, I took the liberty to ping him on IRC to provide some feedback. If he provides a good feedback and demonstrated the willingness to merge it, I think we can avoid adding the delta in Ubuntu and get it in Ubuntu in the next merge. On the other hand, this package already has a delta, so adding this on top is not a big deal.

Anyway, I see you are a core-dev and actually do not need a sponsor, am I right? I am unsubscring ~ubuntu-sponsors for now. If for any reason you do not have the rights to upload the package, please subscribe ~ubuntu-sponsors again.

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Sorry, I though I could remove the review slot for ~ubuntu-sponsors, but I can't. It is still there :)

Revision history for this message
Scott Moser (smoser) wrote :

I am a core dev, but i'm not active enough to feel it is responsible to dump a change like this without other review (i really don't think anyone should do something without review.

wrt debian, yeah, it'd be really nice to have it there.

I put this together because I wanted to make an SRU of a fix, but didn't have any way to sanely check for regression in a core package. After quite some time working, I kind of abandoned this stuff because I don't think the upstream tests are reliable. :-(

Revision history for this message
Dan Bungert (dbungert) wrote :

Claiming the review slot to attempt to remove this from the sponsor report.
If we don't think the upstream tests are stable enough to use for autopkgtest, then maybe it's not quite ready.

Thanks for the proposal, Scott.

Unmerged commits

ea5b449... by Scott Moser

releasing package lvm2 version 2.03.16-2ubuntu2

94e1f83... by Scott Moser

update changelog

dfbdb55... by Scott Moser

Add failures/skips found running on noble.

These added skips failed today running the ppa build on official
infrastruture as described in
https://wiki.ubuntu.com/ProposedMigration#Testing_against_a_PPA

fa7a7df... by Scott Moser

Add debian/tests to run the lvm2 testsuite.

e05433f... by Scott Moser

update changelog - Add lvm2-tests package.

b16a7df... by Scott Moser

Add lintian override for lvm2-testsuite's shell files.

Lintian would complain about dozens of .sh files in
/usr/share/lvm2-testsuite/shell/

It does not seem useful to make these executable or worth
the effort to move them.
lvm2-testsuite binary: script-not-executable

2c89bc0... by Scott Moser

Add lvm2-testsuite package.

Add an lvm2-tests package for invoking the lvm test suite.

4ab5cf6... by Scott Moser

update changelog - Remove obsolete dependency on lsb-base

a8859e6... by Bastian Blank

Remove obsolete dependency on lsb-base

(cherry picked from commit a65c2e4d2a27c3f206d62526a3d5908556e71504)

b2a71e1... by Dave Jones

changelog

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index b89e409..4986fb2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
1lvm2 (2.03.16-2ubuntu2) noble; urgency=medium
2
3 * Remove obsolete dependency on lsb-base
4 * Add lvm2-testsuite package.
5 * Add an autopkgtest that uses the lvm2-testsuite.
6
7 -- Scott Moser <smoser@ubuntu.com> Fri, 03 Nov 2023 10:34:51 -0400
8
1lvm2 (2.03.16-2ubuntu1) mantic; urgency=medium9lvm2 (2.03.16-2ubuntu1) mantic; urgency=medium
210
3 * Merge from Debian unstable (LP: #2020464). Remaining changes:11 * Merge from Debian unstable (LP: #2020464). Remaining changes:
diff --git a/debian/control b/debian/control
index fff01ca..941ab02 100644
--- a/debian/control
+++ b/debian/control
@@ -43,7 +43,6 @@ Pre-Depends:
43Depends:43Depends:
44 ${shlibs:Depends},44 ${shlibs:Depends},
45 ${misc:Depends},45 ${misc:Depends},
46 lsb-base,
47 dmsetup (>= ${devmapper:Version}~),46 dmsetup (>= ${devmapper:Version}~),
48 dmeventd (>= ${devmapper:Version}~),47 dmeventd (>= ${devmapper:Version}~),
49Recommends:48Recommends:
@@ -279,3 +278,24 @@ Multi-Arch: same
279Description: LVM2 libraries - development files278Description: LVM2 libraries - development files
280 This package contains files needed to develop applications that use the279 This package contains files needed to develop applications that use the
281 lvm2app library.280 lvm2app library.
281
282Package: lvm2-testsuite
283Priority: optional
284Architecture: any
285Depends:
286 ${misc:Depends},
287 ${shlibs:Depends},
288 binutils,
289 bsdextrautils,
290 lvm2,
291 lvm2-dbusd,
292 mdadm,
293 python3,
294 python3-dbus,
295 python3-pyudev,
296 thin-provisioning-tools,
297 xfsprogs,
298Multi-Arch: foreign
299Description: testsuite for excercising LVM2
300 This package provides LVM2's test suite. It is mainly
301 intended for use with the autopkgtest system.
diff --git a/debian/lvm2-testsuite.install b/debian/lvm2-testsuite.install
282new file mode 100644302new file mode 100644
index 0000000..a7e0186
--- /dev/null
+++ b/debian/lvm2-testsuite.install
@@ -0,0 +1,3 @@
1usr/bin/lvm2-testsuite
2usr/libexec/lvm2-testsuite
3usr/share/lvm2-testsuite
diff --git a/debian/lvm2-testsuite.lintian-overrides b/debian/lvm2-testsuite.lintian-overrides
0new file mode 1006444new file mode 100644
index 0000000..62c4742
--- /dev/null
+++ b/debian/lvm2-testsuite.lintian-overrides
@@ -0,0 +1,3 @@
1# Upstream provides shell files in /usr/share/lvm2-testsuite/shell/ that
2# are not meant to executable on their own but are used by the testsuite.
3lvm2-testsuite binary: script-not-executable
diff --git a/debian/rules b/debian/rules
index b6153d0..2333b7a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -111,6 +111,11 @@ dh_auto_install.%:
111 install_systemd_units \111 install_systemd_units \
112 install_tmpfiles_configuration \112 install_tmpfiles_configuration \
113 LIB_VERSION_DM=$(DEVMAPPER_ABINAME)113 LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
114 # install test suite and remove unit tests.
115 dh_auto_install --sourcedirectory=debian/build/build_$* \
116 --destdir=debian/build/install_$* -- -C test install \
117 LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
118 rm -f debian/build/install_$*/usr/share/lvm2-testsuite/unit/unit-test
114119
115override_dh_auto_clean:120override_dh_auto_clean:
116 rm -rf debian/build121 rm -rf debian/build
diff --git a/debian/tests/control b/debian/tests/control
117new file mode 100644122new file mode 100644
index 0000000..f1b53d0
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
1Tests: testsuite
2Restrictions: needs-root, isolation-machine, breaks-testbed, allow-stderr
3Depends: bash, lvm2-testsuite
diff --git a/debian/tests/testsuite b/debian/tests/testsuite
0new file mode 1007554new file mode 100755
index 0000000..0bb1210
--- /dev/null
+++ b/debian/tests/testsuite
@@ -0,0 +1,223 @@
1#!/bin/bash
2DEFAULT_OUTPUT_D="${AUTOPKGTEST_ARTIFACTS:-.}/testsuite-results"
3TESTSUITE_DIR=${TESTSUITE_DIR:-/usr/share/lvm2-testsuite}
4info() { stderr "INFO:" "$@"; }
5stderr() { echo "$@" 1>&2; }
6warn() { stderr "WARN:" "$@"; }
7fail() { stderr "FATAL:" "$@"; exit 1; }
8vrun() {
9 local rc=""
10 stderr "execute:" "$@"
11 "$@"
12 rc=$?
13 [ "$rc" = 0 ] || stderr "command failed [$rc]:" "$@"
14 return $rc
15}
16
17
18Usage() {
19 cat <<EOF
20${0##*/} [options] [output-dir]
21
22 --skip-installs do not install any packages
23 --skip-masks do not mask or stop any systemd services
24
25 output-dir defaults to "$DEFAULT_OUTPUT_D"
26EOF
27}
28
29is_installed() {
30 local pkg="$1" out="" rc=""
31 out=$(LANG=C.UTF-8 dpkg-query --show \
32 --showformat='${db:Status-Abbrev} ${Package}\n' "$pkg" 2>&1)
33 rc=$?
34 [ $rc -eq 1 ] && return 1
35 [ $rc -eq 0 ] || fail "'dpkg-query $pkg' failed [$rc]: $out"
36
37 set -- $out
38 [ $# -eq 2 ] || {
39 warn "dpkg-query $pkg got $# bits of output. expected 2. output: $out"
40 return 1
41 }
42 [ "$1" = "ii" ]
43}
44
45apt_update() {
46 vrun apt-get -q \
47 "--option=APT::Update::Error-Mode=any" update
48}
49
50apt_install() {
51 local pkg="$1"
52 apt_update || { stderr "apt-get updated failed $?"; return 1; }
53 set -- env LANG=C.UTF-8 LC_ALL=C.UTF-8 \
54 DEBIAN_FRONTEND=noninteractive \
55 apt-get \
56 --option=Dpkg::Options::=--force-confnew \
57 --assume-yes \
58 install "$pkg"
59 vrun "$@"
60}
61
62check_kernel_modules() {
63 local uname_r="" out="" mpkg=""
64 uname_r=$(uname -r) || {
65 stderr "uname -r failed $?"
66 return 1
67 }
68 mpkg="linux-modules-${uname_r}"
69 if is_installed "$mpkg"; then
70 info "Running kernel $uname_r. modules installed from $mpkg"
71 return 0
72 fi
73
74 info "kernel package $mpkg not installed. Attempting installation."
75 apt_install "$mpkg" ||
76 { stderr "installation of package $mpkg failed"; return 1; }
77
78 info "Running kernel $uname_r. modules were installed from $mpkg"
79}
80
81stop_and_mask_units() {
82 local m="" out="" unit="" state=""
83 for m in "$@"; do
84 out=$(systemctl --legend=false list-unit-files "$m.*" |
85 awk '{printf("%s:%s ", $1, $2)}')
86 if [ -z "$out" ]; then
87 stderr "$m: no matched units"
88 continue
89 fi
90 for tok in $out; do
91 unit="${tok%:*}"
92 state="${tok#*:}"
93 if [ "$state" != "masked" ]; then
94 vrun systemctl mask "$unit" || return 1
95 fi
96 vrun systemctl stop "$unit" || return 1
97 done
98 done
99 return 0
100}
101
102# read_skips(skipfile, testdir)
103# Output a comma delimited list of tests to skip as read from skipfile.
104#
105# skipfile: a file containing a list of tests to skip.
106# Each line in skipfile is whitespace delimited testname and reason
107# comments are supported with '#' character.
108# Example:
109# # blocksize-3 fails occasionally.
110# shell/integrity-blocksize-3.sh transient
111# ...
112# testdir: the lvm testsuite dir. Each testname listed must be an existing
113# test in testdir.
114read_skips() {
115 local skipfile="$1" tdir="$2"
116 local missing="" skipnames="" skipreasons="" skips="" line=""
117 missing=()
118 skipnames=()
119 skipreasons=()
120 skips=""
121
122 while read line; do
123 line=${line%%#*}
124 [ -z "$line" ] && continue
125 set -- $line
126 name=$1
127 reason=$2
128 if [ -n "$tdir" ] && [ ! -f "$tdir/$name" ]; then
129 missing=( "${missing[@]}" "$name" )
130 continue
131 fi
132 skipnames=( "${skipnames[@]}" "$name" )
133 skipreasons=( "${skipreasons[@]}" "$reason" )
134 skips="$skips,$name"
135 done <"$skipfile"
136 skips=${skips#,}
137
138 stderr "skipping ${#skipnames[@]} tests from ${skipfile}"
139 i=0
140 while [ "$i" -lt "${#skipnames[@]}" ]; do
141 printf " %-13s %s\n" "${skipreasons[$i]}" "${skipnames[$i]}"
142 i=$((i+1))
143 done 1>&2
144
145 if [ "${#missing[@]}" != 0 ]; then
146 warn "tests listed in skiplist are not present in '$tdir'"
147 warn "update skipfile '$skipfile'"
148 for t in "${missing[@]}"; do
149 stderr " $t"
150 done
151 fi
152
153 echo "$skips"
154}
155
156
157main() {
158 local sopts="hv"
159 local lopts="help,skip-installs,skip-masks,skip-file:,verbose"
160 local name="${0##*/}" out=""
161 out=$(getopt --name "$name" \
162 --options "$sopts" --long "$lopts" -- "$@") &&
163 eval set -- "$out" ||
164 { bad_Usage; return; }
165
166 local cur="" next="" t="" mydir=""
167 local skipfile="" do_installs=true do_masks=true
168 while [ $# -ne 0 ]; do
169 cur="$1"; next="$2";
170 case "$cur" in
171 -h|--help) Usage ; exit 0;;
172 --skip-installs) do_installs=false;;
173 --skip-masks) do_masks=false;;
174 --skip-file) skipfile=$next; shift;;
175 --) shift; break;;
176 esac
177 shift;
178 done
179
180 [ $# -eq 1 -o $# -eq 0 ] || fail "$0 got $# args ($*), expected 0 or 1"
181
182 outdir="${DEFAULT_OUTPUT_D}"
183 [ $# -eq 0 ] || {
184 outdir="$1"
185 shift;
186 }
187
188 t=$(dirname "$0") && mydir=$(cd "$t" && pwd) ||
189 fail "could not change dir to to $t"
190
191 if [ -z "$skipfile" ]; then
192 # You can use an empty skipfile (and run all the tests) by:
193 # autopkgtest --setup-commands="touch /run/lvm2-testsuite-skips"
194 for f in "$mydir/testsuite-skips" /run/lvm2-testsuite-skips; do
195 [ -f "$f" ] && skipfile="$f"
196 done
197 fi
198 [ -e "$skipfile" ] || fail "skipfile '$skipfile' does not exist."
199
200 if [ "$do_installs" = "true" ]; then
201 check_kernel_modules || fail "check_kernel_modules failed"
202 fi
203
204 skips=$(read_skips "$skipfile" "${TESTSUITE_DIR}") ||
205 fail "failed reading skips from $skipfile"
206
207 if [ "$do_masks" = "true" ]; then
208 stop_and_mask_units dm-event lvm2-lvmpolld lvm2-monitor lvm2-lvmdbusd ||
209 fail "masking systemd units failed"
210 fi
211
212 mkdir -p "$outdir" || fail "failed to create output dir '$outdir'"
213
214 vrun lvm2-testsuite \
215 --flavours udev-vanilla \
216 ${skips:+--skip "${skips}"} \
217 --outdir "$outdir"
218 rc=$?
219 stderr "result $rc in ${SECONDS}s"
220 exit $rc
221}
222
223main "$@"
diff --git a/debian/tests/testsuite-skips b/debian/tests/testsuite-skips
0new file mode 100644224new file mode 100644
index 0000000..898da46
--- /dev/null
+++ b/debian/tests/testsuite-skips
@@ -0,0 +1,104 @@
1# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
2shell/cache-single-options.sh unknown
3
4# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
5shell/cache-single-split.sh unknown
6
7# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
8shell/cache-single-types.sh unknown
9
10# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
11shell/cache-single-usage.sh unknown
12
13# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
14shell/fsadm-renamed.sh unknown
15
16# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
17shell/integrity-blocksize-2.sh unknown
18
19# 2 pass/2 fail: modprobe: FATAL: Module scsi_debug is in use.
20shell/integrity-blocksize-3.sh transient
21
22# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
23shell/integrity-blocksize.sh unknown
24
25# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
26shell/integrity-dmeventd.sh unknown
27
28# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
29shell/integrity-large.sh unknown
30
31# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
32shell/integrity-misc.sh unknown
33
34# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
35shell/integrity-syncaction.sh unknown
36
37# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
38shell/integrity.sh unknown
39
40# 1 pass/2 fail: Flushing of LVMTEST131033vg/LV1 not aborted
41shell/lvconvert-cache-abort.sh transient
42
43# 3 pass/1 fail: Waiting for pvmove LV to get activated has timed out
44shell/pvmove-abort-all.sh timeout
45
46# 3 pass/1 fail: unclear
47shell/pvmove-abort.sh transient
48
49# ERROR: Failed to change execution mode to "lvm shell (non-fork)"
50api/dbustest.sh expected-fail
51
52# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
53shell/large-physical-sector-size.sh unknown
54
55# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
56shell/lvchange-thin.sh unknown
57
58# no obvious failure - shell/lvconvert-repair-thin.sh:64
59shell/lvconvert-repair-thin.sh expected-fail
60
61# # Prepare 5x ~1P sized devices
62shell/lvcreate-large-raid.sh space-req
63
64# # 16T device
65shell/lvcreate-thin-limits.sh space-req
66
67# #lvm-conf-error.sh:56+ grep 'Failed to load config file mnt/lvm.conf' out
68shell/lvm-conf-error.sh expected-fail
69
70# fsadm: Fsck ext3 failed.
71shell/lvresize-full.sh expected-fail
72
73# Not enough space to build proposed filesystem while setting up superblock
74shell/pvmove-basic.sh space-req
75
76# Unable to merge invalidated snapshot LV LVMTEST486646vg1/LV1_snap
77shell/pvscan-autoactivation-polling.sh expected-fail
78
79# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
80shell/profiles-thin.sh unknown
81
82# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
83shell/writecache-misc.sh unknown
84
85# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
86shell/writecache-split.sh unknown
87
88# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
89shell/duplicate-vgnames.sh unknown
90
91# no obvious failure - shell/snapshot-merge.sh:133
92shell/snapshot-merge.sh expected-fail
93
94# Prepare ~1P sized devices
95shell/thin-large.sh space-req
96
97# 5 pass/1 fail: modprobe: FATAL: Module scsi_debug is in use.
98shell/writecache-cache-blocksize.sh transient
99
100# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
101shell/lvextend-caches-on-thindata.sh unknown
102
103# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
104shell/lvextend-caches.sh unknown

Subscribers

People subscribed via source and target branches