how can I run a subset of the tests?
Hi, "make check" in libguestfs takes very long (especially when it's run after every patch in a series). How can I run only those tests that are, for example, in "tests/luks/"? Thanks, Laszlo
On Mon, Feb 21, 2022 at 03:10:02PM +0100, Laszlo Ersek wrote:
Hi,
"make check" in libguestfs takes very long (especially when it's run after every patch in a series).
How can I run only those tests that are, for example, in "tests/luks/"?
Disclaimer: The following advice works for libnbd and nbdkit, but I have not tested it on libguestfs: For automake-based projects that still use directory recursion, 'make -C tests/luks check' will run the tests in just one subdirectory, and 'make -C path/to/dir check TESTS=name_of_test' will run just one test. If we ever switch to non-recursive automake, or even to a different build system (qemu and libvirt both switched to meson), then I'll have to relearn tricks. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Mon, Feb 21, 2022 at 03:10:02PM +0100, Laszlo Ersek wrote:
Hi,
"make check" in libguestfs takes very long (especially when it's run after every patch in a series).
How can I run only those tests that are, for example, in "tests/luks/"?
This used to be possible before: commit 6d32773e811882f78dbd8c2a39a2b7a9c3cfca7c Author: Richard W.M. Jones <rjones@redhat.com> Date: Thu Mar 18 11:15:06 2021 +0000 tests: Run the tests in parallel. As far as I know it's no longer possible to run just tests from a single directory. However - a bit clumsy - if you know the exact list of tests you want to run then this works: $ make -C tests check TESTS=" luks/test-luks.sh luks/test-luks-list.sh luks/test-key-option.sh luks/test-key-option-inspect.sh " ... make[3]: Entering directory '/home/rjones/d/libguestfs/tests' SKIP: luks/test-key-option-inspect.sh PASS: luks/test-luks-list.sh PASS: luks/test-key-option.sh PASS: luks/test-luks.sh ============================================================================ Testsuite summary for libguestfs 1.47.2 ============================================================================ # TOTAL: 4 # PASS: 3 # SKIP: 1 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[3]: Leaving directory '/home/rjones/d/libguestfs/tests' make[2]: Leaving directory '/home/rjones/d/libguestfs/tests' make[1]: Leaving directory '/home/rjones/d/libguestfs/tests' make: Leaving directory '/home/rjones/d/libguestfs/tests' Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
On 02/21/22 16:56, Richard W.M. Jones wrote:
On Mon, Feb 21, 2022 at 03:10:02PM +0100, Laszlo Ersek wrote:
Hi,
"make check" in libguestfs takes very long (especially when it's run after every patch in a series).
How can I run only those tests that are, for example, in "tests/luks/"?
This used to be possible before:
commit 6d32773e811882f78dbd8c2a39a2b7a9c3cfca7c Author: Richard W.M. Jones <rjones@redhat.com> Date: Thu Mar 18 11:15:06 2021 +0000
tests: Run the tests in parallel.
As far as I know it's no longer possible to run just tests from a single directory.
However - a bit clumsy - if you know the exact list of tests you want to run then this works:
$ make -C tests check TESTS=" luks/test-luks.sh luks/test-luks-list.sh luks/test-key-option.sh luks/test-key-option-inspect.sh "
Sigh, I'd actually tried something like this, based on a stackoverflow.com hint; however, there is so much cruft on that command line (options with arguments: "-C tests", and in my case: "-j 10"; an operand that is a target: "check", and an operand that is a macro definition: "TESTS=...") that (from my bash history) it looks like I left out the target ("check")... Thanks! Laszlo
... make[3]: Entering directory '/home/rjones/d/libguestfs/tests' SKIP: luks/test-key-option-inspect.sh PASS: luks/test-luks-list.sh PASS: luks/test-key-option.sh PASS: luks/test-luks.sh ============================================================================ Testsuite summary for libguestfs 1.47.2 ============================================================================ # TOTAL: 4 # PASS: 3 # SKIP: 1 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[3]: Leaving directory '/home/rjones/d/libguestfs/tests' make[2]: Leaving directory '/home/rjones/d/libguestfs/tests' make[1]: Leaving directory '/home/rjones/d/libguestfs/tests' make: Leaving directory '/home/rjones/d/libguestfs/tests'
Rich.
On Tue, Feb 22, 2022 at 11:14:18AM +0100, Laszlo Ersek wrote:
On 02/21/22 16:56, Richard W.M. Jones wrote:
On Mon, Feb 21, 2022 at 03:10:02PM +0100, Laszlo Ersek wrote:
Hi,
"make check" in libguestfs takes very long (especially when it's run after every patch in a series).
How can I run only those tests that are, for example, in "tests/luks/"?
This used to be possible before:
commit 6d32773e811882f78dbd8c2a39a2b7a9c3cfca7c Author: Richard W.M. Jones <rjones@redhat.com> Date: Thu Mar 18 11:15:06 2021 +0000
tests: Run the tests in parallel.
As far as I know it's no longer possible to run just tests from a single directory.
However - a bit clumsy - if you know the exact list of tests you want to run then this works:
$ make -C tests check TESTS=" luks/test-luks.sh luks/test-luks-list.sh luks/test-key-option.sh luks/test-key-option-inspect.sh "
Sigh, I'd actually tried something like this, based on a stackoverflow.com hint; however, there is so much cruft on that command line (options with arguments: "-C tests", and in my case: "-j 10"; an
I use: $ grep MAKEFLAGS ~/.bash_profile export MAKEFLAGS=-j`nproc` $ echo $MAKEFLAGS -j24 (You'd be surprised how many things are broken by this, eg it's a rich source of bugs in random RPM builds that don't expect to inherit $MAKEFLAGS from the environment combined with having incomplete dependencies.) Rich.
operand that is a target: "check", and an operand that is a macro definition: "TESTS=...") that (from my bash history) it looks like I left out the target ("check")...
Thanks! Laszlo
... make[3]: Entering directory '/home/rjones/d/libguestfs/tests' SKIP: luks/test-key-option-inspect.sh PASS: luks/test-luks-list.sh PASS: luks/test-key-option.sh PASS: luks/test-luks.sh ============================================================================ Testsuite summary for libguestfs 1.47.2 ============================================================================ # TOTAL: 4 # PASS: 3 # SKIP: 1 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 ============================================================================ make[3]: Leaving directory '/home/rjones/d/libguestfs/tests' make[2]: Leaving directory '/home/rjones/d/libguestfs/tests' make[1]: Leaving directory '/home/rjones/d/libguestfs/tests' make: Leaving directory '/home/rjones/d/libguestfs/tests'
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
participants (3)
-
Eric Blake -
Laszlo Ersek -
Richard W.M. Jones