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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_2.0/] [scripts/] [run_regressions.pl] - Blame information for rev 217

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 214 diegovalve
#!/usr/bin/perl
2
 
3
use strict;
4
use Cwd;
5
use File::Copy;
6
use File::Find;
7
use HTTP::Date;
8
use Data::Dumper;
9
 
10
 
11
my $RegressionsDirectory = "../regressions/single_core/";
12
my $CompilerDir = "../compiler/bin/";
13
my $SimulatonResultFile = "test_result.log";
14
my $Option_Quiet = 1;
15
my $TestConfig;
16
#Set the enviroment variable THEIA_PROJECT_FOLDER
17
my $tmp = `pwd`;
18
chomp $tmp;
19
$tmp .= "/../";
20
$ENV{'THEIA_PROJECT_FOLDER'} = $tmp;
21
 
22
#find all the *.vp files
23
 
24
my @Tests =  <$RegressionsDirectory/*.vp>;
25
for my $Test (@Tests)
26
{
27
        print sprintf("Running test %-60s  ",$Test);
28
        #Compile the test
29
        my $CompilationOutput = `$CompilerDir/theia_compile $Test`;
30
        if ($CompilationOutput =~ /ERROR/)
31
        {
32
                print $CompilationOutput;
33
                print "ERROR: theia_compile failed!\n";
34
                `rm *.mem`;
35
                next;
36
        }
37
        print $CompilationOutput if ($Option_Quiet == 0);
38
        #Run the test
39
        my $SimulationOutput = `make run`;
40
        print $SimulationOutput if ($Option_Quiet == 0);
41
 
42
 
43
        #now check for the existance of the test_config file
44
        my $TestBaseName = `basename $Test .vp`;
45
        chomp $TestBaseName;
46
        $TestConfig =  $RegressionsDirectory . "/" . $TestBaseName . ".config";
47
 
48
        if (not -e $TestConfig)
49
        {
50
                print "ERROR: test configuration file $TestConfig does not exist\n";
51
                `rm *.mem`;
52
                next;
53
        }
54
        ParseConfigFile( $TestConfig );
55
 
56
 
57
 
58
 
59
 
60
}
61
print "Ran " .@Tests .  " tests\n";
62
#-------------------------------------------------------------------------
63
sub ParseConfigFile
64
{
65
        my $ConfigFile = shift;
66
        my $Line = 0;
67
        my $Failed = 0;
68
        my $block, my $vp;
69
        my $vpindex;
70
        open CONFIG_FILE , $ConfigFile or die "Could not open $ConfigFile : $!\n";
71
        while (<CONFIG_FILE>)
72
        {
73
                $Line++;
74
                next if m/\/\/.*/;              #skip comments
75
                #print "* $_ \n";
76
                if (m/==/)
77
                {
78
                        (my $left, my $ExpectedValue) = split /==/;
79
                        $ExpectedValue =~ s/\s+//g;
80
                        chomp $ExpectedValue;
81
                        #print "left $left\n";
82
                        #print "ExpectedValue $ExpectedValue\n";
83
                        ( $vp,  $block) = split (/\./,$left);
84
 
85
                        if ($vp =~ m/vp\[\s*(\d+)\s*\]/)        #get the vp <index>, expr vp[ <index> ]
86
                                {       $vpindex = $1; }
87
                        else
88
                                { die "Error line $Line: Invalid left had side '$vp'\n"; }
89
                        #Now get the block type
90
                        if ($block =~ m/r\[\s*(\d+)\s*\]/)                                      #get the register <index>, expr r[ <index> ]
91
                        {
92
                                my $index = $1;
93
                                my $log_file = "rf.vp." . $vpindex . ".log";
94
                                die "Could not open $log_file  : $!\n" if (not -e $log_file);
95
                                my $RegValue = `grep r$index $log_file| awk '{print \$2 \$3 \$4}'`;
96
                                if (not ($RegValue =~ m/$ExpectedValue/))
97
                                {
98
                                        $Failed = 1;
99
                                        print "\n\t ASSERTION : Expecting vp[ $vpindex ].r[ $index ] == '$ExpectedValue', but simulation has value '$RegValue' \n";
100
                                }
101
 
102
                        } elsif ($block =~ m/omem\[\s*(\d+)\s*\]/) {            #get the OMEM <index>, expr omem[ <index> ]
103
 
104
                                my $index = $1;
105
 
106
 
107
                        } else {
108
                                die "Error parsing '$ConfigFile' unknown block type '$block'\n";
109
                        }
110
 
111
 
112
                }
113
 
114
 
115
        }
116
        if ($Failed == 0)
117
        {
118
                print "Test passed\n";
119
        } else {
120
                print "Teset failed\n"
121
        }
122
 
123
        close CONFIG_FILE;
124
}
125
#-------------------------------------------------------------------------

powered by: WebSVN 2.1.0

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