From: Josh Steadmon <firstname.lastname@example.org> To: "Ævar Arnfjörð Bjarmason" <email@example.com> Cc: firstname.lastname@example.org, email@example.com Subject: Re: [RFC PATCH 3/3] trace2: add a schema validator for trace2 events Date: Wed, 12 Jun 2019 09:23:41 -0700 [thread overview] Message-ID: <20190612162341.GA42943@google.com> (raw) In-Reply-To: <firstname.lastname@example.org> On 2019.06.12 15:28, Ævar Arnfjörð Bjarmason wrote: > > On Wed, Jun 12 2019, Josh Steadmon wrote: > > > trace_schema_validator can be used to verify that trace2 event output > > conforms to the expectations set by the API documentation and codified > > in event_schema.json (or strict_schema.json). This allows us to build a > > regression test to verify that trace2 output does not change > > unexpectedly. > > Does this actually work for you? As seen in my code at > https://email@example.com/ our > test suite emits various lines of JSON that aren't even validly encoded, > so I can't imagine we're passing any sort of proper parser validatior, > let alone a schema validator. Yes, it seems that gojsonschema (and its dependencies) are not very strict about encoding. I also had an alternate Python implementation, and it failed to parse lines that were not properly encoded. I just had that version print out a warning with the number of failed decodings. I believe it was ~20 out of 1.7M events. > In terms of implementation I think it would make sense to have a *.sh > wrapper for this already, then we could test via prereqs if we have some > of the existing validators (seems there's a list at > https://json-schema.org/implementations.html) and e.g. run a dummy test > against some small list of git commands, and then you could also pass it > an env variable with "here's the trace file" so you could do: > > GIT_TRACE2_EVENT=/tmp/git.events prove <all testss> && VALIDATE_THIS=/tmp/git.events ./<that new test>.sh > > And it would validate that file, if set. The problem with the existing validators is that they expect each file to be a complete JSON entity, whereas the trace output is one object per line. You can of course loop over the lines in a shell script, but in my testing this approach took multiple hours on the full test suite trace output, vs. 15 minutes for the implementation in this patch.
next prev parent reply other threads:[~2019-06-12 16:23 UTC|newest] Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-11 23:31 [RFC PATCH 0/3] Add a JSON Schema " Josh Steadmon 2019-06-11 23:31 ` [RFC PATCH 1/3] trace2: correct trace2 field name documentation Josh Steadmon 2019-06-12 18:00 ` Junio C Hamano 2019-06-12 18:14 ` Josh Steadmon 2019-06-14 15:53 ` Jeff Hostetler 2019-06-11 23:31 ` [RFC PATCH 2/3] trace2: Add a JSON schema for trace2 events Josh Steadmon 2019-06-14 15:59 ` Jeff Hostetler 2019-06-20 17:26 ` Josh Steadmon 2019-06-11 23:31 ` [RFC PATCH 3/3] trace2: add a schema validator " Josh Steadmon 2019-06-12 13:28 ` Ævar Arnfjörð Bjarmason 2019-06-12 16:23 ` Josh Steadmon [this message] 2019-06-12 19:18 ` Jeff King 2019-06-20 18:15 ` Josh Steadmon 2019-06-21 11:53 ` Jakub Narebski 2019-06-27 13:57 ` Jeff Hostetler 2019-07-09 23:05 ` [RFC PATCH v2 0/3] Add a JSON Schema " Josh Steadmon 2019-07-09 23:05 ` [RFC PATCH v2 1/3] trace2: Add a JSON schema " Josh Steadmon 2019-07-10 18:32 ` Jakub Narebski 2019-07-24 22:37 ` Josh Steadmon 2019-07-09 23:05 ` [RFC PATCH v2 2/3] trace2: add a schema validator " Josh Steadmon 2019-07-11 13:35 ` Jakub Narebski 2019-07-24 22:47 ` Josh Steadmon 2019-07-09 23:05 ` [RFC PATCH v2 3/3] ci: run trace2 schema validation in the CI suite Josh Steadmon 2019-07-24 23:06 ` [PATCH v3 0/3] Add a JSON Schema for trace2 events Josh Steadmon 2019-07-24 23:06 ` [PATCH v3 1/3] trace2: Add a JSON schema " Josh Steadmon 2019-07-25 16:55 ` Junio C Hamano 2019-07-24 23:06 ` [PATCH v3 2/3] trace2: add a schema validator " Josh Steadmon 2019-07-24 23:06 ` [PATCH v3 3/3] ci: run trace2 schema validation in the CI suite Josh Steadmon 2019-07-25 11:18 ` [PATCH v3 0/3] Add a JSON Schema for trace2 events SZEDER Gábor 2019-07-25 16:14 ` Junio C Hamano 2019-07-26 21:16 ` Josh Steadmon 2019-07-25 23:42 ` SZEDER Gábor 2019-07-26 12:12 ` Johannes Schindelin 2019-07-26 13:53 ` SZEDER Gábor 2019-07-31 11:00 ` Johannes Schindelin 2019-07-26 22:03 ` Josh Steadmon 2019-08-01 18:08 ` Josh Steadmon 2019-08-02 1:52 ` Jonathan Nieder 2019-08-02 11:56 ` Johannes Schindelin 2019-08-02 16:59 ` Jonathan Nieder 2019-08-02 19:38 ` SZEDER Gábor 2019-08-02 23:25 ` Jonathan Nieder 2019-08-03 21:25 ` Johannes Schindelin 2019-08-02 19:16 ` SZEDER Gábor 2019-08-02 23:06 ` Jonathan Nieder 2019-08-03 7:35 ` SZEDER Gábor 2019-08-03 7:40 ` SZEDER Gábor
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 List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190612162341.GA42943@google.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [RFC PATCH 3/3] trace2: add a schema validator for trace2 events' \ /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
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git 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 read-only IMAP folder(s) and NNTP newsgroup(s).