[Intel-gfx] [igt PATCH 3/4] lib: add subtest extra command line option handling
Daniel Vetter
daniel at ffwll.ch
Fri Aug 16 14:09:25 CEST 2013
On Fri, Aug 16, 2013 at 02:07:07PM +0300, Imre Deak wrote:
> On Tue, 2013-08-06 at 11:09 +0200, Daniel Vetter wrote:
> > On Mon, Aug 05, 2013 at 02:45:25PM +0300, Imre Deak wrote:
> > > At the moment any command line option handling done by tests will
> > > interfere with the option handling of the subtest interface. To fix this
> > > add a new version of the subtest_init function accepting optional short
> > > and long command line options. Merge these together with the subtest
> > > interface's own long options and handle both together in the same
> > > getopt_long call.
> > >
> > > Signed-off-by: Imre Deak <imre.deak at intel.com>
> >
> > Hm, I've thought that getopt would filter the passed-in argv/argc arrays
> > and we could run a second getopt afterwards without too much interfence
> > (maybe we need to reset a few global getop state variables). But I'm not
> > sure since I've never tried it out. Am I wrong?
>
> Afaics getopt itself can't handle the long options (which we already
> have for subtests), it'll try to parse each character of the long option
> as a short one.
>
> We could still do the scanning twice by always using getopt_long, but
> there I don't like the fact that we would have to set opterr=0 and
> silently ignore invalid options. Also I thought that later we could add
> a check for clashing test case/subtest options and that's not possible
> by scanning twice.
Hm, just scanning with getopt_long twice was actually my idea. It's a bit
ugly that we then can't check for unknown options. But since you have all
already solved I think we could just move ahead with your patch here. So
please push.
Cheers, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list