summaryrefslogtreecommitdiff
path: root/deqp-results-to-markdown
blob: 6ef31063ac52ae0c3cd45289014c434a36070653 (plain)
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
#!/usr/bin/env python3

import csv
import collections


def main():
    outcomes = ('Pass', 'Fail', 'Skip', 'Warn', 'Timeout', 'Flake')
    header = ''.join([
        '|                  | ', ' | '.join(outcomes), ' |\n',
        '| ---------------- | ', ' | '.join([(len(o) - 1) * '-' + ':' for o in outcomes]), ' |',
    ])
    test_results = ''.join([
        '| **dEQP-{API}**   |{', '}|{'.join(outcomes), '}|',
    ])

    print(header)

    for API in ('gles2', 'gles3', 'gles31', 'vk'):
        histogram = collections.Counter()
        for o in outcomes:
            histogram[o] = 0

        try:
            with open(f'deqp-{API}/results.csv') as csvfile:
                reader = csv.reader(csvfile)
                for row in reader:
                    test_result = row[1]
                    histogram[test_result] += 1
        except IOError as error:
            continue

        for o in outcomes:
            if histogram[o] == 0:
                histogram[o] = ' '

        print(test_results.format(API=API.upper(), **histogram))


if __name__ == '__main__':
    main()