OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [lib/] [libsim.exp] - Diff between revs 95 and 99

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 95 Rev 99
Line 66... Line 66...
 
 
        if { $verbose > 2 } {
        if { $verbose > 2 } {
            send_user "matching |$matchstr|\n";
            send_user "matching |$matchstr|\n";
        }
        }
 
 
        expect {
        # The matching is slightly tricky. In general we want to find warnings
 
        # or errors. However expect will look at the entire buffer, so if we
 
        # have the match string *after* an error or warning message, then the
 
        # match will still work OK.
 
 
 
        # The trick is to do some post-processing of the matched buffer to see
 
        # if there was a preceding Warning or ERROR message.
 
 
 
        expect {
            $matchstr {
            $matchstr {
                # String to match. Silently accept. Do first, so we can match
                set matchlen [string length $matchstr]
                # specific warnings or errors if desired
                set buflen [string length $expect_out(buffer)]
 
                set lastch [expr {$buflen - $matchlen}]
 
                set prefix [string range $expect_out(buffer) 0 $lastch]
 
 
 
                if { [string match *ERROR* $prefix] } {
 
                    # We skipped an error
 
                    fail "$testname: ERROR seeking match line $match_line";
 
                    return
 
                } elseif { [string match *Warning* $prefix] } {
 
                    # We skipped a warning
 
                    fail "$testname: Warning seeking match line $match_line";
 
                    return;
            }
            }
 
 
            -re "Warning" {
                # Otherwise silently match
                fail "$testname: warning: $expect_out(buffer)";
 
                return
 
            }
            }
 
 
            -re "ERROR" {
            ERROR {
                fail "$testname: error: $expect_out(buffer)";
                # An error other than the one we seek
 
                fail "$testname: ERROR seeking match line $match_line";
                return
                return
            }
            }
 
 
 
            Warning {
 
                # Any warning
 
                fail "$testname: Warning seeking match line $match_line";
 
                return;
 
            }
 
 
            eof {
            eof {
                fail "$testname: hit EOF seeking match line $match_line";
                fail "$testname: hit EOF seeking match line $match_line";
                return
                return
            }
            }
 
 

powered by: WebSVN 2.1.0

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