File: TestResult.js

package info (click to toggle)
libreswan 5.2-2.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 81,644 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (70 lines) | stat: -rw-r--r-- 1,755 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class TestResult {

    constructor(json) {
	Object.assign(this, json)
    }

    output_file(suffix) {
	return this.test_name + "/OUTPUT/" + suffix
    }

    _html_host_issue(directory, issue, host) {
	let href = null
	let value = ""
	if (issue == "passed") {
	    href = host + ".console.txt"
	    value = "passed"
	} else if (issue == "output-different"
		   || issue == "output-whitespace") {
	    href = host + ".console.diff"
	    value = issue
	} else if (issue == "output-unchecked") {
	    href = host + ".console.txt"
	    value = issue
	} else if (issue == "output-truncated") {
	    href = host + ".console.verbose.txt"
	    value = issue
	} else if (issue == "output-unchecked") {
	    href = host + ".console.verbose.txt"
	    value = issue
	} else {
	    href = ""
	    value = issue
	}
	return "<a href=\"" + directory + "OUTPUT/" + href + "\">" + value + "</a>"
    }

    _html_host_issues(directory, host) {
	return this.issues[host].map((issue) => {
	    return this._html_host_issue(directory, issue, host)
	}).join(",")
    }

    html_issues(directory) {
	if (this.result == "untested") {
	    return ""
	}
	if (!this.test_host_names) {
	    return ""
	}
	let html = this.test_host_names
	    .map((host, index) => {
		let platform = ""
		if (this.test_guest_platforms[index]) {
		    platform = " ("+this.test_guest_platforms[index]+")"
		}
		if (host in this.issues) {
		    return host+":"+this._html_host_issues(directory, host) + platform
		}
		if ("all" in this.issues) {
		    return host+":"+this._html_host_issues(directory, "all") + platform + " (all)"
		}
		return host+":passed"
	    })
	if ("all" in this.issues) {
	    html.push("all:"+this._html_host_issues(directory, "all"))
	}
	return html.join("<br/>")
    }

}