[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ANN] Lua Code Coverage
- From: Tysen Moore <tsmoore248@...>
- Date: Sat, 23 Feb 2013 20:19:15 -0500
Thanks for the question, I should have had that as part of the announcement.
* The main difference in my opinion is the purpose of the tools. luacov targets counting the number of times a line executes; whereas lcov is looking for just execution of any line at least once. Basically, counts vs. coverage. I personally just want to make sure the code is exercised--this reveals potential errors in unexecuted code.
* luacov does not seem to accept arguments to the program being analyzed (I could be doing something wrong). This is a show stopper for my purposes.
* luacov appears to rely only on the sethook output and does not appear to mark various lines that did actually execute but are not "marked" by Luas sethook. For example: some global variables, a "do" that is not on the same line as its "for" statement, "end" statements, etc. This makes sense to some degree because luacov is tracking the number of times a line executes not actual coverage.
* lcov can track any number of dependent files as well as the initial file. Admittedly I did not test this extensively in luacov because I needed arguments to be passed in.
* Results files in lcov observe the Lua comment format and retains the original line numbers of the original source code. Therefore when reviewing the results in an editor that supports Lua color coding it is very easy to see what has not executed. Whereas luacov output is harder to read and line numbers are not retained making jumping to the original source file can be more difficult for large files/projects.
* luacov uses a single output file whereas lcov will generate one file for each dependency/file analyzed.
* Because lcov is tracking execution you can add special comment syntax (similar in concept to PCLint) which will allow you to compensate for trickier Lua syntax that is not handled by lcov. For example, you can ignore functions that are purely debug and not production code/methods among other uses.
* Even thought lcov does make its own determinations of some execution, the actual sethook information is clearly marked as such and retains the original information.
* lcov provides overall stats for total code, total comment lines, total lines executed, percentage of the file that executed, etc. Luacov does offer some stats but without marking various lines that do execute but are not explicately marked by sethook (standalone "else" for example), the execution percentage is not accurate.