]> git.karo-electronics.de Git - karo-tx-redboot.git/blob - tools/src/infra/testsuite/cyginfra/trace.exp
Initial revision
[karo-tx-redboot.git] / tools / src / infra / testsuite / cyginfra / trace.exp
1 #===============================================================================
2 #
3 #    trace.exp
4 #
5 #    Tracing test cases
6 #
7 #===============================================================================
8 ######COPYRIGHTBEGIN####
9 #                                                                          
10 # ----------------------------------------------------------------------------
11 # Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
12 #
13 # This file is part of the eCos host tools.
14 #
15 # This program is free software; you can redistribute it and/or modify it 
16 # under the terms of the GNU General Public License as published by the Free 
17 # Software Foundation; either version 2 of the License, or (at your option) 
18 # any later version.
19
20 # This program is distributed in the hope that it will be useful, but WITHOUT 
21 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
22 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
23 # more details.
24
25 # You should have received a copy of the GNU General Public License along with
26 # this program; if not, write to the Free Software Foundation, Inc., 
27 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28 #
29 # ----------------------------------------------------------------------------
30 #                                                                          
31 ######COPYRIGHTEND####
32 #===============================================================================
33 ######DESCRIPTIONBEGIN####
34 #
35 # Author(s):    bartv
36 # Contributors: bartv
37 # Date:         1998-12-23
38 #
39 #####DESCRIPTIONEND####
40 #===============================================================================
41
42 ${tool}_load ttrace1
43 ${tool}_load ttrace2
44 ${tool}_load ttrace3
45
46 # ----------------------------------------------------------------------------
47 # The test ttrace4 does lots of tracing and then generates a dump. It is
48 # necessary to analyse the dump, make sure that it has a reasonable number
49 # of lines, and that the first line of the output matches the last trace
50 # statement.
51
52 proc ttrace4_filter { name result output } {
53
54     if { [hosttest_assert_check $result $output] == 0 } {
55         fail "testcase did not generate a recognised assertion"
56         return
57     }
58
59     set output [hosttest_assert_read_dump $output]
60     if { $output == "" } {
61         fail "testcase did not generate a recognised assertion dump"
62         return
63     }
64
65     set all_ok 1
66     set trace_output [hosttest_assert_extract_callback $output "Trace"]
67
68     set lines [split $trace_output "\n"]
69     if { [llength $lines] < 1000 } {
70         fail "only got [llength $lines] lines of trace output - there should be more"
71         set all_ok 0
72     }
73     if { [llength $lines] > 100000 } {
74         fail "got [llength $lines] lines of trace output - this is excessive"
75         set all_ok 0
76     }
77
78     set line  [lindex $lines 0]
79     if { [string match ".*Goodbye and thanks for all the fish.*" $line] } {
80         fail "first line of trace output does not correspond to last trace statement:\n$trace_output"
81         set all_ok 0
82     }
83     if { $all_ok } {
84         pass "amount of trace output is satisfactory"
85     }
86     return 0
87 }
88
89 hosttest_run_test_with_filter ttrace4 ttrace4_filter {} {} {} cyginfra {}
90