summaryrefslogtreecommitdiff
path: root/jcstress-print-results.py
blob: e4c9255bb2d891ff398528fe45aef45b142e2e72 (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 python

# Copyright (C) 2014, Linaro Limited.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
#
# Author: Andrew McDermott <andrew.mcdermott@linaro.org>

import argparse
import os
import csv
import time
from common import *

parser = argparse.ArgumentParser()
parser.add_argument('--results', help='results filename', type=str, required=True)
parser.add_argument('--top-dir', help="top directory", type=str, required=True)
parser.add_argument('--url', help="URL", type=str, required=True)
parser.add_argument('rest', nargs=argparse.REMAINDER)
args = parser.parse_args()

with open(args.results, 'rb') as csvfile:
    rdr = csv.reader(csvfile, delimiter=',', quotechar='|')
    for row in rdr:
        if os.path.exists(os.path.join(row[1], 'results', 'index.html')):
            human_readable_date = time.strftime("%Y-%m-%d", time.localtime(int(row[0]))).lower()
            normalized_row = [ human_readable_date, os.path.relpath(row[1], args.top_dir), row[2] ]
            pass_rate = pass_fail_rate("{}/results/index.html".format(row[1]))
            print "{} pass rate: {}/{}, results: {}{}/results/".format(normalized_row[0], pass_rate[0], pass_rate[1], args.url, normalized_row[1])