diff options
author | Rob Savoye <rob@welcomehome.org> | 2001-02-05 04:26:49 +0000 |
---|---|---|
committer | Rob Savoye <rob@welcomehome.org> | 2001-02-05 04:26:49 +0000 |
commit | 8813c6679e78c06d69259993baf8f44537abdc11 (patch) | |
tree | cd107e9fab160ca92d55e594e878d0d9bb776cce /testsuite | |
parent | 65bfb0bc0716fbf4ae5f12992afa403287143039 (diff) | |
download | dejagnu-origin/redhat.zip dejagnu-origin/redhat.tar.gz dejagnu-origin/redhat.tar.bz2 |
import from redhat cvsfrom-devoorigin/redhatredhat
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/Makefile.am | 5 | ||||
-rw-r--r-- | testsuite/Makefile.in | 207 | ||||
-rw-r--r-- | testsuite/config/default.exp | 79 | ||||
-rw-r--r-- | testsuite/lib/libsup.exp | 220 | ||||
-rw-r--r-- | testsuite/runtest.all/clone_output.test | 68 | ||||
-rw-r--r-- | testsuite/runtest.all/config.test | 138 | ||||
-rw-r--r-- | testsuite/runtest.all/default_procs.tcl | 94 | ||||
-rw-r--r-- | testsuite/runtest.all/libs.exp | 92 | ||||
-rw-r--r-- | testsuite/runtest.all/options.exp | 93 | ||||
-rw-r--r-- | testsuite/runtest.all/remote.test | 217 | ||||
-rw-r--r-- | testsuite/runtest.all/stats-sub.exp | 35 | ||||
-rw-r--r-- | testsuite/runtest.all/stats.exp | 53 | ||||
-rw-r--r-- | testsuite/runtest.all/target.test | 247 | ||||
-rw-r--r-- | testsuite/runtest.all/topdir/subdir1/subfile1 | 1 | ||||
-rw-r--r-- | testsuite/runtest.all/topdir/subdir1/subfile2 | 2 | ||||
-rw-r--r-- | testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 | 2 | ||||
-rw-r--r-- | testsuite/runtest.all/topdir/subdir2/subfile2 | 2 | ||||
-rw-r--r-- | testsuite/runtest.all/utils.test | 118 |
18 files changed, 1673 insertions, 0 deletions
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am new file mode 100644 index 0000000..88dab63 --- /dev/null +++ b/testsuite/Makefile.am @@ -0,0 +1,5 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus dejagnu + +DEJATOOL = runtest diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in new file mode 100644 index 0000000..eea1b06 --- /dev/null +++ b/testsuite/Makefile.in @@ -0,0 +1,207 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +BOARDS = @BOARDS@ +CC = @CC@ +CONFIG = @CONFIG@ +EXEEXT = @EXEEXT@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +AUTOMAKE_OPTIONS = cygnus dejagnu + +DEJATOOL = runtest +mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +EXPECT = `if test -f $(top_builddir)/../expect/expect; then echo $(top_builddir)/../expect/expect; else echo expect; fi` +RUNTEST = `if test -f $(top_srcdir)/../dejagnu/runtest; then echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi` +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --cygnus testsuite/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = testsuite + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +RUNTESTFLAGS = + +RUNTESTDEFAULTFLAGS = --tool $(DEJATOOL) --srcdir $$srcdir + +check-DEJAGNU: site.exp + srcdir=`cd $(srcdir) && pwd`; export srcdir; \ + EXPECT=$(EXPECT); export EXPECT; \ + if [ -f $(top_builddir)/../expect/expect ]; then \ + TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \ + export TCL_LIBRARY; \ + fi; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + $$runtest $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi +site.exp: Makefile + @echo 'Making a new site.exp file...' + @test ! -f site.bak || rm -f site.bak + @echo '## these variables are automatically generated by make ##' > $@-t + @echo '# Do not edit here. If you wish to override these values' >> $@-t + @echo '# edit the last section' >> $@-t + @echo 'set tool $(DEJATOOL)' >> $@-t + @echo 'set srcdir $(srcdir)' >> $@-t + @echo 'set objdir' `pwd` >> $@-t + @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t + @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t + @test ! -f site.exp || mv site.exp site.bak + @mv $@-t site.exp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU +check: check-am +installcheck-am: +installcheck: installcheck-am +install-info-am: +install-info: install-info-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir check-DEJAGNU info-am info dvi-am dvi check \ +check-am installcheck-am installcheck install-info-am install-info \ +install-exec-am install-exec install-data-am install-data install-am \ +install uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/testsuite/config/default.exp b/testsuite/config/default.exp new file mode 100644 index 0000000..0d427d0 --- /dev/null +++ b/testsuite/config/default.exp @@ -0,0 +1,79 @@ +# Copyright (C) 1988, 90-93, 1995, 1996, 1997 Free Software Foundation, Inc. + +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +global RUNTEST +if ![info exists RUNTEST] then { + set RUNTEST [transform runtest] +} + +if ![info exists EXPECT] { + set EXPECT [findfile $base_dir/../../expect/expect "$base_dir/../../expect/expect" expect] + verbose "EXPECT defaulting to $EXPECT" 2 +} + +global RUNTESTFLAGS +if ![info exists RUNTESTFLAGS] then { + set RUNTESTFLAGS "-v -v -a" +} + +# +# runtest_version -- extract and print the version number +# +proc runtest_version { } { + global RUNTEST + + catch {exec $RUNTEST -V} tmp + if [info exists tmp] then { + clone_output "$tmp\n" + } +} + +# +# runtest_load -- loads the program. For runtest, this is just a stub +# +proc runtest_load { arg } { +} + +# +# runtest_exit -- exit the test driver for expect +# +proc runtest_exit { } { + close +} + +# +# runtest_start -- start everything +# +proc runtest_start { } { + global verbose + global spawn_id + global subdir + global srcdir + global objdir + global RUNTEST + global RUNTESTFLAGS + + if {[which $RUNTEST] != 0} then { + perror "Can't find $RUNTEST" + } + +# return [open [concat "$RUNTEST $RUNTESTFLAGS"] r] +} diff --git a/testsuite/lib/libsup.exp b/testsuite/lib/libsup.exp new file mode 100644 index 0000000..eecf5f7 --- /dev/null +++ b/testsuite/lib/libsup.exp @@ -0,0 +1,220 @@ +# Copyright (C) 92, 93, 94, 95, 1996 Free Software Foundation, Inc. + +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +# +# Setup an environment so we can execute library procs without DejaGnu +# + +# +# Create a default environment and start expect. +# +proc make_defaults_file { defs } { + global srcdir + global objdir + global subdir + global build_triplet + global host_triplet + global target_triplet + global target_os + global target_cpu + + # We need to setup default values and a few default procs so we + # can execute library code without DejaGnu + set fd [open $defs w] + puts ${fd} "set tool foobar" + puts ${fd} "set srcdir ${srcdir}" + puts ${fd} "set objdir ${objdir}" + puts ${fd} "set subdir ${subdir}" + puts ${fd} "set build_triplet ${build_triplet}" + puts ${fd} "set host_triplet ${host_triplet}" + puts ${fd} "set target_triplet ${target_triplet}" + puts ${fd} "set target_os ${target_os}" + puts ${fd} "set target_cpu ${target_cpu}" + puts ${fd} "set tool foobar" + puts ${fd} "set testcnt 0" + puts ${fd} "set warncnt 0" + puts ${fd} "set errcnt 0" + puts ${fd} "set passcnt 0" + puts ${fd} "set xpasscnt 0" + puts ${fd} "set failcnt 0" + puts ${fd} "set xfailcnt 0" + puts ${fd} "set prms_id 0" + puts ${fd} "set bug_id 0" + puts ${fd} "set exit_status 0" + puts ${fd} "set untestedcnt 0" + puts ${fd} "set unresolvedcnt 0" + puts ${fd} "set unsupportedcnt 0" + puts ${fd} "set xfail_flag 0" + puts ${fd} "set xfail_prms 0" + puts ${fd} "set mail_logs 0" + puts ${fd} "set multipass_name 0" + catch "close $fd" +} + +proc start_expect { } { + global spawn_id + global base_dir + + # We need to setup default values and a few default procs so we + # can execute library code without DejaGnu + set defaults_file setval.tmp + make_defaults_file $defaults_file + set fd [open ${defaults_file} w] + + # look for expect + if ![info exists EXPECT] { + set EXPECT [findfile $base_dir/../../expect/expect "$base_dir/../../expect/expect" expect] + verbose "EXPECT defaulting to $EXPECT" 2 + } + +# catch close +# catch wait + + # Start expect runing + spawn "$EXPECT" + expect { + -re "expect.*> " { + verbose "Started the child expect shell" 2 + } + timeout { + perror "Timed out starting the child expect shell." + return -1 + } + } + + # Load the defaults file + exp_send "source ${defaults_file}\n" + expect { + "expect*> " { + verbose "Loaded testing defaults file." 2 + return 1 + } + timeout { + perror "Couldn't load the testing defaults file." + return -1 + } + } +} + +# +# Stop the runing expect process +# +proc stop_expect { } { + global spawn_id + + # make expect exit + exp_send "exit\n" + catch "close -i $spawn_id" + catch "wait -i $spawn_id" +} + +# +# Load the library to test +# +proc load_test_lib { lib } { + global spawn_id + exp_send "source ${lib}\n" + expect { + "expect*> " { + verbose "Testing ${lib}" 2 + } + timeout { + perror "Couldn't load the libraries to test" + return -1 + } + } +} + +# +# test a library proc that emits patterns +# +proc exp_test { cmd pattern msg } { + global spawn_id + + exp_send "puts ACK ; $cmd ; puts NAK\r\n" + expect { + "puts ACK*puts NAK" { + verbose "Got command echo" 3 + } + timeout { + warning "Never got command echo" + } + } + + expect { + "ACK" { + exp_continue + } + -re "\r\n1\r\n" { + warning "$msg, 1 was returned" + exp_continue + } + -re "\r\n0\r\n" { + warning "$msg, 0 was returned" + exp_continue + } + "$pattern" { + pass "$msg" + } + timeout { + fail "$msg" + } + } +} + +# test a config proc that only returns a code +# ex... config_test "isbuild $build_triplet" "pass" "fail" "isbuild, native" +# args are: command, true condition, false condition, message to print +proc config_test { cmd true false msg } { + global spawn_id + + set timeout 20 + exp_send "puts ACK ; puts \[$cmd\] ; puts NAK\r\n" + expect { + "puts ACK*$cmd*puts NAK" { + verbose "Got command echo" 3 + } + timeout { + warning "Never got command echo" + } + } + + expect { + -re "Checking pattern*with*\[\r\n\]" { + exp_continue + } + -re "\r\n1\r\n" { + $true "$msg" + } + -re "\r\n0\r\n" { + $false "$msg" + } + timeout { + perror "$msg (timed out)" + } + } +} + + + + + + diff --git a/testsuite/runtest.all/clone_output.test b/testsuite/runtest.all/clone_output.test new file mode 100644 index 0000000..e1d1cd2 --- /dev/null +++ b/testsuite/runtest.all/clone_output.test @@ -0,0 +1,68 @@ +# test clone_output + +set srcdir [lindex $argv 0] +set subdir [lindex $argv 1] +set objdir [lindex $argv 2] + +if [ file exists $objdir/setval.tmp ] { + source $objdir/setval.tmp +} else { + puts "ERROR: $objdir/setval.tmp doesn't exist" +} +if [ file exists $srcdir/$subdir/default_procs.tcl ] { + source "$srcdir/$subdir/default_procs.tcl" +} else { + puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist" +} +if [ file exists $srcdir/../lib/framework.exp] { + source $srcdir/../lib/framework.exp +} else { + puts "ERROR: $srcdir/../lib/framework.exp doesn't exist" +} + +set all_flag 0 +global all_flag +set errno "" + +# stuff that shouldn't print anything without all_flag set +set all_flag 0 +set tests { + { "lib_pat_test" "clone_output" "PASS: Foo" "" "clone_output(pass) without all_flag set" } + { "lib_pat_test" "clone_output" "UNRESOLVED: Foo" "" "clone_output(unresolved) without all_flag set" } + { "lib_pat_test" "clone_output" "UNSUPPORTED: Foo" "" "clone_output(unsupported) without all_flag set" } + { "lib_pat_test" "clone_output" "UNTESTED: Foo" "" "clone_output(untested) without all_flag set" } + { "lib_pat_test" "clone_output" "ERROR: Bar" "ERROR: Bar" "clone_output(error) without all_flag set" } + { "lib_pat_test" "clone_output" "WARNING: Bar" "WARNING: Bar" "clone_output(warning) without all_flag set" } + { "lib_pat_test" "clone_output" "NOTE: Bar" "NOTE: Bar" "clone_output(note) without all_flag set" } +} + +run_tests $tests + +# tests for all_flag set to 1 +set all_flag 1 +set tests { + { "lib_pat_test" "clone_output" "PASS: Foo" "PASS: Foo" "clone_output(pass) with all_flag set" } + { "lib_pat_test" "clone_output" "XFAIL: Foo" "XFAIL: Foo" "clone_output(xfail) with all_flag set" } + { "lib_pat_test" "clone_output" "UNRESOLVED: Foo" "UNRESOLVED: Foo" "clone_output(unresolved) with all_flag set" } + { "lib_pat_test" "clone_output" "UNSUPPORTED: Foo" "UNSUPPORTED: Foo" "clone_output(unsupported) with all_flag set" } + { "lib_pat_test" "clone_output" "UNTESTED: Foo" "UNTESTED: Foo" "clone_output(untested) with all_flag set" } + { "lib_pat_test" "clone_output" "ERROR: Foo" "ERROR: Foo" "clone_output(error) with all_flag set" } + { "lib_pat_test" "clone_output" "WARNING: Foo" "WARNING: Foo" "clone_output(warning) with all_flag set" } + { "lib_pat_test" "clone_output" "NOTE: Foo" "NOTE: Foo" "clone_output(note) with all_flag set" } +} + +run_tests $tests + + + + + + + + + + + + + + diff --git a/testsuite/runtest.all/config.test b/testsuite/runtest.all/config.test new file mode 100644 index 0000000..a85095d --- /dev/null +++ b/testsuite/runtest.all/config.test @@ -0,0 +1,138 @@ +# test clone_output + +set srcdir [lindex $argv 0] +set subdir [lindex $argv 1] +set objdir [lindex $argv 2] + +if [ file exists $objdir/setval.tmp ] { + source $objdir/setval.tmp +} else { + puts "ERROR: $objdir/setval.tmp doesn't exist" +} +if [ file exists $srcdir/$subdir/default_procs.tcl ] { + source "$srcdir/$subdir/default_procs.tcl" +} else { + puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist" +} +if [ file exists $srcdir/../lib/framework.exp] { + source $srcdir/../lib/framework.exp +} else { + puts "ERROR: $srcdir/../lib/framework.exp doesn't exist" +} + +set all_flag 1 + +set host_triplet i586-unknown-linux +set target_triplet i586-unknown-linux +set target_cpu i586 +set target_os linux +set build_triplet i586-unknown-linux + +# FIXME: should use run_tests here, but due to Tcl's weird scoping rules, I get +# problems. + +# +# Tests for a native configuration +# +if [isbuild $build_triplet] { + puts "PASSED: isbuild, native" +} else { + puts "FAILED: isbuild, native" +} + +if [isbuild $target_cpu-*-$target_os ] { + puts "PASSED: isbuild, native regexp" +} else { + puts "FAILED: isbuild, native regexp" +} + +if [isbuild hppa-ibm-macos ] { + puts "FAILED: isbuild, native bogus config string" +} else { + puts "PASSED: isbuild, native bogus config string" +} + +# ishost tests +if [ishost $host_triplet] { + puts "PASSED: ishost, native" +} else { + puts "FAILED: ishost, native" +} + +if [ishost $target_cpu-*-$target_os] { + puts "PASSED: ishost, native regexp" +} else { + puts "FAILED: ishost, native regexp" +} + +if [ishost hppa-ibm-macos] { + puts "FAILED: ishost, native bogus config string" +} else { + puts "PASSED: ishost, native bogus config string" +} + +# istarget tests +if [istarget $target_triplet] { + puts "PASSED: istarget, native" +} else { + puts "FAILED: istarget, native" +} + +if [istarget $target_cpu-*-$target_os] { + puts "PASSED: istarget, native regexp" +} else { + puts "FAILED: istarget, native regexp" +} + +if [istarget hppa-ibm-macos] { + puts "FAILED: istarget, native bogus config string" +} else { + puts "PASSED: istarget, native bogus config string" +} + +# native tests +if [isnative] { + puts "PASSED: isnative, native" +} else { + puts "FAILED: isnative, native" +} + +if [is3way] { + puts "FAILED: is3way, native" +} else { + puts "PASSED: is3way, native" +} + +# +# Tests for a normal cross configuration +# +set target_triplet m68k-unknown-elf +if [isnative] { + puts "FAILED: isnative, cross" +} else { + puts "PASSED: isnative, cross" +} + +if [is3way] { + puts "FAILED: is3way, cross" +} else { + puts "PASSED: is3way, cross" +} + +# +# Tests for a canadian cross configuration +# +set host_triplet i386-unknown-winnt +if [isnative] { + puts "FAILED: isnative, canadian cross" +} else { + puts "PASSED: isnative, canadian cross" +} + +if [is3way] { + puts "PASSED: is3way, canadian cross" +} else { + puts "FAILED: is3way, canadian cross" +} + + diff --git a/testsuite/runtest.all/default_procs.tcl b/testsuite/runtest.all/default_procs.tcl new file mode 100644 index 0000000..a0e6f88 --- /dev/null +++ b/testsuite/runtest.all/default_procs.tcl @@ -0,0 +1,94 @@ +set sum_file [open .tmp w] +set reboot 0 +set errno "" + +# this tests a proc for a returned pattern +proc lib_pat_test { cmd arg pattern } { + catch "$cmd \"$arg\"" result + puts "CMD(lib_pat_test) was: $cmd \"$arg\"" + puts "RESULT(lib_pat_test) was: \"${result}\" for pattern \"$pattern\"." + if [ regexp -- "with too many" $result ] { + return -1 + } + if [ string match "$pattern" $result ] { + return 1 + } else { + return 0 + } +} + +# this tests a proc for a returned value +proc lib_ret_test { cmd arg val } { + catch "$cmd \"$arg\"" result +# catch "set result [$cmd $arg]" output +# set result "$cmd [eval $arg] + puts "CMD(lib_ret_test) was: $cmd $arg" + puts "RESULT(lib_ret_test) was: $result" +# puts "OUTPUT(lib_ret_test) was: $output" + + if { $result == $val } { + return 1 + } else { + return 0 + } +} + +# +# This runs a standard test for a proc. The list is set up as: +# |test proc|proc being tested|args|pattern|message| +# test proc is something like lib_pat_test or lib_ret_test. +# +proc run_tests { tests } { + foreach i "$tests" { + set result [ [lindex $i 0] "[lindex $i 1]" "[lindex $i 2]" "[lindex $i 3]" ] + switch -- $result { + "-1" { + puts "ERRORED: [lindex $i 4]" + } + "1" { + puts "PASSED: [lindex $i 4]" + } + "0" { + puts "FAILED: [lindex $i 4]" + } + default { + puts "BAD VALUE: [lindex $i 4]" + } + } + } +} + +proc send_log { msg } { + # this is just a stub for testing +} + +proc pass { msg } { + puts "PASSED: $msg" +} + +proc fail { msg } { + puts "FAILED: $msg" +} + +proc perror { msg } { + global errno + puts "ERRORED: $msg" + set errno "$msg" +} + +proc warning { msg } { + global errno + puts "WARNED: $msg" + set errno "$msg" +} + +proc untested { msg } { + puts "NOTTESTED: $msg" +} + +proc unsupported { msg } { + puts "NOTSUPPORTED: $msg" +} +proc verbose { args } { + puts "[lindex $args 0]" +} diff --git a/testsuite/runtest.all/libs.exp b/testsuite/runtest.all/libs.exp new file mode 100644 index 0000000..eb5e1af --- /dev/null +++ b/testsuite/runtest.all/libs.exp @@ -0,0 +1,92 @@ +# Copyright (C) 1997 Free Software Foundation, Inc. + +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +load_lib libsup.exp + +proc process_test { test } { + global srcdir + global subdir + global objdir + global EXPECT + + verbose "Executing test case $test" + set text "\[- A-Za-z0-9\,\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]*" + + set timeout 150 + + if [file exists $test] { + verbose "Processing test $test" 2 + spawn -open [open "|$EXPECT $test $srcdir $subdir [pwd]" r] + expect { + "No such file or directory" { + perror "$test wouldn't run" 0 + } + -re "\[\r\n\]*NOTSUPPORTED: $text\[\r\n\]*" { + unsupported "[lrange $expect_out(0,string) 1 end]" + exp_continue + } + -re "\[\r\n\]*NOTTESTED: $text\[\r\n\]*" { + untested "[lrange $expect_out(0,string) 1 end]" + exp_continue + } + -re "\[\r\n\]*PASSED: $text\[\r\n\]*" { + pass "[lrange $expect_out(0,string) 1 end]" + exp_continue + } + -re "\[\r\n\]*FAILED: $text\[\r\n\]*" { + fail "[lrange $expect_out(0,string) 1 end]" + exp_continue + } + -re "\[\r\n\]*WARNED: $text\[\r\n\]*" { + verbose "$expect_out(0,string)" 2 + exp_continue + } + -re "\[\r\n\]*ERRORED: $text\[\r\n\]*" { + verbose "$expect_out(0,string)" 2 + exp_continue + } + timeout { + perror "$test timed out" 0 + exp_continue + } + eof { + verbose "All Done" 3 + } + } + } else { + perror "$test doesn't exist" 0 + } +} + +if ![info exists EXPECT] { + set EXPECT [findfile $base_dir/../../expect/expect "$base_dir/../../expect/expect" expect] + verbose "EXPECT defaulting to $EXPECT" 2 +} + +make_defaults_file [pwd]/setval.tmp + +foreach i [glob $srcdir/$subdir/*.test] { + process_test $i +} + + + + + + diff --git a/testsuite/runtest.all/options.exp b/testsuite/runtest.all/options.exp new file mode 100644 index 0000000..0c396ce --- /dev/null +++ b/testsuite/runtest.all/options.exp @@ -0,0 +1,93 @@ +# Copyright (C) 1988, 90-92, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. + +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file was written by Rob Savoye. (rob@cygnus.com) + +load_lib util-defs.exp + +# move the site.exp file so we have no default to confuse us. +#if [file exists $objdir/site.exp] { +# catch "exec mv -f $objdir/site.exp $objdir/site.ignore" +#} +set fd [open site.exp w] +puts ${fd} "set host_triplet $host_triplet" +puts ${fd} "set srcdir $srcdir/.." +puts ${fd} "set objdir $objdir/.." +puts ${fd} "set tmpdir $objdir/../tmpdir" +close $fd + +# +# Set up the list. +# 1st field is the command line option. +# 2nd field is the pattern to match. +# NOTE - No variable substitutions can be used. +# 3rd field is an optional message to print with PASS/FAIL. +# + + +set tests { + { "" "WARNING: No tool specified" "No arguments" } + { "-v --tool xXx" "Found.*site\..*Loading.*utils\.exp" "Loading library files" } + { "-v --tool xXx" "Expect binary is.*Using.*main test driver" "Loading basic packages" } + { "--F --tool x" "Illegal Argument \"--F\"" "Bad argument" } + { "--tool x" "Couldn't find tool init file" "Bad tool name" } + { "--help" "USAGE:*" "Display help" } + { "-v -v -v" "Verbose level is 3" "Verbose set correctly" } + { "-V" "Expect version is.*Tcl version is.*Framework version is*" "--version" } + { "-v --target m68k-vxworks" "Target is m68k-vxworks" "--target option" } + { "-v --host sparc-sun-sunos4.1.9" "Native configuration is sparc-sun-sunos4.1.9" "--host option" } + { "-v -a" "Print all test output to screen" "--all option" } + { "-v --objdir xXx" "Using test binaries in xXx" "--objdir option" } + { "-v --tool xXx" "Testing xXx" "--tool option" } + { "-v --debug" "Expect Debugging is ON" "--debug option" } + { "-v --D0" "Tcl debugger is ON" "--D0 option" } +} + +# Commented out for now--this is failing because of a TCL8 strace interaction. +# { "-v --strace 1" "Source Trace level is now 1.* 1 if" "--strace option" } + + +# Old tests not used anymore +# { "-v --build sparc-sun-sunos4.1.9" "Native configuration is sparc-sun-sunos4.1.9" "--build option" } +# { "-v --srcdir xXx" "Using test sources in xXx" "--srcdir option" } + +foreach i $tests { + if [util_test "$RUNTEST" "[lindex $i 0] -srcdir ${srcdir}/runtest.all" "" "[lindex $i 1]"] { + fail "[lindex $i 2]" + } else { + pass "[lindex $i 2]" + } +} + + +set fd [open site.exp w] +puts ${fd} "set host_triplet $host_triplet" +puts ${fd} "set tool runtest" +puts ${fd} "set srcdir $srcdir" +puts ${fd} "set objdir $objdir" +puts ${fd} "set tmpdir $objdir/tmpdir" +close $fd + +# clean up log files left by the child runtest +if [file exists $objdir/x.sum] { + exec rm -f $objdir/x.* +} +if [file exists $objdir/xXx.sum] { + exec rm -f $objdir/xXx.* +} diff --git a/testsuite/runtest.all/remote.test b/testsuite/runtest.all/remote.test new file mode 100644 index 0000000..03f16fc --- /dev/null +++ b/testsuite/runtest.all/remote.test @@ -0,0 +1,217 @@ +set srcdir [lindex $argv 0] +set subdir [lindex $argv 1] +set objdir [lindex $argv 2] + +if [ file exists $objdir/setval.tmp ] { + source $objdir/setval.tmp +} else { + puts "ERROR: $objdir/setval.tmp doesn't exist" +} +if [ file exists $srcdir/$subdir/default_procs.tcl ] { + source "$srcdir/$subdir/default_procs.tcl" +} else { + puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist" +} + +set file $srcdir/../lib/remote.exp +if [ file exists $file] { + source $file +} else { + puts "ERROR: $file doesn't exist" +} + +global errno "" + +# +# Create a false target config array +# +set target_info(idp,name) "idp" +set target_info(idp,ldflags) "-Tidp.ld" +set target_info(idp,config) m68k-unknown-aout +set target_info(idp,cflags) "" +set target_info(idp,connect) telnet +set target_info(idp,target) "s12" +set target_info(idp,serial) "tstty12" +set target_info(idp,netport) "localhost:23" +set target_info(idp,baud) "9600" +# MVME target +set target_info(mvme,name) "mvme" +set target_info(mvme,ldflags) "-Tmvme.ld" +set target_info(mvme,config) m68k-unknown-aout +set target_info(mvme,cflags) "" +set target_info(mvme,connect) telnet +set target_info(mvme,target) "s12" +set target_info(mvme,serial) "tstty8" +set target_info(mvme,netport) "localhost:23" +set target_info(mvme,baud) "9600" + +# Test remote open. We try not to use any of the support procs in +# target.exp to for isolation testing. "target" is the name of the +# default array setup by the procs in target.exp. + +set timeout 100 +set errno "" + +# +# Force connection errors +# + +# force an rlogin error +if { [rlogin foobar.barfoo.com] < 0 } { + puts "PASSED: rlogin bogus host" +} else { + puts "FAILED: rlogin bogus" +} + +# force an rsh error +if { [rsh foobar.barfoo.com] < 0 } { + puts "PASSED: rsh bogus host" +} else { + puts "FAILED: rsh bogus" +} + +# force a telnet error +if { [telnet foobar.barfoo.com] < 0 } { + puts "PASSED: telnet bogus host" +} else { + puts "FAILED: telnet bogus" +} + +# +# Connect to localhost +# + +# localhost rlogin test +if { [rlogin localhost] < 0 } { + if [string match "*unencrypted connection" $errno] { + NOTTESTED "rlogin localhost" + } else { + puts "FAILED: rlogin localhost" + } +} else { + puts "PASSED: rlogin localhost" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# localhost rsh test +if { [rsh localhost] < 0 } { + if [string match "*kinit" $errno] { + puts "NOTTESTED: rsh localhost" + } else { + puts "FAILED: rsh localhost" + } +} else { + puts "PASSED: rsh localhost" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# localhost telnet test. In this case it will return +# an error cause we get prompted for a password or login. For +# now this is considered an error, as we usually only +# telnet to a terminal server. +if { [telnet localhost] < 0 } { + if [string match "*password." $errno] { + puts "NOTTESTED: telnet localhost" + } else { + puts "FAILED: telnet localhost" + } +} else { + puts "PASSED: telnet localhost" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# +# Connect to the configured target +# +set target_info(target,netport) $target_info(idp,netport) +set target_info(target,target) localhost +set target_info(target,connect) rlogin +if { [rlogin target] < 0 } { + if [ string match "*kinit" $errno] { + puts "NOTTESTED: rlogin target" + } else { + puts "FAILED: rlogin target" + } +} else { + puts "PASSED: rlogin target" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# test remote_open +if { [rsh target] < 0 } { + if [ string match "*kinit" $errno] { + puts "NOTTESTED: rsh target" + } else { + puts "FAILED: rsh target" + } +} else { + puts "PASSED: rsh target" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# telnet to host +# FIXME: This won't work till we figure out how to telnet and +# not get a password prompt. + +# +# Connect to the configured host +# +set target_info(host,connect) rlogin +set target_info(host,netport) $target_info(idp,netport) +set target_info(host,target) localhost + +# rlogin to host +if { [rlogin host] < 0 } { + if [ string match "*kinit*" $errno] { + puts "NOTTESTED: rlogin host" + } else { + puts "FAILED: rlogin host" + } +} else { + puts "PASSED: rlogin host" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# rsh to host +if { [rsh host] < 0 } { + if [ string match "*kinit*" $errno] { + puts "NOTTESTED: rsh host" + } else { + puts "FAILED: rsh host" + } +} else { + puts "PASSED: rsh host" +} +catch "exp_send exit\n" +catch "close -i $spawn_id" +catch "wait -i $spawn_id" + +# telnet to host +# FIXME: This won't work till we figure out how to telnet and +# not get a password prompt. + +# tip port +# remote_close args +# rcp_download src dest +# tip_download shell_id file +# kermit args +# download args + + + + + + + diff --git a/testsuite/runtest.all/stats-sub.exp b/testsuite/runtest.all/stats-sub.exp new file mode 100644 index 0000000..deb52f8 --- /dev/null +++ b/testsuite/runtest.all/stats-sub.exp @@ -0,0 +1,35 @@ +# Copyright (C) 1997 Free Software Foundation, Inc. + +# 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. + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# Subordinate to stats.exp. + +# If not called by stats.exp, quit now. +if { ![info exists STATS_TEST] } { + return +} + +switch $STATS_TEST { + pass { pass "pass test" } + fail { fail "fail test" } + xpass { xpass "xpass test" } + xfail { xfail "xfail test" } + untested { untested "untested test" } + unresolved { unresolved "unresolved test" } + unsupported { unsupported "unsupported test" } +} diff --git a/testsuite/runtest.all/stats.exp b/testsuite/runtest.all/stats.exp new file mode 100644 index 0000000..157cb27 --- /dev/null +++ b/testsuite/runtest.all/stats.exp @@ -0,0 +1,53 @@ +# Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc. + +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-dejagnu@prep.ai.mit.edu + +# This file tests pass/fail/etc. +# The way we do this is to recursively invoke ourselves on a small testsuite +# and analyze the results. + +load_lib util-defs.exp + +if ![info exists tmpdir] { + set tmpdir $objdir/tmpdir +} + +if ![file isdirectory $tmpdir] { + catch "exec mkdir $tmpdir" +} + +set tests { + { pass "expected passes\[ \t\]+1\n" } + { fail "unexpected failures\[ \t\]+1\n" } + { xpass "unexpected successes\[ \t\]+1\n" } + { xfail "expected failures\[ \t\]+1\n" } + { untested "untested testcases\[ \t\]+1\n" } + { unresolved "unresolved testcases\[ \t\]+1\n" } + { unsupported "unsupported tests\[ \t\]+1\n" } +} + +foreach t $tests { + if [util_test "$RUNTEST" \ + "--outdir $tmpdir STATS_TEST=[lindex $t 0] stats-sub.exp" \ + "" \ + [lindex $t 1]] { + fail [lindex $t 0] + } else { + pass [lindex $t 0] + } +} diff --git a/testsuite/runtest.all/target.test b/testsuite/runtest.all/target.test new file mode 100644 index 0000000..19aba4a --- /dev/null +++ b/testsuite/runtest.all/target.test @@ -0,0 +1,247 @@ +set srcdir [lindex $argv 0] +set subdir [lindex $argv 1] +set objdir [lindex $argv 2] + +if [ file exists $objdir/setval.tmp ] { + source $objdir/setval.tmp +} else { + puts "ERROR: $objdir/setval.tmp doesn't exist" +} +if [ file exists $srcdir/$subdir/default_procs.tcl ] { + source "$srcdir/$subdir/default_procs.tcl" +} else { + puts "ERROR: $srcdir/$subdir/default_procs.tcl doesn't exist" +} + +set file $srcdir/../lib/target.exp +if [ file exists $file] { + source $file +} else { + puts "ERROR: $file doesn't exist" +} +# we load framework so we can use stuff like is3way +set file $srcdir/../lib/framework.exp +if [ file exists $file] { + source $file +} else { + puts "ERROR: $file doesn't exist" +} +# we load the remote stuff so we can test execute_anywhere +set file $srcdir/../lib/remote.exp +if [ file exists $file] { + source $file +} else { + puts "ERROR: $file doesn't exist" +} + +# +# Create a false target config array +# +set target_info(idp,name) "idp" +set target_info(idp,ldflags) "-Tidp.ld" +set target_info(idp,config) m68k-unknown-aout +set target_info(idp,cflags) "" +set target_info(idp,connect) "telnet" +set target_info(idp,target) "s12" +set target_info(idp,serial) "tstty12" +set target_info(idp,netport) "localhost:23" +set target_info(idp,baud) "9600" +# MVME target +set target_info(mvme,name) "mvme" +set target_info(mvme,ldflags) "-Tmvme.ld" +set target_info(mvme,config) m68k-unknown-aout +set target_info(mvme,cflags) "" +set target_info(mvme,connect) "telnet" +set target_info(mvme,target) "s12" +set target_info(mvme,serial) "tstty8" +set target_info(mvme,netport) "localhost:23" +set target_info(mvme,baud) "9600" + +# Test remote open. We try not to use any of the support procs in +# target.exp to for isolation testing. "target" is the name of the +# default array setup by the procs in target.exp. + +set timeout 100 + +# test list_target + +if { [list_targets] == "idp mvme" } { + puts "PASSED: list_targets" +} else { + puts "FAILED: list_targets" +} +push_config target idp +set matches 0 +if { $target_info(target,name) == "idp" } { + incr matches +} +if { $target_info(target,ldflags) == "-Tidp.ld" } { + incr matches +} +if { $target_info(target,config) == "m68k-unknown-aout" } { + incr matches +} +if { $target_info(target,cflags) == "" } { + incr matches +} +if { $target_info(target,connect) == "telnet" } { + incr matches +} +if { $target_info(target,target) == "s12" } { + incr matches +} +if { $target_info(target,serial) == "tstty12" } { + incr matches +} +if { $target_info(target,netport) == "localhost:23" } { + incr matches +} +if { $target_info(target,baud) == "9600" } { + incr matches +} +if { $matches == 9 } { + puts "PASSED: push_config target" +} else { + puts "FAILED: push_config target" +} + +# test pop_config target +pop_config target +set matches 0 +if { $target_info(target,name) == "" } { + incr matches +} +if { $target_info(target,ldflags) == "" } { + incr matches +} +if { $target_info(target,config) == "" } { + incr matches +} +if { $target_info(target,cflags) == "" } { + incr matches +} +if { $target_info(target,connect) == "" } { + incr matches +} +if { $target_info(target,target) == "" } { + incr matches +} +if { $target_info(target,serial) == "" } { + incr matches +} +if { $target_info(target,netport) == "" } { + incr matches +} +if { $target_info(target,baud) == "" } { + incr matches +} +if { $matches == 9 } { + puts "PASSED: pop_config target" +} else { + puts "FAILED: pop_config target" +} + +push_config host idp +set matches 0 +if { $target_info(host,name) == "idp" } { + incr matches +} +if { $target_info(host,ldflags) == "-Tidp.ld" } { + incr matches +} +if { $target_info(host,config) == "m68k-unknown-aout" } { + incr matches +} +if { $target_info(host,cflags) == "" } { + incr matches +} +if { $target_info(host,connect) == "telnet" } { + incr matches +} +if { $target_info(host,target) == "s12" } { + incr matches +} +if { $target_info(host,serial) == "tstty12" } { + incr matches +} +if { $target_info(host,netport) == "localhost:23" } { + incr matches +} +if { $target_info(host,baud) == "9600" } { + incr matches +} +if { $matches == 9 } { + puts "PASSED: push_config target" +} else { + puts "FAILED: push_config target" +} + +# test pop_config host +pop_config host +set matches 0 +if { $target_info(host,name) == "" } { + incr matches +} +if { $target_info(host,ldflags) == "" } { + incr matches +} +if { $target_info(host,config) == "" } { + incr matches +} +if { $target_info(host,cflags) == "" } { + incr matches +} +if { $target_info(host,connect) == "" } { + incr matches +} +if { $target_info(host,target) == "" } { + incr matches +} +if { $target_info(host,serial) == "" } { + incr matches +} +if { $target_info(host,netport) == "" } { + incr matches +} +if { $target_info(host,baud) == "" } { + incr matches +} +if { $matches == 9 } { + puts "PASSED: pop_config host" +} else { + puts "FAILED: pop_config host" +} + +# test execute_anywhere for a native environment +set host_triplet i586-unknown-linux +set target_triplet i586-unknown-linux +set build_triplet i586-unknown-linux +if { [string match "*setval.tmp*" [execute_anywhere "ls"]] } { + puts "PASSED: execute_anywhere, native" +} else { + puts "FAILED: execute_anywhere, native" +} + +# test execute_anywhere for a normal cross +set target_triplet m68k-unknown-coff +if { [string match "*testsuite" [execute_anywhere "pwd"]] } { + puts "PASSED: execute_anywhere, normal cross" +} else { + puts "FAILED: execute_anywhere, normal cross" +} + +# test execute_anywhere for a canadian cross +set build_triplet m68k-test-test +set target_info(host,connect) rlogin +set target_info(host,netport) $target_info(idp,netport) +set target_info(host,target) localhost +if { [string match "*FooBar*" [execute_anywhere "echo FooBar"]] } { + puts "PASSED: execute_anywhere, canadian cross" +} else { + puts "FAILED: execute_anywhere, canadian cross" +} + +# compile arg +# archive arg +# ranlib arg +# link_objects arg diff --git a/testsuite/runtest.all/topdir/subdir1/subfile1 b/testsuite/runtest.all/topdir/subdir1/subfile1 new file mode 100644 index 0000000..8397fe3 --- /dev/null +++ b/testsuite/runtest.all/topdir/subdir1/subfile1 @@ -0,0 +1 @@ +# just so we don't look empty. diff --git a/testsuite/runtest.all/topdir/subdir1/subfile2 b/testsuite/runtest.all/topdir/subdir1/subfile2 new file mode 100644 index 0000000..7d1d836 --- /dev/null +++ b/testsuite/runtest.all/topdir/subdir1/subfile2 @@ -0,0 +1,2 @@ +# just so we don't look empty. + diff --git a/testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 b/testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 new file mode 100644 index 0000000..7d1d836 --- /dev/null +++ b/testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 @@ -0,0 +1,2 @@ +# just so we don't look empty. + diff --git a/testsuite/runtest.all/topdir/subdir2/subfile2 b/testsuite/runtest.all/topdir/subdir2/subfile2 new file mode 100644 index 0000000..7d1d836 --- /dev/null +++ b/testsuite/runtest.all/topdir/subdir2/subfile2 @@ -0,0 +1,2 @@ +# just so we don't look empty. + diff --git a/testsuite/runtest.all/utils.test b/testsuite/runtest.all/utils.test new file mode 100644 index 0000000..f9459d8 --- /dev/null +++ b/testsuite/runtest.all/utils.test @@ -0,0 +1,118 @@ +set srcdir [lindex $argv 0] +set subdir [lindex $argv 1] +set objdir [lindex $argv 2] + +if [ file exists $objdir/setval.tmp ] { + source $objdir/setval.tmp +} else { + puts "ERROR: $objdir/setval.tmp doesn't exist" +} +if [ file exists $srcdir/$subdir/default_procs.tcl ] { + source "$srcdir/$subdir/default_procs.tcl" +} else { + puts "ERROR: $srcdir$subdir/default_procs.tcl doesn't exist" +} + +set file $srcdir/../lib/utils.exp +if [ file exists $file] { + source $file +} else { + puts "ERROR: $file doesn't exist" +} + +# +# getdirs tests +# +if [lib_pat_test "getdirs" "${srcdir}/runtest.all" "runtest.all/topdir" ] { + puts "FAILED: getdirs toplevel, no arguments" +} else { + puts "PASSED: getdirs toplevel, no arguments" +} + +if [lib_pat_test "getdirs" "${srcdir}/runtest.all top*" "runtest.all/topdir" ] { + puts "FAILED: getdirs toplevel, one subdir" +} else { + puts "PASSED: getdirs toplevel, one subdir" +} + +if [lib_pat_test "getdirs" "${srcdir}/runtest.all/topdir" "subdir1*subdir2" ] { + puts "FAILED: getdirs toplevel, two subdirs" +} else { + puts "PASSED: getdirs toplevel, two subdirs" +} + +# +# find tests +# +if [string match "*/subdir2/subfile2" "[find ${srcdir}/runtest.all/topdir/subdir2 sub*]"] { + puts "PASSED: find, only one level deep" +} else { + puts "FAILED: find, only one level deep" +} + +#set path ${srcdir}/runtest.all/topdir/subdir1 +#exp_test "find ${path} sub*" "Adding */subdir1/subsubdir1/subsubfile1" "find, two levels deep" + +if [string match "*/subdir1/subsubdir1/subsubfile1" "[find ${srcdir}/runtest.all/topdir/subdir1 sub*]"] { + puts "PASSED: find, two levels deep" +} else { + puts "FAILED: find, two levels deep" +} + +# +# environment varible utility tests +# + +if [info exists env(TESTRUN)] { + unset env(TESTRUN) +} + +# test setenv +setenv TESTRUN FooBar +if [info exists env(TESTRUN)] { + if { $env(TESTRUN) == "FooBar" } { + pass "setenv, set an environment variable" + } else { + fail "setenv, set an environment variable + } +} else { + fail "setenv, set an environment variable" +} +# test getenv +if [info exists env(TESTRUN)] { + if { [getenv TESTRUN] == "FooBar" } { + pass "getenv, get an environment variable" + } else { + fail "getenv, get an environment variable" + } +} else { + untested "getenv, get an environment variable" +} + +# test unsetenv +if [info exists env(TESTRUN)] { + unsetenv TESTRUN + if [info exists env(TESTRUN)] { + fail "unsetenv, unset an environment variable" + } else { + pass "unsetenv, unset an environment variable" + } +} else { + untested "unsetenv, unset an environment variable" +} + +# which file +# grep args +# prune list pattern +# slay name +# absolute path +# psource file +# diff file_1 file_2 + + + + + + + + |