forked from trailofbits/twa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtscore
More file actions
executable file
·51 lines (42 loc) · 828 Bytes
/
tscore
File metadata and controls
executable file
·51 lines (42 loc) · 828 Bytes
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
#!/usr/bin/awk -f
BEGIN {
score = 100
npasses = 0
nmehs = 0
nfailures = 0
nunknowns = 0
nskips = 0
totally_screwed = 0
}
/^PASS/ {
npasses += 1
}
/^MEH/ {
score -= 5
nmehs += 1
}
/^FAIL/ {
score -= 10
nfailures += 1
}
/^UNK/ {
# Punish the server just a little for an unknown result.
score -= 1
nunknowns += 1
}
/^SKIP/ {
nskips += 1
}
/^FATAL/ {
score = 0
totally_screwed = 1
}
END {
# Cap the minimum score at 0. I don't have a strong opinion about this,
# but it does remove the need to handle a negative case.
if (score < 0) {
printf "score %d < 0, capping it at 0\n", score > "/dev/stderr"
score = 0
}
printf "%d %d %d %d %d %d %d\n", score, npasses, nmehs, nfailures, nunknowns, nskips, totally_screwed
}