comparison host/libcdl/testsuite/config/default.exp @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children f58bc1b2c2bc
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 #===============================================================================
2 #
3 # default.exp
4 #
5 # Support for host-side testing
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: 1999-01-06
38 #
39 #####DESCRIPTIONEND####
40 #===============================================================================
41 #
42
43 # The host-side libcdl tests will only run on the hosts, i.e.
44 # only native testing is possible.
45 if { [isnative] != 1 } {
46 perror "Only native testing is supported."
47 exit 1
48 }
49
50 # Most of the test harness lives in a file hosttest.exp. This is part
51 # of the host-side infrastructure and gets installed in the directory
52 # $(PREFIX)/share/dejagnu. Other packages have to locate the file
53 # the hard way since the PREFIX is not provided automatically in
54 # the site.exp file, instead it is necessary to search through the
55 # build tree's Makefile.
56 #
57 # First look for the infrastructure package.
58
59 set filename [file join $::srcdir "../../../../../infra/current/host/hosttest.exp"]
60 if { [file exists $filename] } {
61
62 set status [ catch {
63 source $filename
64 } message]
65 if { $status != 0 } {
66 perror "Unexpected error while reading in the support script $filename\n$message"
67 exit 1
68 }
69
70 } else {
71
72 # It is necessary to read in the Makefile in the build tree and
73 # look for a line "prefix = xxx".
74 set filename [file join $::objdir Makefile]
75 if { [file exists $filename] == 0 } {
76 perror "The build tree's Makefile $filename does not exist."
77 exit 1
78 }
79
80 set status [ catch {
81 set fd [open $filename r]
82 set contents [read $fd]
83 close $fd
84 } message]
85 if { $status != 0 } {
86 perror "Error reading $filename.\n$message"
87 exit 1
88 }
89
90 set prefix ""
91 set dummy ""
92 set match1 ""
93
94 # This regexp is tied more closely to the automake implementation
95 # then I would like, and it may cause trouble in future.
96 foreach line [split $contents "\n"] {
97 if { [regexp -- {^prefix = *(.*)$} $line dummy match1] == 1 } {
98 set prefix $match1
99 break
100 }
101 }
102 if { $prefix == "" } {
103 perror "Unable to find the install prefix in $filename."
104 exit 1
105 }
106
107 # Now that the install tree is known it is possible to load
108 # the hosttest.exp script.
109 set filename [file join $prefix share dejagnu hosttest.exp]
110 if { [file exists $filename] == 0 } {
111 perror "The support script $filename has not been installed."
112 exit 1
113 }
114
115 set status [ catch { source $filename } message]
116 if { $status != 0 } {
117 perror "Unexpected error while reading in the support script $filename\n$message"
118 exit 1
119 }
120
121 }
122
123 # Now that the hosttest.exp utilities are available it is possible to do
124 # a bit more initialization. In particular it is possible to read in the
125 # build tree's Makefile and look for definitions of CC, CXX, and any
126 # other information from the Makefile that may prove useful.
127 hosttest_initialize {
128 cyg_ac_infra_incdir
129 cyg_ac_infra_libdir
130 cyg_ac_tcl_version
131 cyg_ac_tcl_incdir
132 cyg_ac_tcl_libdir
133 cyg_ac_tcl_libs
134 }
135
136 # There are standard routines ${tool}_start, ${tool}_load, ${tool}_exit
137 # and ${tool}_version which test harnesses should normally implement.
138 # In practice runtest only invokes ${tool}_exit and ${tool}_version
139 # directly, the rest may or may not be invoked from inside the individual
140 # test scripts.
141 #
142 # ${tool}_version is relatively straightforward. The master version
143 # number is maintained in the configure.in script and is exported to
144 # the build tree's Makefile. There is a hosttest routine which does the
145 # hard work because getting the information is common to all host
146 # packages. The _version routine itself cannot be made completely generic
147 # because the first output is package-specific.
148
149 proc ${tool}_version { } {
150
151 set status [ catch { hosttest_extract_version } message]
152 if { $status != 0 } {
153 perror $message
154 return
155 }
156 clone_output "[file join $::objdir libcdl.a] $message"
157 }
158
159 # ${tool}_start does not serve any useful purpose when it comes to
160 # testing libcdl.a - there is no tool which can be started up.
161 # Therefore none of the individual test scripts will invoke this
162 # routine.
163
164 proc ${tool}_start { } {
165 perror "CDL is a library, not a tool, and cannot be started."
166 }
167
168 # ${tool}_load is used to load a test case into the tool. The exact
169 # meaning is not applicable. However it makes sense to have this
170 # routine provide an alias for hosttest_run_simple_test which provides
171 # all the libraries etc. that are going to be needed.
172
173 proc ${tool}_load { program { args ""} } {
174 set incdirs ""
175 lappend incdirs [file join $::objdir .. $::hosttest_data(cyg_ac_infra_incdir)]
176 lappend incdirs [file join $::objdir .. $::hosttest_data(cyg_ac_tcl_incdir)]
177 set libdirs ""
178 lappend libdirs [file join $::objdir .. $::hosttest_data(cyg_ac_infra_libdir)]
179 lappend libdirs [file join $::objdir .. $::hosttest_data(cyg_ac_tcl_libdir)]
180 set libs [list cdl cyginfra]
181 foreach lib $::hosttest_data(cyg_ac_tcl_libs) {
182 lappend libs [string range $lib 2 end]
183 }
184
185 hosttest_run_simple_test $program {} $incdirs $libdirs $libs $args
186 }
187
188 # ${tool}_exit does not serve any useful purpose here.
189 proc ${tool}_exit { } {
190 }