From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [igt PATCH 3/4] lib: add subtest extra command line option handling Date: Fri, 16 Aug 2013 14:09:25 +0200 Message-ID: <20130816120925.GG776@phenom.ffwll.local> References: <1375703126-19323-1-git-send-email-imre.deak@intel.com> <1375703126-19323-4-git-send-email-imre.deak@intel.com> <20130806090944.GT22035@phenom.ffwll.local> <1376651227.2576.14.camel@intelbox> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com [74.125.83.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CDE1E8629 for ; Fri, 16 Aug 2013 05:09:18 -0700 (PDT) Received: by mail-ee0-f49.google.com with SMTP id d41so901089eek.36 for ; Fri, 16 Aug 2013 05:09:17 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1376651227.2576.14.camel@intelbox> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Imre Deak Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 > > > > 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