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
Ubuntu Sponsors 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. :-(

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
1diff --git a/debian/changelog b/debian/changelog
2index b89e409..4986fb2 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+lvm2 (2.03.16-2ubuntu2) noble; urgency=medium
7+
8+ * Remove obsolete dependency on lsb-base
9+ * Add lvm2-testsuite package.
10+ * Add an autopkgtest that uses the lvm2-testsuite.
11+
12+ -- Scott Moser <smoser@ubuntu.com> Fri, 03 Nov 2023 10:34:51 -0400
13+
14 lvm2 (2.03.16-2ubuntu1) mantic; urgency=medium
15
16 * Merge from Debian unstable (LP: #2020464). Remaining changes:
17diff --git a/debian/control b/debian/control
18index fff01ca..941ab02 100644
19--- a/debian/control
20+++ b/debian/control
21@@ -43,7 +43,6 @@ Pre-Depends:
22 Depends:
23 ${shlibs:Depends},
24 ${misc:Depends},
25- lsb-base,
26 dmsetup (>= ${devmapper:Version}~),
27 dmeventd (>= ${devmapper:Version}~),
28 Recommends:
29@@ -279,3 +278,24 @@ Multi-Arch: same
30 Description: LVM2 libraries - development files
31 This package contains files needed to develop applications that use the
32 lvm2app library.
33+
34+Package: lvm2-testsuite
35+Priority: optional
36+Architecture: any
37+Depends:
38+ ${misc:Depends},
39+ ${shlibs:Depends},
40+ binutils,
41+ bsdextrautils,
42+ lvm2,
43+ lvm2-dbusd,
44+ mdadm,
45+ python3,
46+ python3-dbus,
47+ python3-pyudev,
48+ thin-provisioning-tools,
49+ xfsprogs,
50+Multi-Arch: foreign
51+Description: testsuite for excercising LVM2
52+ This package provides LVM2's test suite. It is mainly
53+ intended for use with the autopkgtest system.
54diff --git a/debian/lvm2-testsuite.install b/debian/lvm2-testsuite.install
55new file mode 100644
56index 0000000..a7e0186
57--- /dev/null
58+++ b/debian/lvm2-testsuite.install
59@@ -0,0 +1,3 @@
60+usr/bin/lvm2-testsuite
61+usr/libexec/lvm2-testsuite
62+usr/share/lvm2-testsuite
63diff --git a/debian/lvm2-testsuite.lintian-overrides b/debian/lvm2-testsuite.lintian-overrides
64new file mode 100644
65index 0000000..62c4742
66--- /dev/null
67+++ b/debian/lvm2-testsuite.lintian-overrides
68@@ -0,0 +1,3 @@
69+# Upstream provides shell files in /usr/share/lvm2-testsuite/shell/ that
70+# are not meant to executable on their own but are used by the testsuite.
71+lvm2-testsuite binary: script-not-executable
72diff --git a/debian/rules b/debian/rules
73index b6153d0..2333b7a 100755
74--- a/debian/rules
75+++ b/debian/rules
76@@ -111,6 +111,11 @@ dh_auto_install.%:
77 install_systemd_units \
78 install_tmpfiles_configuration \
79 LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
80+ # install test suite and remove unit tests.
81+ dh_auto_install --sourcedirectory=debian/build/build_$* \
82+ --destdir=debian/build/install_$* -- -C test install \
83+ LIB_VERSION_DM=$(DEVMAPPER_ABINAME)
84+ rm -f debian/build/install_$*/usr/share/lvm2-testsuite/unit/unit-test
85
86 override_dh_auto_clean:
87 rm -rf debian/build
88diff --git a/debian/tests/control b/debian/tests/control
89new file mode 100644
90index 0000000..f1b53d0
91--- /dev/null
92+++ b/debian/tests/control
93@@ -0,0 +1,3 @@
94+Tests: testsuite
95+Restrictions: needs-root, isolation-machine, breaks-testbed, allow-stderr
96+Depends: bash, lvm2-testsuite
97diff --git a/debian/tests/testsuite b/debian/tests/testsuite
98new file mode 100755
99index 0000000..0bb1210
100--- /dev/null
101+++ b/debian/tests/testsuite
102@@ -0,0 +1,223 @@
103+#!/bin/bash
104+DEFAULT_OUTPUT_D="${AUTOPKGTEST_ARTIFACTS:-.}/testsuite-results"
105+TESTSUITE_DIR=${TESTSUITE_DIR:-/usr/share/lvm2-testsuite}
106+info() { stderr "INFO:" "$@"; }
107+stderr() { echo "$@" 1>&2; }
108+warn() { stderr "WARN:" "$@"; }
109+fail() { stderr "FATAL:" "$@"; exit 1; }
110+vrun() {
111+ local rc=""
112+ stderr "execute:" "$@"
113+ "$@"
114+ rc=$?
115+ [ "$rc" = 0 ] || stderr "command failed [$rc]:" "$@"
116+ return $rc
117+}
118+
119+
120+Usage() {
121+ cat <<EOF
122+${0##*/} [options] [output-dir]
123+
124+ --skip-installs do not install any packages
125+ --skip-masks do not mask or stop any systemd services
126+
127+ output-dir defaults to "$DEFAULT_OUTPUT_D"
128+EOF
129+}
130+
131+is_installed() {
132+ local pkg="$1" out="" rc=""
133+ out=$(LANG=C.UTF-8 dpkg-query --show \
134+ --showformat='${db:Status-Abbrev} ${Package}\n' "$pkg" 2>&1)
135+ rc=$?
136+ [ $rc -eq 1 ] && return 1
137+ [ $rc -eq 0 ] || fail "'dpkg-query $pkg' failed [$rc]: $out"
138+
139+ set -- $out
140+ [ $# -eq 2 ] || {
141+ warn "dpkg-query $pkg got $# bits of output. expected 2. output: $out"
142+ return 1
143+ }
144+ [ "$1" = "ii" ]
145+}
146+
147+apt_update() {
148+ vrun apt-get -q \
149+ "--option=APT::Update::Error-Mode=any" update
150+}
151+
152+apt_install() {
153+ local pkg="$1"
154+ apt_update || { stderr "apt-get updated failed $?"; return 1; }
155+ set -- env LANG=C.UTF-8 LC_ALL=C.UTF-8 \
156+ DEBIAN_FRONTEND=noninteractive \
157+ apt-get \
158+ --option=Dpkg::Options::=--force-confnew \
159+ --assume-yes \
160+ install "$pkg"
161+ vrun "$@"
162+}
163+
164+check_kernel_modules() {
165+ local uname_r="" out="" mpkg=""
166+ uname_r=$(uname -r) || {
167+ stderr "uname -r failed $?"
168+ return 1
169+ }
170+ mpkg="linux-modules-${uname_r}"
171+ if is_installed "$mpkg"; then
172+ info "Running kernel $uname_r. modules installed from $mpkg"
173+ return 0
174+ fi
175+
176+ info "kernel package $mpkg not installed. Attempting installation."
177+ apt_install "$mpkg" ||
178+ { stderr "installation of package $mpkg failed"; return 1; }
179+
180+ info "Running kernel $uname_r. modules were installed from $mpkg"
181+}
182+
183+stop_and_mask_units() {
184+ local m="" out="" unit="" state=""
185+ for m in "$@"; do
186+ out=$(systemctl --legend=false list-unit-files "$m.*" |
187+ awk '{printf("%s:%s ", $1, $2)}')
188+ if [ -z "$out" ]; then
189+ stderr "$m: no matched units"
190+ continue
191+ fi
192+ for tok in $out; do
193+ unit="${tok%:*}"
194+ state="${tok#*:}"
195+ if [ "$state" != "masked" ]; then
196+ vrun systemctl mask "$unit" || return 1
197+ fi
198+ vrun systemctl stop "$unit" || return 1
199+ done
200+ done
201+ return 0
202+}
203+
204+# read_skips(skipfile, testdir)
205+# Output a comma delimited list of tests to skip as read from skipfile.
206+#
207+# skipfile: a file containing a list of tests to skip.
208+# Each line in skipfile is whitespace delimited testname and reason
209+# comments are supported with '#' character.
210+# Example:
211+# # blocksize-3 fails occasionally.
212+# shell/integrity-blocksize-3.sh transient
213+# ...
214+# testdir: the lvm testsuite dir. Each testname listed must be an existing
215+# test in testdir.
216+read_skips() {
217+ local skipfile="$1" tdir="$2"
218+ local missing="" skipnames="" skipreasons="" skips="" line=""
219+ missing=()
220+ skipnames=()
221+ skipreasons=()
222+ skips=""
223+
224+ while read line; do
225+ line=${line%%#*}
226+ [ -z "$line" ] && continue
227+ set -- $line
228+ name=$1
229+ reason=$2
230+ if [ -n "$tdir" ] && [ ! -f "$tdir/$name" ]; then
231+ missing=( "${missing[@]}" "$name" )
232+ continue
233+ fi
234+ skipnames=( "${skipnames[@]}" "$name" )
235+ skipreasons=( "${skipreasons[@]}" "$reason" )
236+ skips="$skips,$name"
237+ done <"$skipfile"
238+ skips=${skips#,}
239+
240+ stderr "skipping ${#skipnames[@]} tests from ${skipfile}"
241+ i=0
242+ while [ "$i" -lt "${#skipnames[@]}" ]; do
243+ printf " %-13s %s\n" "${skipreasons[$i]}" "${skipnames[$i]}"
244+ i=$((i+1))
245+ done 1>&2
246+
247+ if [ "${#missing[@]}" != 0 ]; then
248+ warn "tests listed in skiplist are not present in '$tdir'"
249+ warn "update skipfile '$skipfile'"
250+ for t in "${missing[@]}"; do
251+ stderr " $t"
252+ done
253+ fi
254+
255+ echo "$skips"
256+}
257+
258+
259+main() {
260+ local sopts="hv"
261+ local lopts="help,skip-installs,skip-masks,skip-file:,verbose"
262+ local name="${0##*/}" out=""
263+ out=$(getopt --name "$name" \
264+ --options "$sopts" --long "$lopts" -- "$@") &&
265+ eval set -- "$out" ||
266+ { bad_Usage; return; }
267+
268+ local cur="" next="" t="" mydir=""
269+ local skipfile="" do_installs=true do_masks=true
270+ while [ $# -ne 0 ]; do
271+ cur="$1"; next="$2";
272+ case "$cur" in
273+ -h|--help) Usage ; exit 0;;
274+ --skip-installs) do_installs=false;;
275+ --skip-masks) do_masks=false;;
276+ --skip-file) skipfile=$next; shift;;
277+ --) shift; break;;
278+ esac
279+ shift;
280+ done
281+
282+ [ $# -eq 1 -o $# -eq 0 ] || fail "$0 got $# args ($*), expected 0 or 1"
283+
284+ outdir="${DEFAULT_OUTPUT_D}"
285+ [ $# -eq 0 ] || {
286+ outdir="$1"
287+ shift;
288+ }
289+
290+ t=$(dirname "$0") && mydir=$(cd "$t" && pwd) ||
291+ fail "could not change dir to to $t"
292+
293+ if [ -z "$skipfile" ]; then
294+ # You can use an empty skipfile (and run all the tests) by:
295+ # autopkgtest --setup-commands="touch /run/lvm2-testsuite-skips"
296+ for f in "$mydir/testsuite-skips" /run/lvm2-testsuite-skips; do
297+ [ -f "$f" ] && skipfile="$f"
298+ done
299+ fi
300+ [ -e "$skipfile" ] || fail "skipfile '$skipfile' does not exist."
301+
302+ if [ "$do_installs" = "true" ]; then
303+ check_kernel_modules || fail "check_kernel_modules failed"
304+ fi
305+
306+ skips=$(read_skips "$skipfile" "${TESTSUITE_DIR}") ||
307+ fail "failed reading skips from $skipfile"
308+
309+ if [ "$do_masks" = "true" ]; then
310+ stop_and_mask_units dm-event lvm2-lvmpolld lvm2-monitor lvm2-lvmdbusd ||
311+ fail "masking systemd units failed"
312+ fi
313+
314+ mkdir -p "$outdir" || fail "failed to create output dir '$outdir'"
315+
316+ vrun lvm2-testsuite \
317+ --flavours udev-vanilla \
318+ ${skips:+--skip "${skips}"} \
319+ --outdir "$outdir"
320+ rc=$?
321+ stderr "result $rc in ${SECONDS}s"
322+ exit $rc
323+}
324+
325+main "$@"
326diff --git a/debian/tests/testsuite-skips b/debian/tests/testsuite-skips
327new file mode 100644
328index 0000000..898da46
329--- /dev/null
330+++ b/debian/tests/testsuite-skips
331@@ -0,0 +1,104 @@
332+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
333+shell/cache-single-options.sh unknown
334+
335+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
336+shell/cache-single-split.sh unknown
337+
338+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
339+shell/cache-single-types.sh unknown
340+
341+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
342+shell/cache-single-usage.sh unknown
343+
344+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
345+shell/fsadm-renamed.sh unknown
346+
347+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
348+shell/integrity-blocksize-2.sh unknown
349+
350+# 2 pass/2 fail: modprobe: FATAL: Module scsi_debug is in use.
351+shell/integrity-blocksize-3.sh transient
352+
353+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
354+shell/integrity-blocksize.sh unknown
355+
356+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
357+shell/integrity-dmeventd.sh unknown
358+
359+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
360+shell/integrity-large.sh unknown
361+
362+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
363+shell/integrity-misc.sh unknown
364+
365+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
366+shell/integrity-syncaction.sh unknown
367+
368+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
369+shell/integrity.sh unknown
370+
371+# 1 pass/2 fail: Flushing of LVMTEST131033vg/LV1 not aborted
372+shell/lvconvert-cache-abort.sh transient
373+
374+# 3 pass/1 fail: Waiting for pvmove LV to get activated has timed out
375+shell/pvmove-abort-all.sh timeout
376+
377+# 3 pass/1 fail: unclear
378+shell/pvmove-abort.sh transient
379+
380+# ERROR: Failed to change execution mode to "lvm shell (non-fork)"
381+api/dbustest.sh expected-fail
382+
383+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
384+shell/large-physical-sector-size.sh unknown
385+
386+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
387+shell/lvchange-thin.sh unknown
388+
389+# no obvious failure - shell/lvconvert-repair-thin.sh:64
390+shell/lvconvert-repair-thin.sh expected-fail
391+
392+# # Prepare 5x ~1P sized devices
393+shell/lvcreate-large-raid.sh space-req
394+
395+# # 16T device
396+shell/lvcreate-thin-limits.sh space-req
397+
398+# #lvm-conf-error.sh:56+ grep 'Failed to load config file mnt/lvm.conf' out
399+shell/lvm-conf-error.sh expected-fail
400+
401+# fsadm: Fsck ext3 failed.
402+shell/lvresize-full.sh expected-fail
403+
404+# Not enough space to build proposed filesystem while setting up superblock
405+shell/pvmove-basic.sh space-req
406+
407+# Unable to merge invalidated snapshot LV LVMTEST486646vg1/LV1_snap
408+shell/pvscan-autoactivation-polling.sh expected-fail
409+
410+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
411+shell/profiles-thin.sh unknown
412+
413+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
414+shell/writecache-misc.sh unknown
415+
416+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
417+shell/writecache-split.sh unknown
418+
419+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
420+shell/duplicate-vgnames.sh unknown
421+
422+# no obvious failure - shell/snapshot-merge.sh:133
423+shell/snapshot-merge.sh expected-fail
424+
425+# Prepare ~1P sized devices
426+shell/thin-large.sh space-req
427+
428+# 5 pass/1 fail: modprobe: FATAL: Module scsi_debug is in use.
429+shell/writecache-cache-blocksize.sh transient
430+
431+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
432+shell/lvextend-caches-on-thindata.sh unknown
433+
434+# failed 2.03.16-2ubuntu2 on noble 6.5.0-9-generic
435+shell/lvextend-caches.sh unknown

Subscribers

People subscribed via source and target branches