lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I've found a relative simple solution.  I'll just describe it 
shortly, in case someone else wants to do the same.

I've used lxsh's Lua-lexer to scan and manipulate the Lua token 
stream of the sources where I want to do coverage analysis.
This lexer is very good because it is possible to reconstruct the
original source code with all whitespace and comments.

For simple function coverage it is enough to inject an artificial 
call to the coverage function at the start of every function. 
This is easy to do if you only have the tokens and no AST.
There are other easy possibilities to introduce calls without 
changing the semantics of the source. Like after every 'do' or 'then'.

To integrate the result with lcov it is much more easy to produce
lcov's .info files then GCC's .gcno and .gcda files.  .info files are
human readable text files describing the functions and lines that 
exist and/or were executed.

And voila: Nice coverage analysis of C++ and Lua together.

- Jörg

Now on to improve the coverage :-/