⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.exp

📁 基于ecos的redboot
💻 EXP
字号:
#===============================================================================
#
#    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:		1999-01-06
#
#####DESCRIPTIONEND####
#===============================================================================
#

# The host-side libcdl 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.
#
# First look for the infrastructure package.

set filename [file join $::srcdir "../../../../../infra/current/host/hosttest.exp"]
if { [file exists $filename] } {

    set status [ catch {
	source $filename
    } message]
    if { $status != 0 } {
	perror "Unexpected error while reading in the support script $filename\n$message"
	exit 1
    }
    
} else {
    
    # It is necessary to read in the Makefile in the build tree and
    # look for a line "prefix = xxx".
    set filename [file join $::objdir Makefile]
    if { [file exists $filename] == 0 } {
	perror "The build tree's Makefile $filename does not exist."
	exit 1
    }

    set status [ catch {
	set fd [open $filename r]
	set contents [read $fd]
	close $fd
    } message]
    if { $status != 0 } {
	perror "Error reading $filename.\n$message"
	exit 1
    }

    set prefix ""
    set dummy  ""
    set match1 ""

    # This regexp is tied more closely to the automake implementation
    # then I would like, and it may cause trouble in future.
    foreach line [split $contents "\n"] {
	if { [regexp -- {^prefix = *(.*)$} $line dummy match1] == 1 } {
	    set prefix $match1
	    break
	}
    }
    if { $prefix == "" } {
	perror "Unable to find the install prefix in $filename."
	exit 1
    }

    # Now that the install tree is known it is possible to load
    # the hosttest.exp script.
    set filename [file join $prefix share dejagnu hosttest.exp]
    if { [file exists $filename] == 0 } {
	perror "The support script $filename has not been installed."
	exit 1
    }

    set status [ catch { source $filename } message]
    if { $status != 0 } {
	perror "Unexpected error while reading in the support script $filename\n$message"
	exit 1
    }
    
}

# 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 {
    cyg_ac_infra_incdir
    cyg_ac_infra_libdir
    cyg_ac_tcl_version
    cyg_ac_tcl_incdir
    cyg_ac_tcl_libdir
    cyg_ac_tcl_libs
}

# 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 libcdl.a] $message"
}

# ${tool}_start does not serve any useful purpose when it comes to
# testing libcdl.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 "CDL 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 ""} } {
    set incdirs ""
    lappend incdirs [file join $::objdir .. $::hosttest_data(cyg_ac_infra_incdir)]
    lappend incdirs [file join $::objdir .. $::hosttest_data(cyg_ac_tcl_incdir)]
    set libdirs ""
    lappend libdirs [file join $::objdir .. $::hosttest_data(cyg_ac_infra_libdir)]
    lappend libdirs [file join $::objdir .. $::hosttest_data(cyg_ac_tcl_libdir)]
    set libs [list cdl cyginfra]
    foreach lib $::hosttest_data(cyg_ac_tcl_libs) {
	lappend libs [string range $lib 2 end]
    }
    
    hosttest_run_simple_test $program {} $incdirs $libdirs $libs $args
}

# ${tool}_exit does not serve any useful purpose here.
proc ${tool}_exit { } {
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -