summary refs log tree commit diff stats
path: root/tests/testament/htmlgen.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testament/htmlgen.nim')
-rw-r--r--tests/testament/htmlgen.nim19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim
index bc2d8bd37..eb674a171 100644
--- a/tests/testament/htmlgen.nim
+++ b/tests/testament/htmlgen.nim
@@ -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)