new tester produces json output

This commit is contained in:
Araq 2014-02-02 00:41:04 +01:00
commit d29aa4c5ac
7 changed files with 30 additions and 721 deletions

View file

@ -159,3 +159,22 @@ proc generateHtml*(filename: string, commit: int) =
outfile.write(HtmlEnd)
close(db)
close(outfile)
proc generateJson*(filename: string, commit: int) =
const selRow = """select count(*),
sum(result = 'reSuccess'),
sum(result = 'reIgnored')
from TestResult
where [commit] = ? and machine = ?
order by category"""
var db = open(connection="testament.db", user="testament", password="",
database="testament")
let lastCommit = db.getCommit(commit)
var outfile = open(filename, fmWrite)
let data = db.getRow(sql(selRow), lastCommit, $backend.getMachine(db))
outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#}""" % data)
close(db)
close(outfile)