qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 07/11] iotests: add findtests.py


From: Kevin Wolf
Subject: Re: [PATCH v6 07/11] iotests: add findtests.py
Date: Wed, 13 Jan 2021 12:18:43 +0100

Am 13.01.2021 um 11:37 hat Vladimir Sementsov-Ogievskiy geschrieben:
> 12.01.2021 19:42, Kevin Wolf wrote:
> > Am 09.01.2021 um 13:26 hat Vladimir Sementsov-Ogievskiy geschrieben:
> > > +    def __init__(self, test_dir: Optional[str] = None) -> None:
> > > +        self.groups = defaultdict(set)
> > > +
> > > +        with chdir(test_dir):
> > > +            self.all_tests = glob.glob('[0-9][0-9][0-9]')
> > > +            self.all_tests += [f for f in glob.iglob('tests/*')
> > > +                               if not f.endswith('.out') and
> > > +                               os.path.isfile(f + '.out')]
> > > +
> > > +            for t in self.all_tests:
> > > +                with open(t) as f:
> > > +                    for line in f:
> > > +                        if line.startswith('# group: '):
> > > +                            for g in line.split()[2:]:
> > > +                                self.groups[g].add(t)
> > 
> > Do we need to allow more than one group comment in a test or could we
> > return early here, avoiding to read the whole file?
> 
> Hmm, if we defined it's as a "convention", I think we can just check
> only the second line of the file.

I was actually just thinking of a break after finding the "# group: "
line. It would still be recognised as the third line, tenth line or
anywhere else, but only one line in the file would be recognised.

But if you think only looking at the second line is even easier, we can
do that. However, then I wouldn't call it "as a convention" any more in
the documentation because then it wouldn't work any other way any more.

Kevin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]