[Libguestfs] how can I run a subset of the tests?
Richard W.M. Jones
rjones at redhat.com
Tue Feb 22 10:48:05 UTC 2022
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 at 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
More information about the Libguestfs
mailing list