fix htmlgen, that I broke

This commit is contained in:
Arne Döring
2018-11-28 11:42:44 +01:00
committed by Araq
parent dec863a85a
commit a22bf14bb6
2 changed files with 8 additions and 10 deletions

View File

@@ -20,14 +20,11 @@ var
thisCommit: CommitId
thisBranch: string
{.experimental.}
proc `()`(cmd: string{lit}): string = cmd.execProcess.string.strip
proc getMachine*(): MachineId =
var name = "hostname"()
var name = execProcess("hostname").string.strip
if name.len == 0:
name = when defined(posix): getenv"HOSTNAME".string
else: getenv"COMPUTERNAME".string
name = when defined(posix): getenv("HOSTNAME").string
else: getenv("COMPUTERNAME").string
if name.len == 0:
quit "cannot determine the machine name"
@@ -35,8 +32,8 @@ proc getMachine*(): MachineId =
proc getCommit(): CommitId =
const commLen = "commit ".len
let hash = "git log -n 1"()[commLen..commLen+10]
thisBranch = "git symbolic-ref --short HEAD"()
let hash = execProcess("git log -n 1").string.strip[commLen..commLen+10]
thisBranch = execProcess("git symbolic-ref --short HEAD").string.strip
if hash.len == 0 or thisBranch.len == 0: quit "cannot determine git HEAD"
result = CommitId(hash)
@@ -45,7 +42,7 @@ var
currentCategory: string
entries: int
proc writeTestResult*(name, category, target, result, expected, given: string) =
proc writeTestResult*(name, category, target, action, result, expected, given: string) =
createDir("testresults")
if currentCategory != category:
if currentCategory.len > 0:
@@ -57,7 +54,7 @@ proc writeTestResult*(name, category, target, result, expected, given: string) =
entries = 0
let jentry = %*{"name": name, "category": category, "target": target,
"result": result, "expected": expected, "given": given,
"action": action, "result": result, "expected": expected, "given": given,
"machine": thisMachine.string, "commit": thisCommit.string, "branch": thisBranch}
if entries > 0:
results.writeLine(",")

View File

@@ -222,6 +222,7 @@ proc addResult(r: var TResults, test: TTest, target: TTarget,
backend.writeTestResult(name = name,
category = test.cat.string,
target = $target,
action = $test.spec.action,
result = $success,
expected = expected,
given = given)