-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[build] Add grammar coverage tool. #3365
Comments
Thanks, but java8 grammar is outdated and very slow (because it quite strictly follows formal documentation). Also, java8 grammar has very small number of examples. I recommend using more advanced and faster java grammar. |
If a grammar is provided, it should be tested with a set of inputs that exercise a "reasonable" amount of the grammar. Unfortunately, some grammars have under 50% of the rules actually tested. The recently added Ada grammars are ~20%. Plsql, used by many, only tests ~60%. The Hive grammars are ~20%. That's really awful. It means that one could write a grammar for hive that is just 20% of the current grammar(s) each, and declare that it parses all of hive. Providing a test suite is as hard as writing the grammar, if not more so. But, people should be encouraged to write quality code. The trcover utility itself is rather slow because the regular expression automaton is an NFA with lots of epsilon transitions. It was stack-based until it ran into stack overflow issues for some grammars. It should be sped up before inserting in a build.
It is arbitrary to say what is "low", "medium", or "high" quality testing, but here's what I suggest, including passing a build of the grammar if at least 50% of the rules are tested.
|
* Fix for #3365 * Fix tab. * Update to track coverage of a grammar. * Add trcover, update versions. * Update tools. * Fix archive step. * Merge in changes for coverage. * Updates with local dotnet tools. * Fix typo. * Try again? * Fix typo. * Clean up.
I have a new that I've been working on the last few days called trcover. It analyzes grammars and input files, the determines the "hotspots" in the grammar, finally outputting a HTML-marked up version of the grammar for quick visualization of just what we are testing. I think I can output some other stats like percent of the grammar tested, which might be a good thing to add to the build and to help people write tests for there grammars.
I just did a test of the java8 grammar, and the visualization shows huge amounts of the grammar not be tested at all! The following zip contains an html file, which can be opened in a browser. Right now, I mark up symbols that are parsed at least one time with the same color. (There may be of course errors in my code!!)
cover.zip
The text was updated successfully, but these errors were encountered: