public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH v6 3/4] test: Convert build tests to exeter
Date: Wed, 3 Sep 2025 10:54:12 +1000	[thread overview]
Message-ID: <aLeRtPRqm8I3Qstd@zatzit> (raw)
In-Reply-To: <20250902142323.28cf5c6d@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 3033 bytes --]

On Tue, Sep 02, 2025 at 02:23:23PM +0200, Stefano Brivio wrote:
> On Tue, 2 Sep 2025 20:41:41 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Tue, Sep 02, 2025 at 09:39:53AM +0200, Stefano Brivio wrote:
> > > On Mon,  1 Sep 2025 14:25:14 +1000
> > > David Gibson <david@gibson.dropbear.id.au> wrote:
> > >   
> > > > +def test_make(target: str, expected_files: list[str]) -> None:
> > > > +    """Test `make {target}`
> > > > +
> > > > +    Arguments:
> > > > +    target -- make target to invoke
> > > > +    expected_files -- files make is expected to create
> > > > +
> > > > +    Verifies that
> > > > +      1) `make target` completes successfully
> > > > +      2) expected_files care created by `make target`
> > > > +      3) expected_files are removed by `make clean`
> > > > +    """
> > > > +
> > > > +    ex_paths = [Path(f) for f in expected_files]
> > > > +    with clone_sources():
> > > > +        for p in ex_paths:
> > > > +            assert not p.exists(), f"{p} existed before make"
> > > > +        sh(f'make {target} CFLAGS="-Werror"')
> > > > +        for p in ex_paths:
> > > > +            assert p.exists(), f"{p} wasn't made"
> > > > +        sh('make clean')
> > > > +        for p in ex_paths:
> > > > +            assert not p.exists(), f"{p} existed after make clean"
> > > > +
> > > > +
> > > > +exeter.register('make_passt', test_make, 'passt', ['passt'])
> > > > +exeter.register('make_pasta', test_make, 'pasta', ['pasta'])
> > > > +exeter.register('make_qrap', test_make, 'qrap', ['qrap'])
> > > > +exeter.register('make_all', test_make, 'all', ['passt', 'pasta', 'qrap'])  
> > > 
> > > I guess I'm missing something, but how do you set descriptions from
> > > Python?  
> > 
> > There are two ways:
> >   1)
> > 
> > foo = exeter.register(...)
> > foo.set_description("test that does the thing")
> > 
> >   2)
> > 
> > By default exeter will take it from the first line of the test
> > function's docstring.
> 
> Ah, this is really convenient. I mean I saw it happening but I wasn't
> sure why. :)

To be a little more specific here, exeter.register will introspect the
docstring and put it in the description.  @exeter.test calls
exeter.register, so it does the same thing.  If you register with
parameters it will expand Python-style formatting parameters in the
docstring.  This is useful for something like:

def test_n(n : int):
    """Test the thing {n} times"""
    ...

for i in range(3):
    exeter.register(f'test_{i}', test_n, i)

You can always overwrite the default description afterwards with
set_description.

register_pipe() won't set a description automatically, but you can
still set one explicitly afterwards.  The Scenario stuff... I haven't
checked, it's probably needs some work.

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-09-03  0:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  4:25 [PATCH v6 0/4] New proof-of-concept based exeter tests David Gibson
2025-09-01  4:25 ` [PATCH v6 1/4] test: Extend test scripts to allow running " David Gibson
2025-09-01  4:25 ` [PATCH v6 2/4] test: Run static checkers as " David Gibson
2025-09-01  4:25 ` [PATCH v6 3/4] test: Convert build tests to exeter David Gibson
2025-09-02  7:39   ` Stefano Brivio
2025-09-02 10:41     ` David Gibson
2025-09-02 12:23       ` Stefano Brivio
2025-09-03  0:54         ` David Gibson [this message]
2025-09-01  4:25 ` [PATCH v6 4/4] test: Allow exeter & podman tests to be parallel executed with BATS David Gibson
2025-09-03 21:14 ` [PATCH v6 0/4] New proof-of-concept based exeter tests Stefano Brivio
2025-09-04  2:42   ` David Gibson
2025-09-04 23:14     ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aLeRtPRqm8I3Qstd@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).