]> git.karo-electronics.de Git - karo-tx-redboot.git/blobdiff - tools/src/infra/testsuite/config/default.exp
Initial revision
[karo-tx-redboot.git] / tools / src / infra / testsuite / config / default.exp
diff --git a/tools/src/infra/testsuite/config/default.exp b/tools/src/infra/testsuite/config/default.exp
new file mode 100644 (file)
index 0000000..6ac6326
--- /dev/null
@@ -0,0 +1,116 @@
+#===============================================================================
+#
+#    default.exp
+#
+#    Support for host-side testing
+#
+#===============================================================================
+######COPYRIGHTBEGIN####
+#                                                                          
+# ----------------------------------------------------------------------------
+# Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
+#
+# This file is part of the eCos host tools.
+#
+# This program is free software; you can redistribute it and/or modify it 
+# under the terms of the GNU General Public License as published by the Free 
+# Software Foundation; either version 2 of the License, or (at your option) 
+# any later version.
+# 
+# This program is distributed in the hope that it will be useful, but WITHOUT 
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
+# more details.
+# 
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 
+# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+# ----------------------------------------------------------------------------
+#                                                                          
+######COPYRIGHTEND####
+#===============================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s):   bartv
+# Contributors:        bartv
+# Date:                1998-11-24
+#
+#####DESCRIPTIONEND####
+#===============================================================================
+#
+
+# The host-side infrastructure tests will only run on the hosts, i.e.
+# only native testing is possible.
+if { [isnative] != 1 } {
+    perror "Only native testing is supported."
+    exit 1
+}
+
+# Most of the test harness lives in a file hosttest.exp. This is part
+# of the host-side infrastructure and gets installed in the directory
+# $(PREFIX)/share/dejagnu. Other packages have to locate the file
+# the hard way since the PREFIX is not provided automatically in
+# the site.exp file, instead it is necessary to search through the
+# build tree's Makefile. In the case of the infrastructure itself
+# a shortcut is both possible and desirable because the script may
+# not have been installed yet.
+#
+# Note that srcdir actually points at the testsuite subdirectory, not
+# at the real srcdir.
+set filename [file join $::srcdir .. hosttest.exp]
+set status [ catch { source $filename } message]
+if { $status != 0 } {
+    perror ("Unexpected error while reading in the support script $filename\n$message"
+}
+
+# Now that the hosttest.exp utilities are available it is possible to do
+# a bit more initialization. In particular it is possible to read in the
+# build tree's Makefile and look for definitions of CC, CXX, and any
+# other information from the Makefile that may prove useful.
+hosttest_initialize
+
+# There are standard routines ${tool}_start, ${tool}_load, ${tool}_exit
+# and ${tool}_version which test harnesses should normally implement.
+# In practice runtest only invokes ${tool}_exit and ${tool}_version
+# directly, the rest may or may not be invoked from inside the individual
+# test scripts.
+#
+# ${tool}_version is relatively straightforward. The master version
+# number is maintained in the configure.in script and is exported to
+# the build tree's Makefile. There is a hosttest routine which does the
+# hard work because getting the information is common to all host
+# packages. The _version routine itself cannot be made completely generic
+# because the first output is package-specific.
+
+proc ${tool}_version { } {
+
+    set status   [ catch { hosttest_extract_version } message]
+    if { $status != 0 } {
+       perror $message
+       return
+    }
+    clone_output "[file join $::objdir libcyginfra.a] $message"
+}
+
+# ${tool}_start does not serve any useful purpose when it comes to
+# testing libcyginfra.a - there is no tool which can be started up.
+# Therefore none of the individual test scripts will invoke this
+# routine.
+
+proc ${tool}_start { } {
+    perror "Cyginfra is a library, not a tool, and cannot be started."
+}
+
+# ${tool}_load is used to load a test case into the tool. The exact
+# meaning is not applicable. However it makes sense to have this
+# routine provide an alias for hosttest_run_simple_test which provides
+# all the libraries etc. that are going to be needed.
+
+proc ${tool}_load { program { args ""} } {
+    hosttest_run_simple_test $program {} {} {} cyginfra $args
+}
+
+# ${tool}_exit does not serve any useful purpose here.
+proc ${tool}_exit { } {
+}