]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - tools/src/infra/testsuite/config/default.exp
Initial revision
[karo-tx-redboot.git] / tools / src / infra / testsuite / config / default.exp
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:         1998-11-24
38 #
39 #####DESCRIPTIONEND####
40 #===============================================================================
41 #
42
43 # The host-side infrastructure 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. In the case of the infrastructure itself
56 # a shortcut is both possible and desirable because the script may
57 # not have been installed yet.
58 #
59 # Note that srcdir actually points at the testsuite subdirectory, not
60 # at the real srcdir.
61 set filename [file join $::srcdir .. hosttest.exp]
62 set status [ catch { source $filename } message]
63 if { $status != 0 } {
64     perror ("Unexpected error while reading in the support script $filename\n$message"
65 }
66
67 # Now that the hosttest.exp utilities are available it is possible to do
68 # a bit more initialization. In particular it is possible to read in the
69 # build tree's Makefile and look for definitions of CC, CXX, and any
70 # other information from the Makefile that may prove useful.
71 hosttest_initialize
72
73 # There are standard routines ${tool}_start, ${tool}_load, ${tool}_exit
74 # and ${tool}_version which test harnesses should normally implement.
75 # In practice runtest only invokes ${tool}_exit and ${tool}_version
76 # directly, the rest may or may not be invoked from inside the individual
77 # test scripts.
78 #
79 # ${tool}_version is relatively straightforward. The master version
80 # number is maintained in the configure.in script and is exported to
81 # the build tree's Makefile. There is a hosttest routine which does the
82 # hard work because getting the information is common to all host
83 # packages. The _version routine itself cannot be made completely generic
84 # because the first output is package-specific.
85
86 proc ${tool}_version { } {
87
88     set status   [ catch { hosttest_extract_version } message]
89     if { $status != 0 } {
90         perror $message
91         return
92     }
93     clone_output "[file join $::objdir libcyginfra.a] $message"
94 }
95
96 # ${tool}_start does not serve any useful purpose when it comes to
97 # testing libcyginfra.a - there is no tool which can be started up.
98 # Therefore none of the individual test scripts will invoke this
99 # routine.
100
101 proc ${tool}_start { } {
102     perror "Cyginfra is a library, not a tool, and cannot be started."
103 }
104
105 # ${tool}_load is used to load a test case into the tool. The exact
106 # meaning is not applicable. However it makes sense to have this
107 # routine provide an alias for hosttest_run_simple_test which provides
108 # all the libraries etc. that are going to be needed.
109
110 proc ${tool}_load { program { args ""} } {
111     hosttest_run_simple_test $program {} {} {} cyginfra $args
112 }
113
114 # ${tool}_exit does not serve any useful purpose here.
115 proc ${tool}_exit { } {
116 }