Skip to content

Commit

Permalink
updated docs and the rockspec.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Oct 5, 2012
1 parent 8872071 commit d69b2b7
Show file tree
Hide file tree
Showing 22 changed files with 2,695 additions and 49 deletions.
48 changes: 11 additions & 37 deletions README.md
@@ -1,20 +1,12 @@
## Overview

LuaCov is a simple coverage analyzer for [Lua](http://www.lua.org)
scripts. When a Lua script is run with the `luacov` module loaded, it
generates a stats file with the number of executions of each line of the
script and its loaded modules. The `luacov` command-line script then
processes this file generating a report file which allows one to visualize
which code paths were not traversed, which is useful for verifying the
effectiveness of a test suite.
LuaCov is a simple coverage analyzer for [Lua](http://www.lua.org) scripts. When a Lua script is run with the `luacov` module loaded, it generates a stats file with the number of executions of each line of the script and its loaded modules. The `luacov` command-line script then processes this file generating a report file which allows one to visualize which code paths were not traversed, which is useful for verifying the effectiveness of a test suite.

LuaCov is free software and, like Lua, is released under the
[MIT License](http://www.lua.org/license.html).
LuaCov is free software and, like Lua, is released under the [MIT License](http://www.lua.org/license.html).

## Download and Installation

LuaCov can be downloaded from its
[LuaForge page](http://luaforge.net/projects/luacov/files).
LuaCov can be downloaded from its [LuaForge page](http://luaforge.net/projects/luacov/files).

It can also be installed using Luarocks:

Expand All @@ -24,27 +16,18 @@ LuaCov is written in pure Lua and has no external dependencies.

## Instructions

Using LuaCov consists of two steps: running your script to collect
coverage data, and then running `luacov` on the collected data to
generate a report (see _configuration_ below for other options).
Using LuaCov consists of two steps: running your script to collect coverage data, and then running `luacov` on the collected data to generate a report (see _configuration_ below for other options).

To collect coverage data, your script needs to load the `luacov`
Lua module. This can be done from the command-line, without modifying
your script, like this:
To collect coverage data, your script needs to load the `luacov` Lua module. This can be done from the command-line, without modifying your script, like this:

lua -lluacov test.lua

Alternatively, you can add `require("luacov")` to the first line
of your script.
Alternatively, you can add `require("luacov")` to the first line of your script.

Once the script is run, a file called `luacov.stats.out` is generated.
If the file already exists, statistics are _added_ to it. This is useful,
for example, for making a series of runs with different input parameters in
Once the script is run, a file called `luacov.stats.out` is generated. If the file already exists, statistics are _added_ to it. This is useful, for example, for making a series of runs with different input parameters in
a test suite. To start the accounting from scratch, just delete the stats file.

To generate a report, just run the `luacov` command-line script.
It expects to find a file named `luacov.stats.out` in the current
directory, and outputs a file named `luacov.report.out`. The script take the following parameters;
To generate a report, just run the `luacov` command-line script. It expects to find a file named `luacov.stats.out` in the current directory, and outputs a file named `luacov.report.out`. The script take the following parameters;

luacov [-c=configfile] [filename [ filename[ ...]]]

Expand All @@ -63,17 +46,9 @@ This is an example output of the report file:
1 print("Hello, LuaCov!")
1 end

Note that to generate this report, `luacov` reads the source files.
Therefore, it expects to find them in the same location they were when
the `luacov` module ran (the stats file stores the filenames, but
not the sources themselves).
Note that to generate this report, `luacov` reads the source files. Therefore, it expects to find them in the same location they were when the `luacov` module ran (the stats file stores the filenames, but not the sources themselves).

LuaCov saves its stats upon normal program termination. If your program
is a daemon -- in other words, if it does not terminate normally -- you
can use the `luacov.tick` module, which periodically saves the
stats file. For example, to run (on Unix systems) LuaCov on
[Xavante](http://www.keplerproject.org/xavante),
just modify the first line of `xavante_start.lua` so it reads:
LuaCov saves its stats upon normal program termination. If your program is a daemon -- in other words, if it does not terminate normally -- you can use the `luacov.tick` module, which periodically saves the stats file. For example, to run (on Unix systems) LuaCov on [Xavante](http://www.keplerproject.org/xavante), just modify the first line of `xavante_start.lua` so it reads:

#!/usr/bin/env lua -lluacov.tick

Expand All @@ -87,5 +62,4 @@ Options include changing filenames, automatic report generation upon completion

## Credits

LuaCov was designed and implemented by Hisham Muhammad as a tool for
testing [Luarocks](http://luarocks.luaforge.net).
LuaCov was designed and implemented by Hisham Muhammad as a tool for testing [Luarocks](http://luarocks.luaforge.net).
134 changes: 134 additions & 0 deletions doc/doc/files/src/luacov/defaults.html
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Luadocs for src/luacov/defaults.lua</title>
<link rel="stylesheet" href="../../../luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>

<body>
<div id="container">

<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->

<div id="main">

<div id="navigation">


<h2>LuaDoc</h2>
<ul>

<li><a href="../../../index.html">Index</a></li>

</ul>


<!-- Module list -->

<h2>Modules</h2>
<ul>

<li>
<a href="../../../modules/luacov.html">luacov</a>
</li>

<li>
<a href="../../../modules/luacov.defaults.html">luacov.defaults</a>
</li>

<li>
<a href="../../../modules/luacov.reporter.html">luacov.reporter</a>
</li>

<li>
<a href="../../../modules/luacov.runner.html">luacov.runner</a>
</li>

<li>
<a href="../../../modules/luacov.stats.html">luacov.stats</a>
</li>

<li>
<a href="../../../modules/luacov.tick.html">luacov.tick</a>
</li>

</ul>



<!-- File list -->

<h2>Files</h2>
<ul>

<li><strong>src/luacov/defaults.lua</strong></li>

<li>
<a href="../../../files/src/luacov/init.html">src/luacov/init.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/reporter.html">src/luacov/reporter.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/runner.html">src/luacov/runner.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/stats.html">src/luacov/stats.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/tick.html">src/luacov/tick.lua</a>
</li>

</ul>






</div> <!-- id="navigation" -->

<div id="content">

<h1>File "<code>src/luacov/defaults.lua</code>"</h1>


<p>Global configuration file. Copy, customize and store in your project folder as '.luacov' for project specific configuration</p>









<br/>
<br/>





</div> <!-- id="content" -->

</div> <!-- id="main" -->

<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->
</body>
</html>
134 changes: 134 additions & 0 deletions doc/doc/files/src/luacov/init.html
@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Luadocs for src/luacov/init.lua</title>
<link rel="stylesheet" href="../../../luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>

<body>
<div id="container">

<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->

<div id="main">

<div id="navigation">


<h2>LuaDoc</h2>
<ul>

<li><a href="../../../index.html">Index</a></li>

</ul>


<!-- Module list -->

<h2>Modules</h2>
<ul>

<li>
<a href="../../../modules/luacov.html">luacov</a>
</li>

<li>
<a href="../../../modules/luacov.defaults.html">luacov.defaults</a>
</li>

<li>
<a href="../../../modules/luacov.reporter.html">luacov.reporter</a>
</li>

<li>
<a href="../../../modules/luacov.runner.html">luacov.runner</a>
</li>

<li>
<a href="../../../modules/luacov.stats.html">luacov.stats</a>
</li>

<li>
<a href="../../../modules/luacov.tick.html">luacov.tick</a>
</li>

</ul>



<!-- File list -->

<h2>Files</h2>
<ul>

<li>
<a href="../../../files/src/luacov/defaults.html">src/luacov/defaults.lua</a>
</li>

<li><strong>src/luacov/init.lua</strong></li>

<li>
<a href="../../../files/src/luacov/reporter.html">src/luacov/reporter.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/runner.html">src/luacov/runner.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/stats.html">src/luacov/stats.lua</a>
</li>

<li>
<a href="../../../files/src/luacov/tick.html">src/luacov/tick.lua</a>
</li>

</ul>






</div> <!-- id="navigation" -->

<div id="content">

<h1>File "<code>src/luacov/init.lua</code>"</h1>


<p>Loads <code>luacov.runner</code> and immediately starts it by calling the module table without a configfile. It will use project defaults or, if not set, global defaults. Usefull for calling from the commandline backward compatible with older versions</p>









<br/>
<br/>





</div> <!-- id="content" -->

</div> <!-- id="main" -->

<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->
</body>
</html>

0 comments on commit d69b2b7

Please sign in to comment.