BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Manu Bretelle <chantr4@gmail.com>
Cc: bpf@vger.kernel.org, andrii@kernel.org, mykolal@fb.com,
	ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev,
	yhs@fb.com
Subject: Re: [PATCH bpf-next] selftests/bpf: add --json-summary option to test_progs
Date: Thu, 16 Mar 2023 21:18:18 +0200	[thread overview]
Message-ID: <97845fbdc4178dd3d7bea836b245af2c82347b94.camel@gmail.com> (raw)
In-Reply-To: <ZBNGBAAki3VUU0bQ@worktop>

On Thu, 2023-03-16 at 09:38 -0700, Manu Bretelle wrote:
> [...]
>
> I was originally going to do a nested structure similar to this too
> (minus the repeat of test_* entries for subtests. But while discussing this
> offline with Andrii, a flatter structured seemed to be easier to parse/manage
> with tools such as `jq`. I am also very probably missing the right
> incantation for `jq`.
> 
> Finding whether a test has subtests (currently only adding failed ones,
> but this could change in the future) would be easier (essentially checking
> length(subtests)). But neither is it difficult to reconstruct using
> higher level language.
> 

`jq` query is a bit more complicated with nested structure, but not terribly so:

  $ cat query.jq
  .results | map([
                  .test_name,
                  (.subtests | map([([.test_name, .subtest_name] | join("/")) ]))
                 ])
           | flatten

  $ jq -f query.jq test.json
  [
    "test_global_funcs",
    "test_global_funcs/global_func16"
  ]

Test data for reference:

  $ cat test.json | sed -r 's/"[^"]{20,}"/"..."/g'
  {
      "success": 1,
      "success_subtest": 24,
      "skipped": 0,
      "failed": 1,
      "results": [{
              "test_name": "test_global_funcs",
              "test_number": 223,
              "message": "...",
              "failed": true,
              "subtests": [{
                      "test_name": "test_global_funcs",
                      "subtest_name": "global_func16",
                      "test_number": 223,
                      "subtest_number": 16,
                      "message": "...",
                      "is_subtest": true,
                      "failed": true
                  }
              ]
          }
      ]
  }

> In term of logical structure and maybe extensibility, this is more appropriate,
> in term of pragmatism maybe less.
> 
> I don't have strong opinions and can see benefit for both.

idk, I don't have a strong opinion either.

> [...]

  reply	other threads:[~2023-03-16 19:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  6:39 [PATCH bpf-next] selftests/bpf: add --json-summary option to test_progs Manu Bretelle
2023-03-16 15:03 ` Eduard Zingerman
2023-03-16 16:38   ` Manu Bretelle
2023-03-16 19:18     ` Eduard Zingerman [this message]
2023-03-16 23:23       ` Andrii Nakryiko
2023-03-16 23:33         ` Eduard Zingerman
2023-03-17  0:07           ` Andrii Nakryiko
2023-03-17  0:24           ` Manu Bretelle
2023-03-16 23:21 ` Andrii Nakryiko
2023-03-17  0:40   ` Manu Bretelle

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=97845fbdc4178dd3d7bea836b245af2c82347b94.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chantr4@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=yhs@fb.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox