OpenCores
URL https://opencores.org/ocsvn/tv80/tv80/trunk

Subversion Repositories tv80

[/] [tv80/] [trunk/] [scripts/] [regression] - Blame information for rev 95

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 63 ghutchis
#!/usr/bin/env python
2
# Copyright (c) 2004 Guy Hutchison (ghutchis@opencores.org)
3
#
4
# Permission is hereby granted, free of charge, to any person obtaining a
5
# copy of this software and associated documentation files (the "Software"),
6
# to deal in the Software without restriction, including without limitation
7
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
# and/or sell copies of the Software, and to permit persons to whom the
9
# Software is furnished to do so, subject to the following conditions:
10
#
11
# The above copyright notice and this permission notice shall be included
12
# in all copies or substantial portions of the Software.
13
#
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
 
22
import sys, os, getopt
23
 
24
test_list = ["bintr", "blk_mem_inst", "blk_out_inst", "hello",
25
             "fib", "otir", "nwtest"]
26
status = {}
27
 
28
def run_tests (test_list):
29
    for test_name in test_list:
30 95 ghutchis
        #os.system ("scripts/run %s" % test_name)
31
        os.system ("(cd tests; make %s.ihx)" % test_name)
32
        os.system ("sc_env/sc_env_top -i tests/%s.ihx | tee logs/%s.log" % (test_name, test_name))
33 63 ghutchis
 
34
def check_results (test_list):
35
    print "%-20s %s" % ("Test", "Status")
36
    for test_name in test_list:
37
        try:
38
            testh = open ("logs/%s.log" % test_name, "r")
39
            status[test_name] = "crashed"
40
 
41
            testl = testh.readline()
42
            while (testl != ''):
43 95 ghutchis
                if (testl.find ("TEST PASSED") != -1):
44 63 ghutchis
                    status[test_name] = "passed"
45 95 ghutchis
                elif (testl.find ("TEST FAILED") != -1):
46 63 ghutchis
                    status[test_name] = "failed"
47
                testl = testh.readline()
48
 
49
        except:
50
            status[test_name] = "no log file"
51
 
52
        print "%-20s %s" % (test_name, status[test_name])
53
 
54
def print_help():
55
    print "Usage: regression [-rch]"
56
    print "  -r : run regression"
57
    print "  -c : check results and print report"
58
    print "  -h : option help (this list)"
59
 
60
(options, args) = getopt.getopt (sys.argv[1:], "rc")
61
 
62
run = 0
63
check = 0
64
for option in options:
65
    if (option[0] == "-r"):
66
        run = 1
67
    if (option[0] == "-c"):
68
        check = 1
69
    if (option[0] == "-h"):
70
        print_help()
71
        sys.exit (0)
72
 
73
if (not run and not check):
74
    print_help()
75
    sys.exit(0)
76
 
77
if (run):
78
    run_tests (test_list)
79
if (check):
80
    check_results (test_list)
81
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.