[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200406154843.6b31b0b1@hermes.lan>
Date: Mon, 6 Apr 2020 15:48:43 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: Petr Machata <petrm@...lanox.com>
Cc: Jacob Keller <jacob.e.keller@...el.com>,
Jiri Pirko <jiri@...nulli.us>, netdev@...r.kernel.org,
dsahern@...il.com, davem@...emloft.net, kuba@...nel.org,
mlxsw@...lanox.com
Subject: Re: [patch iproute2/net-next] devlink: fix JSON output of mon
command
On Mon, 06 Apr 2020 22:28:31 +0200
Petr Machata <petrm@...lanox.com> wrote:
> Jacob Keller <jacob.e.keller@...el.com> writes:
>
> > On 4/2/2020 2:56 AM, Jiri Pirko wrote:
> >> From: Jiri Pirko <jiri@...lanox.com>
> >>
> >> The current JSON output of mon command is broken. Fix it and make sure
> >> that the output is a valid JSON. Also, handle SIGINT gracefully to allow
> >> to end the JSON properly.
> >>
> >
> > I wonder if there is an easy way we could get "make check" or something
> > to add a test to help verify this is valid JSON?
>
> Simply piping to jq is an easy way to figure out if it's at least valid
> JSON. In principle it would be possible to write more detailed checks as
> TDC (tc-testing) selftests in the kernel.
>
> Something like this:
>
> {
> "id": "a520",
> "name": "JSON",
> "category": [
> "qdisc",
> "fifo"
> ],
> "setup": [
> "$IP link add dev $DUMMY type dummy || /bin/true",
> "$TC qdisc add dev $DUMMY handle 1: root bfifo"
> ],
> "cmdUnderTest": "/bin/true",
> "expExitCode": "0",
> "verifyCmd": "$TC -j qdisc show dev $DUMMY | jq '.[].kind'",
> "matchPattern": "bfifo",
> "matchCount": "1",
> "teardown": [
> "$TC qdisc del dev $DUMMY handle 1: root bfifo",
> "$IP link del dev $DUMMY type dummy"
> ]
> }
>
> Kinda verbose for this level of detail though.
I just use python -m json.tool which is easy (always available)
and picky
Powered by blists - more mailing lists