linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brendan Higgins <brendanhiggins@google.com>
To: Daniel Latypov <dlatypov@google.com>
Cc: davidgow@google.com, linux-kernel@vger.kernel.org,
	kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
	skhan@linuxfoundation.org
Subject: Re: [PATCH v2] kunit: tool: better handling of quasi-bool args (--json, --raw_output)
Date: Tue, 28 Sep 2021 14:24:01 -0700	[thread overview]
Message-ID: <CAFd5g44441Qv0tzSbRdz1nOcZLEuSVdHRh71SjbpLN=c44+gnw@mail.gmail.com> (raw)
In-Reply-To: <20210922163921.2462565-1-dlatypov@google.com>

On Wed, Sep 22, 2021 at 9:39 AM Daniel Latypov <dlatypov@google.com> wrote:
>
> Problem:
>
> What does this do?
> $ kunit.py run --json
> Well, it runs all the tests and prints test results out as JSON.
>
> And next is
> $ kunit.py run my-test-suite --json
> This runs just `my-test-suite` and prints results out as JSON.
>
> But what about?
> $ kunit.py run --json my-test-suite
> This runs all the tests and stores the json results in a "my-test-suite"
> file.
>
> Why:
> --json, and now --raw_output are actually string flags. They just have a
> default value. --json in particular takes the name of an output file.
>
> It was intended that you'd do
> $ kunit.py run --json=my_output_file my-test-suite
> if you ever wanted to specify the value.
>
> Workaround:
> It doesn't seem like there's a way to make
> https://docs.python.org/3/library/argparse.html only accept arg values
> after a '='.
>
> I believe that `--json` should "just work" regardless of where it is.
> So this patch automatically rewrites a bare `--json` to `--json=stdout`.
>
> That makes the examples above work the same way.
> Add a regression test that can catch this for --raw_output.
>
> Fixes: 6a499c9c42d0 ("kunit: tool: make --raw_output support only showing kunit output")
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> Tested-by: David Gow <davidgow@google.com>

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>

      reply	other threads:[~2021-09-28 21:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22 16:39 [PATCH v2] kunit: tool: better handling of quasi-bool args (--json, --raw_output) Daniel Latypov
2021-09-28 21:24 ` Brendan Higgins [this message]

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='CAFd5g44441Qv0tzSbRdz1nOcZLEuSVdHRh71SjbpLN=c44+gnw@mail.gmail.com' \
    --to=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    /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.
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 NNTP newsgroup(s).