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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [dejagnu/] [lib/] [framework.exp] - Blame information for rev 578

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

Line No. Rev Author Line
1 578 markom
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001
2
# Free Software Foundation, Inc.
3
 
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
8
#
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
# GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
 
18
# Please email any bugs, comments, and/or additions to this file to:
19
# bug-dejagnu@prep.ai.mit.edu
20
 
21
# This file was written by Rob Savoye. (rob@cygnus.com)
22
 
23
# These variables are local to this file.
24
# This or more warnings and a test fails.
25
set warning_threshold 3
26
# This or more errors and a test fails.
27
set perror_threshold 1
28
 
29
proc mail_file { file to subject } {
30
    if [file readable $file] {
31
        catch "exec mail -s \"$subject\" $to < $file"
32
    }
33
}
34
 
35
#
36
# Open the output logs
37
#
38
proc open_logs { } {
39
    global outdir
40
    global tool
41
    global sum_file
42
 
43
    if { ${tool} ==  "" } {
44
        set tool testrun
45
    }
46
    catch "exec rm -f $outdir/$tool.sum"
47
    set sum_file [open "$outdir/$tool.sum" w]
48
    catch "exec rm -f $outdir/$tool.log"
49
    log_file -a "$outdir/$tool.log"
50
    verbose "Opening log files in $outdir"
51
    if { ${tool} ==  "testrun" } {
52
        set tool ""
53
    }
54
}
55
 
56
 
57
#
58
# Close the output logs
59
#
60
proc close_logs { } {
61
    global sum_file
62
 
63
    catch "close $sum_file"
64
}
65
 
66
#
67
# Check build host triplet for pattern
68
#
69
# With no arguments it returns the triplet string.
70
#
71
proc isbuild { pattern } {
72
    global build_triplet
73
    global host_triplet
74
 
75
    if ![info exists build_triplet] {
76
        set build_triplet ${host_triplet}
77
    }
78
    if [string match "" $pattern] {
79
        return $build_triplet
80
    }
81
    verbose "Checking pattern \"$pattern\" with $build_triplet" 2
82
 
83
    if [string match "$pattern" $build_triplet] {
84
        return 1
85
    } else {
86
        return 0
87
    }
88
}
89
 
90
#
91
# Is $board remote? Return a non-zero value if so.
92
#
93
proc is_remote { board } {
94
    global host_board;
95
    global target_list;
96
 
97
    verbose "calling is_remote $board" 3;
98
    # Remove any target variant specifications from the name.
99
    set board [lindex [split $board "/"] 0];
100
 
101
    # Map the host or build back into their short form.
102
    if { [board_info build name] == $board } {
103
        set board "build";
104
    } elseif { [board_info host name] == $board } {
105
        set board "host";
106
    }
107
 
108
    # We're on the "build". The check for the empty string is just for
109
    # paranoia's sake--we shouldn't ever get one. "unix" is a magic
110
    # string that should really go away someday.
111
    if { $board == "build" || $board == "unix" || $board == "" } {
112
        verbose "board is $board, not remote" 3;
113
        return 0;
114
    }
115
 
116
    if { $board == "host" } {
117
        if { [info exists host_board] && $host_board != "" } {
118
            verbose "board is $board, is remote" 3;
119
            return 1;
120
        } else {
121
            verbose "board is $board, host is local" 3;
122
            return 0;
123
        }
124
    }
125
 
126
    if { $board == "target" } {
127
        global current_target_name
128
 
129
        if [info exists current_target_name] {
130
            # This shouldn't happen, but we'll be paranoid anyway.
131
            if { $current_target_name != "target" } {
132
                return [is_remote $current_target_name];
133
            }
134
        }
135
        return 0;
136
    }
137
    if [board_info $board exists isremote] {
138
        verbose "board is $board, isremote is [board_info $board isremote]" 3;
139
        return [board_info $board isremote];
140
    }
141
    return 1;
142
}
143
#
144
# If this is a canadian (3 way) cross. This means the tools are
145
# being built with a cross compiler for another host.
146
#
147
proc is3way {} {
148
    global host_triplet
149
    global build_triplet
150
 
151
    if ![info exists build_triplet] {
152
        set build_triplet ${host_triplet}
153
    }
154
    verbose "Checking $host_triplet against $build_triplet" 2
155
    if { "$build_triplet" == "$host_triplet" } {
156
        return 0
157
    }
158
    return 1
159
}
160
 
161
#
162
# Check host triplet for pattern
163
#
164
# With no arguments it returns the triplet string.
165
#
166
proc ishost { pattern } {
167
    global host_triplet
168
 
169
    if [string match "" $pattern] {
170
        return $host_triplet
171
    }
172
    verbose "Checking pattern \"$pattern\" with $host_triplet" 2
173
 
174
    if [string match "$pattern" $host_triplet] {
175
        return 1
176
    } else {
177
        return 0
178
    }
179
}
180
 
181
#
182
# Check target triplet for pattern
183
#
184
# With no arguments it returns the triplet string.
185
# Returns 1 if the target looked for, or 0 if not.
186
#
187
proc istarget { args } {
188
    global target_triplet
189
 
190
    # if no arg, return the config string
191
    if [string match "" $args] {
192
        if [info exists target_triplet] {
193
            return $target_triplet
194
        } else {
195
            perror "No target configuration names found."
196
        }
197
    }
198
 
199
    set triplet [lindex $args 0]
200
 
201
    # now check against the cannonical name
202
    if [info exists target_triplet] {
203
        verbose "Checking \"$triplet\" against \"$target_triplet\"" 2
204
        if [string match $triplet $target_triplet] {
205
            return 1
206
        }
207
    }
208
 
209
    # nope, no match
210
    return 0
211
}
212
 
213
#
214
# Check to see if we're running the tests in a native environment
215
#
216
# Returns 1 if running native, 0 if on a target.
217
#
218
proc isnative { } {
219
    global target_triplet
220
    global build_triplet
221
 
222
    if [string match $build_triplet $target_triplet] {
223
        return 1
224
    }
225
    return 0
226
}
227
 
228
#
229
# unknown -- called by expect if a proc is called that doesn't exist
230
#
231
proc unknown { args } {
232
    global errorCode
233
    global errorInfo
234
    global exit_status
235
 
236
    clone_output "ERROR: (DejaGnu) proc \"$args\" does not exist."
237
    if [info exists errorCode] {
238
        send_error "The error code is $errorCode\n"
239
    }
240
    if [info exists errorInfo] {
241
        send_error "The info on the error is:\n$errorInfo\n"
242
    }
243
 
244
    set exit_status 1;
245
    log_and_exit;
246
}
247
 
248
#
249
# Print output to stdout (or stderr) and to log file
250
#
251
# If the --all flag (-a) option was used then all messages go the the screen.
252
# Without this, all messages that start with a keyword are written only to the
253
# detail log file.  All messages that go to the screen will also appear in the
254
# detail log.  This should only be used by the framework itself using pass,
255
# fail, xpass, xfail, warning, perror, note, untested, unresolved, or
256
# unsupported procedures.
257
#
258
proc clone_output { message } {
259
    global sum_file
260
    global all_flag
261
 
262
    if { $sum_file != "" } {
263
        puts $sum_file "$message"
264
    }
265
 
266
    regsub "^\[ \t\]*(\[^ \t\]+).*$" "$message" "\\1" firstword;
267
    case "$firstword" in {
268
        {"PASS:" "XFAIL:" "UNRESOLVED:" "UNSUPPORTED:" "UNTESTED:"} {
269
            if $all_flag {
270
                send_user "$message\n"
271
                return "$message"
272
            } else {
273
                send_log "$message\n"
274
            }
275
        }
276
        {"ERROR:" "WARNING:" "NOTE:"} {
277
            send_error "$message\n"
278
            return "$message"
279
        }
280
        default {
281
            send_user "$message\n"
282
            return "$message"
283
        }
284
    }
285
}
286
 
287
#
288
# Reset a few counters.
289
#
290
proc reset_vars {} {
291
    global test_names test_counts;
292
    global warncnt errcnt;
293
 
294
    # other miscellaneous variables
295
    global prms_id
296
    global bug_id
297
 
298
    # reset them all
299
    set prms_id 0;
300
    set bug_id  0;
301
    set warncnt 0;
302
    set errcnt  0;
303
    foreach x $test_names {
304
        set test_counts($x,count) 0;
305
    }
306
 
307
    # Variables local to this file.
308
    global warning_threshold perror_threshold
309
    set warning_threshold 3
310
    set perror_threshold 1
311
}
312
 
313
proc log_and_exit {} {
314
    global exit_status;
315
    global tool mail_logs outdir mailing_list;
316
 
317
    log_summary total;
318
    # extract version number
319
    if {[info procs ${tool}_version] != ""} {
320
        if {[catch "${tool}_version" output]} {
321
            warning "${tool}_version failed:\n$output"
322
        }
323
    }
324
    close_logs
325
    cleanup
326
    verbose -log "runtest completed at [timestamp -format %c]"
327
    if $mail_logs {
328
        mail_file $outdir/$tool.sum $mailing_list "Dejagnu Summary Log"
329
    }
330
    remote_close host
331
    remote_close target
332
    exit $exit_status
333
}
334
#
335
# Print summary of all pass/fail counts
336
#
337
proc log_summary { args } {
338
    global tool
339
    global sum_file
340
    global exit_status
341
    global mail_logs
342
    global outdir
343
    global mailing_list
344
    global current_target_name
345
    global test_counts;
346
    global testcnt;
347
 
348
    if { [llength $args] == 0 } {
349
        set which "count";
350
    } else {
351
        set which [lindex $args 0];
352
    }
353
 
354
    if { [llength $args] == 0 } {
355
        clone_output "\n\t\t=== $tool Summary for $current_target_name ===\n"
356
    } else {
357
        clone_output "\n\t\t=== $tool Summary ===\n"
358
    }
359
 
360
    # If the tool set `testcnt', it wants us to do a sanity check on the
361
    # total count, so compare the reported number of testcases with the
362
    # expected number.  Maintaining an accurate count in `testcnt' isn't easy
363
    # so it's not clear how often this will be used.
364
    if [info exists testcnt] {
365
        if { $testcnt > 0 } {
366
            set totlcnt 0;
367
            # total all the testcases reported
368
            foreach x { FAIL PASS XFAIL XPASS UNTESTED UNRESOLVED UNSUPPORTED } {
369
                incr totlcnt test_counts($x,$which);
370
            }
371
            set testcnt test_counts(total,$which);
372
 
373
            if { $testcnt>$totlcnt || $testcnt<$totlcnt } {
374
                if { $testcnt > $totlcnt } {
375
                    set mismatch "unreported  [expr $testcnt-$totlcnt]"
376
                }
377
                if { $testcnt < $totlcnt } {
378
                    set mismatch "misreported [expr $totlcnt-$testcnt]"
379
                }
380
            } else {
381
                verbose "# of testcases run         $testcnt"
382
            }
383
 
384
            if [info exists mismatch] {
385
                clone_output "### ERROR: totals do not equal number of testcases run"
386
                clone_output "### ERROR: # of testcases expected    $testcnt"
387
                clone_output "### ERROR: # of testcases reported    $totlcnt"
388
                clone_output "### ERROR: # of testcases $mismatch\n"
389
            }
390
        }
391
    }
392
    foreach x { PASS FAIL XPASS XFAIL UNRESOLVED UNTESTED UNSUPPORTED } {
393
        set val $test_counts($x,$which);
394
        if { $val > 0 } {
395
            set mess "# of $test_counts($x,name)";
396
            if { [string length $mess] < 24 } {
397
                append mess "\t";
398
            }
399
            clone_output "$mess\t$val";
400
        }
401
    }
402
}
403
 
404
#
405
# Close all open files, remove temp file and core files
406
#
407
proc cleanup {} {
408
    global sum_file
409
    global exit_status
410
    global done_list
411
    global subdir
412
 
413
    #catch "exec rm -f [glob xgdb core *.x *.o *_soc a.out]"
414
    #catch "exec rm -f [glob -nocomplain $subdir/*.o $subdir/*.x $subdir/*_soc]"
415
}
416
 
417
#
418
# Setup a flag to control whether a failure is expected or not
419
#
420
# Multiple target triplet patterns can be specified for targets
421
# for which the test fails.  A bug report ID can be specified,
422
# which is a string without '-'.
423
#
424
proc setup_xfail { args } {
425
    global xfail_flag
426
    global xfail_prms
427
 
428
    set xfail_prms 0
429
    set argc [ llength $args ]
430
    for { set i 0 } { $i < $argc } { incr i } {
431
        set sub_arg [ lindex $args $i ]
432
        # is a prms number. we assume this is a string with no '-' characters
433
        if [regexp "^\[^\-\]+$" $sub_arg] {
434
            set xfail_prms $sub_arg
435
            continue
436
        }
437
        if [istarget $sub_arg] {
438
            set xfail_flag 1
439
            continue
440
        }
441
    }
442
}
443
 
444
 
445
# check to see if a conditional xfail is triggered
446
#       message {targets} {include} {exclude}
447
#
448
#
449
proc check_conditional_xfail { args } {
450
    global compiler_flags
451
 
452
    set all_args [lindex $args 0]
453
 
454
    set message [lindex $all_args 0]
455
 
456
    set target_list [lindex $all_args 1]
457
    verbose "Limited to targets: $target_list" 3
458
 
459
    # get the list of flags to look for
460
    set includes [lindex $all_args 2]
461
    verbose "Will search for options $includes" 3
462
 
463
    # get the list of flags to exclude
464
    if { [llength $all_args] > 3 } {
465
        set excludes [lindex $all_args 3]
466
        verbose "Will exclude for options $excludes" 3
467
    } else {
468
        set excludes ""
469
    }
470
 
471
    # loop through all the targets, checking the options for each one
472
    verbose "Compiler flags are: $compiler_flags" 2
473
 
474
    set incl_hit 0
475
    set excl_hit 0
476
    foreach targ $target_list {
477
        if [istarget $targ] {
478
            # look through the compiler options for flags we want to see
479
            # this is really messy cause each set of options to look for
480
            # may also be a list. We also want to find each element of the
481
            # list, regardless of order to make sure they're found.
482
            # So we look for lists in side of lists, and make sure all
483
            # the elements match before we decide this is legit.
484
            for { set i 0 } { $i < [llength $includes] } { incr i } {
485
                set incl_hit 0
486
                set opt [lindex $includes $i]
487
                verbose "Looking for $opt to include in the compiler flags" 2
488
                foreach j "$opt" {
489
                    if [string match "* $j *" $compiler_flags] {
490
                        verbose "Found $j to include in the compiler flags" 2
491
                        incr incl_hit
492
                    }
493
                }
494
                # if the number of hits we get is the same as the number of
495
                # specified options, then we got a match
496
                if {$incl_hit == [llength $opt]} {
497
                    break
498
                } else {
499
                    set incl_hit 0
500
                }
501
            }
502
            # look through the compiler options for flags we don't
503
            # want to see
504
            for { set i 0 } { $i < [llength $excludes] } { incr i } {
505
                set excl_hit 0
506
                set opt [lindex $excludes $i]
507
                verbose "Looking for $opt to exclude in the compiler flags" 2
508
                foreach j "$opt" {
509
                    if [string match "* $j *" $compiler_flags] {
510
                        verbose "Found $j to exclude in the compiler flags" 2
511
                        incr excl_hit
512
                    }
513
                }
514
                # if the number of hits we get is the same as the number of
515
                # specified options, then we got a match
516
                if {$excl_hit == [llength $opt]} {
517
                    break
518
                } else {
519
                    set excl_hit 0
520
                }
521
            }
522
 
523
            # if we got a match for what to include, but didn't find any reasons
524
            # to exclude this, then we got a match! So return one to turn this into
525
            # an expected failure.
526
            if {$incl_hit && ! $excl_hit } {
527
                verbose "This is a conditional match" 2
528
                return 1
529
            } else {
530
                verbose "This is not a conditional match" 2
531
                return 0
532
            }
533
        }
534
    }
535
    return 0
536
}
537
 
538
#
539
# Clear the xfail flag for a particular target
540
#
541
proc clear_xfail { args } {
542
    global xfail_flag
543
    global xfail_prms
544
 
545
    set argc [ llength $args ]
546
    for { set i 0 } { $i < $argc } { incr i } {
547
        set sub_arg [ lindex $args $i ]
548
        case $sub_arg in {
549
            "*-*-*" {                   # is a configuration triplet
550
                if [istarget $sub_arg] {
551
                    set xfail_flag 0
552
                    set xfail_prms 0
553
                }
554
                continue
555
            }
556
        }
557
    }
558
}
559
 
560
#
561
# Record that a test has passed or failed (perhaps unexpectedly)
562
#
563
# This is an internal procedure, only used in this file.
564
#
565
proc record_test { type message args } {
566
    global exit_status
567
    global prms_id bug_id
568
    global xfail_flag xfail_prms
569
    global errcnt warncnt
570
    global warning_threshold perror_threshold
571
    global pf_prefix
572
 
573
    if { [llength $args] > 0 } {
574
        set count [lindex $args 0];
575
    } else {
576
        set count 1;
577
    }
578
    if [info exists pf_prefix] {
579
        set message [concat $pf_prefix " " $message];
580
    }
581
 
582
    # If we have too many warnings or errors,
583
    # the output of the test can't be considered correct.
584
    if { $warning_threshold > 0 && $warncnt >= $warning_threshold
585
         || $perror_threshold > 0 && $errcnt >= $perror_threshold } {
586
        verbose "Error/Warning threshold exceeded: \
587
                 $errcnt $warncnt (max. $perror_threshold $warning_threshold)"
588
        set type UNRESOLVED
589
    }
590
 
591
    incr_count $type;
592
 
593
    switch $type {
594
        PASS {
595
            if $prms_id {
596
                set message [concat $message "\t(PRMS $prms_id)"]
597
            }
598
        }
599
        FAIL {
600
            set exit_status 1
601
            if $prms_id {
602
                set message [concat $message "\t(PRMS $prms_id)"]
603
            }
604
        }
605
        XPASS {
606
            set exit_status 1
607
            if { $xfail_prms != 0 } {
608
                set message [concat $message "\t(PRMS $xfail_prms)"]
609
            }
610
        }
611
        XFAIL {
612
            if { $xfail_prms != 0 } {
613
                set message [concat $message "\t(PRMS $xfail_prms)"]
614
            }
615
        }
616
        UNTESTED {
617
            # The only reason we look at the xfail stuff is to pick up
618
            # `xfail_prms'.
619
            if { $xfail_flag && $xfail_prms != 0 } {
620
                set message [concat $message "\t(PRMS $xfail_prms)"]
621
            } elseif $prms_id {
622
                set message [concat $message "\t(PRMS $prms_id)"]
623
            }
624
        }
625
        UNRESOLVED {
626
            set exit_status 1
627
            # The only reason we look at the xfail stuff is to pick up
628
            # `xfail_prms'.
629
            if { $xfail_flag && $xfail_prms != 0 } {
630
                set message [concat $message "\t(PRMS $xfail_prms)"]
631
            } elseif $prms_id {
632
                set message [concat $message "\t(PRMS $prms_id)"]
633
            }
634
        }
635
        UNSUPPORTED {
636
            # The only reason we look at the xfail stuff is to pick up
637
            # `xfail_prms'.
638
            if { $xfail_flag && $xfail_prms != 0 } {
639
                set message [concat $message "\t(PRMS $xfail_prms)"]
640
            } elseif $prms_id {
641
                set message [concat $message "\t(PRMS $prms_id)"]
642
            }
643
        }
644
        default {
645
            perror "record_test called with bad type `$type'"
646
            set errcnt 0
647
            return
648
        }
649
    }
650
 
651
    if $bug_id {
652
        set message [concat $message "\t(BUG $bug_id)"]
653
    }
654
 
655
    global multipass_name
656
    if { $multipass_name != "" } {
657
        set message [format "$type: %s: $message" "$multipass_name"]
658
    } else {
659
        set message "$type: $message"
660
    }
661
    clone_output "$message"
662
 
663
    # If a command name exists in the $local_record_procs associative
664
    # array for this type of result, then invoke it.
665
 
666
    set lowcase_type [string tolower $type]
667
    global local_record_procs
668
    if {[info exists local_record_procs($lowcase_type)]} {
669
        $local_record_procs($lowcase_type) "$message"
670
    }
671
 
672
    # Reset these so they're ready for the next test case.  We don't reset
673
    # prms_id or bug_id here.  There may be multiple tests for them.  Instead
674
    # they are reset in the main loop after each test.  It is also the
675
    # testsuite driver's responsibility to reset them after each testcase.
676
    set warncnt 0
677
    set errcnt 0
678
    set xfail_flag 0
679
    set xfail_prms 0
680
}
681
 
682
#
683
# Record that a test has passed
684
#
685
proc pass { message } {
686
    global xfail_flag compiler_conditional_xfail_data
687
 
688
    # if we have a conditional xfail setup, then see if our compiler flags match
689
    if [ info exists compiler_conditional_xfail_data ] {
690
        if [check_conditional_xfail $compiler_conditional_xfail_data] {
691
            set xfail_flag 1
692
        }
693
        unset compiler_conditional_xfail_data
694
    }
695
 
696
    if $xfail_flag {
697
        record_test XPASS $message
698
    } else {
699
        record_test PASS $message
700
    }
701
}
702
 
703
#
704
# Record that a test has failed
705
#
706
proc fail { message } {
707
    global xfail_flag compiler_conditional_xfail_data
708
 
709
    # if we have a conditional xfail setup, then see if our compiler flags match
710
    if [ info exists compiler_conditional_xfail_data ] {
711
        if [check_conditional_xfail $compiler_conditional_xfail_data] {
712
            set xfail_flag 1
713
        }
714
        unset compiler_conditional_xfail_data
715
    }
716
 
717
    if $xfail_flag {
718
        record_test XFAIL $message
719
    } else {
720
        record_test FAIL $message
721
    }
722
}
723
 
724
#
725
# Record that a test has passed unexpectedly
726
#
727
proc xpass { message } {
728
    record_test XPASS $message
729
}
730
 
731
#
732
# Record that a test has failed unexpectedly
733
#
734
proc xfail { message } {
735
    record_test XFAIL $message
736
}
737
 
738
#
739
# Set warning threshold
740
#
741
proc set_warning_threshold { threshold } {
742
    set warning_threshold $threshold
743
}
744
 
745
#
746
# Get warning threshold
747
#
748
proc get_warning_threshold { } {
749
    return $warning_threshold
750
}
751
 
752
#
753
# Prints warning messages
754
# These are warnings from the framework, not from the tools being tested.
755
# It takes a string, and an optional number and returns nothing.
756
#
757
proc warning { args } {
758
    global warncnt
759
 
760
    if { [llength $args] > 1 } {
761
        set warncnt [lindex $args 1]
762
    } else {
763
        incr warncnt
764
    }
765
    set message [lindex $args 0]
766
 
767
    clone_output "WARNING: $message"
768
 
769
    global errorInfo
770
    if [info exists errorInfo] {
771
        unset errorInfo
772
    }
773
}
774
 
775
#
776
# Prints error messages
777
# These are errors from the framework, not from the tools being tested.
778
# It takes a string, and an optional number and returns nothing.
779
#
780
proc perror { args } {
781
    global errcnt
782
 
783
    if { [llength $args] > 1 } {
784
        set errcnt [lindex $args 1]
785
    } else {
786
        incr errcnt
787
    }
788
    set message [lindex $args 0]
789
 
790
    clone_output "ERROR: $message"
791
 
792
    global errorInfo
793
    if [info exists errorInfo] {
794
        unset errorInfo
795
    }
796
}
797
 
798
#
799
# Prints informational messages
800
#
801
# These are messages from the framework, not from the tools being tested.
802
# This means that it is currently illegal to call this proc outside
803
# of dejagnu proper.
804
#
805
proc note { message } {
806
    clone_output "NOTE: $message"
807
 
808
    # ??? It's not clear whether we should do this.  Let's not, and only do
809
    # so if we find a real need for it.
810
    #global errorInfo
811
    #if [info exists errorInfo] {
812
    #   unset errorInfo
813
    #}
814
}
815
 
816
#
817
# untested -- mark the test case as untested
818
#
819
proc untested { message } {
820
    record_test UNTESTED $message
821
}
822
 
823
#
824
# Mark the test case as unresolved
825
#
826
proc unresolved { message } {
827
    record_test UNRESOLVED $message
828
}
829
 
830
#
831
# Mark the test case as unsupported
832
#
833
# Usually this is used for a test that is missing OS support.
834
#
835
proc unsupported { message } {
836
    record_test UNSUPPORTED $message
837
}
838
 
839
#
840
# Set up the values in the test_counts array (name and initial totals).
841
#
842
proc init_testcounts { } {
843
    global test_counts test_names;
844
    set test_counts(TOTAL,name) "testcases run"
845
    set test_counts(PASS,name) "expected passes"
846
    set test_counts(FAIL,name) "unexpected failures"
847
    set test_counts(XFAIL,name) "expected failures"
848
    set test_counts(XPASS,name) "unexpected successes"
849
    set test_counts(WARNING,name) "warnings"
850
    set test_counts(ERROR,name) "errors"
851
    set test_counts(UNSUPPORTED,name) "unsupported tests"
852
    set test_counts(UNRESOLVED,name) "unresolved testcases"
853
    set test_counts(UNTESTED,name) "untested testcases"
854
    set j "";
855
 
856
    foreach i [lsort [array names test_counts]] {
857
        regsub ",.*$" "$i" "" i;
858
        if { $i == $j } {
859
            continue;
860
        }
861
        set test_counts($i,total) 0;
862
        lappend test_names $i;
863
        set j $i;
864
    }
865
}
866
 
867
#
868
# Increment NAME in the test_counts array; the amount to increment can be
869
# is optional (defaults to 1).
870
#
871
proc incr_count { name args } {
872
    global test_counts;
873
 
874
    if { [llength $args] == 0 } {
875
        set count 1;
876
    } else {
877
        set count [lindex $args 0];
878
    }
879
    if [info exists test_counts($name,count)] {
880
        incr test_counts($name,count) $count;
881
        incr test_counts($name,total) $count;
882
    } else {
883
        perror "$name doesn't exist in incr_count"
884
    }
885
}
886
 
887
 
888
#
889
# Create an exp_continue proc if it doesn't exist
890
#
891
# For compatablity with old versions.
892
#
893
global argv0
894
if ![info exists argv0] {
895
    proc exp_continue { } {
896
        continue -expect
897
    }
898
}

powered by: WebSVN 2.1.0

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