Re: relative line numbers and dg-line directive
Tom de Vries <[email protected]>
| Newsgroups | gmane.comp.sysutils.dejagnu.general |
|---|---|
| Message-ID | <[email protected]> |
On 05/24/2017 03:13 PM, Tom de Vries wrote: > On 05/24/2017 12:18 AM, Ben Elliston wrote: >> On Tue, May 23, 2017 at 03:11:28PM +0200, Tom de Vries wrote: >> >>> Is there any interest in having either or both of these concepts >>> added to dejagnu's dg.exp? >> >> Yes, patches welcome. :) >> > > I managed to: > - check out sources, > - configure and build them, and > - check and install the build. > > My next step was to see where to add a dg-error testcase, but I didn't > find a place. > > Attached is a patch that creates a standalone test-case testing dg-error > using a dummy tool. > <SNIP> > > If something like this is good to have in the dejagnu sources, I could > use some pointers on where and how to integrate this. As a first step, attached patch: - runs the testsuite with --tool dejagnu - moves the corresponding test dirs into new dir testsuite/dejagnu.dg - moves the content of config/default.exp to lib/dejagnu.dg This fixes 'WARNING: No tool specified'. make check output is: ... Done. Now run 'make install'. make unit make[1]: Entering directory '/home/vries/dejagnu/build' depbase=`echo testsuite/dejagnu.dg/libdejagnu/unit.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ g++ -DPACKAGE_NAME=\"GNU\ DejaGnu\" -DPACKAGE_TARNAME=\"dejagnu\" -DPACKAGE_VERSION=\"1.6.1-git\" -DPACKAGE_STRING=\"GNU\ DejaGnu\ 1.6.1-git\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"http://www.gnu.org/software/dejagnu/\" -DPACKAGE=\"dejagnu\" -DVERSION=\"1.6.1-git\" -I. -I../src -I../src -g -g -O2 -MT testsuite/dejagnu.dg/libdejagnu/unit.o -MD -MP -MF $depbase.Tpo -c -o testsuite/dejagnu.dg/libdejagnu/unit.o ../src/testsuite/dejagnu.dg/libdejagnu/unit.cc &&\ mv -f $depbase.Tpo $depbase.Po g++ -I../src -g -g -O2 -o unit testsuite/dejagnu.dg/libdejagnu/unit.o make[1]: Leaving directory '/home/vries/dejagnu/build' make check-DEJAGNU make[1]: Entering directory '/home/vries/dejagnu/build' Making a new site.exp file ... srcdir='../src'; export srcdir; \ EXPECT=/usr/bin/expect; export EXPECT; \ if /bin/bash -c "../src/runtest --version" > /dev/null 2>&1; then \ exit_status=0; l='dejagnu'; for tool in $l; do \ if ../src/runtest --tool $tool --srcdir ../src/testsuite RUNTEST=../src/runtest ; \ then :; else exit_status=1; fi; \ done; \ else echo "WARNING: could not find '../src/runtest'" 1>&2; :;\ fi; \ exit $exit_status Test run by vries on Mon May 29 08:47:12 2017 Native configuration is x86_64-pc-linux-gnu === dejagnu tests === Schedule of variations: unix Running target unix Using ../src/testsuite/config/default.exp as tool-and-target-specific interface file. Running ../src/testsuite/dejagnu.dg/libdejagnu/tunit.exp ... Running ../src/testsuite/dejagnu.dg/runtest.all/libs.exp ... Running ../src/testsuite/dejagnu.dg/runtest.all/load_lib.exp ... Running ../src/testsuite/dejagnu.dg/runtest.all/options.exp ... Running ../src/testsuite/dejagnu.dg/runtest.all/stats-sub.exp ... Running ../src/testsuite/dejagnu.dg/runtest.all/stats.exp ... === dejagnu Summary === # of expected passes 77 make[1]: Leaving directory '/home/vries/dejagnu/build' ... Thanks, - Tom _______________________________________________ DejaGnu mailing list [email protected] https://lists.gnu.org/mailman/listinfo/dejagnu
0001-Fix-WARNING-No-tool-specified.patch
(text/x-patch, 95.5 KB)
Fix 'WARNING: No tool specified' 2017-05-29 Tom de Vries <[email protected]> * testsuite/config/default.exp: Move contents ... * testsuite/lib/dejagnu.exp: ... here. New file. * testsuite/libdejagnu: Move this dir ... * testsuite/runtest.all: and this dir ... * testsuite/dejagnu.dg: ... here. * testsuite/runtest.all/options.exp: Update runtest.all location. * testsuite/runtest.all/utils.test: Same. * Makefile.am (RUNTESTDEFAULTFLAGS): Add tool. (TESTSUITE_FILES): Update runtest.all and libdejagnu location. (unit_SOURCES): Update libdejagnu location. * Makefile.in: Regenerate. --- Makefile.am | 36 +-- Makefile.in | 68 +++--- testsuite/config/default.exp | 78 ------- testsuite/dejagnu.dg/libdejagnu/tunit.exp | 24 ++ testsuite/dejagnu.dg/libdejagnu/unit.cc | 139 ++++++++++++ testsuite/dejagnu.dg/runtest.all/clone_output.test | 68 ++++++ testsuite/dejagnu.dg/runtest.all/config.test | 138 ++++++++++++ testsuite/dejagnu.dg/runtest.all/default_procs.tcl | 94 ++++++++ testsuite/dejagnu.dg/runtest.all/libs.exp | 88 ++++++++ testsuite/dejagnu.dg/runtest.all/load_lib.exp | 45 ++++ testsuite/dejagnu.dg/runtest.all/options.exp | 87 ++++++++ testsuite/dejagnu.dg/runtest.all/remote.test | 217 ++++++++++++++++++ testsuite/dejagnu.dg/runtest.all/stats-sub.exp | 36 +++ testsuite/dejagnu.dg/runtest.all/stats.exp | 56 +++++ testsuite/dejagnu.dg/runtest.all/target.test | 247 +++++++++++++++++++++ .../dejagnu.dg/runtest.all/topdir/subdir1/subfile1 | 1 + .../dejagnu.dg/runtest.all/topdir/subdir1/subfile2 | 2 + .../topdir/subdir1/subsubdir1/subsubfile1 | 2 + .../dejagnu.dg/runtest.all/topdir/subdir2/subfile2 | 2 + testsuite/dejagnu.dg/runtest.all/utils.test | 117 ++++++++++ testsuite/lib/dejagnu.exp | 78 +++++++ testsuite/libdejagnu/tunit.exp | 24 -- testsuite/libdejagnu/unit.cc | 139 ------------ testsuite/runtest.all/clone_output.test | 68 ------ testsuite/runtest.all/config.test | 138 ------------ testsuite/runtest.all/default_procs.tcl | 94 -------- testsuite/runtest.all/libs.exp | 88 -------- testsuite/runtest.all/load_lib.exp | 45 ---- testsuite/runtest.all/options.exp | 87 -------- testsuite/runtest.all/remote.test | 217 ------------------ testsuite/runtest.all/stats-sub.exp | 36 --- testsuite/runtest.all/stats.exp | 56 ----- testsuite/runtest.all/target.test | 247 --------------------- testsuite/runtest.all/topdir/subdir1/subfile1 | 1 - testsuite/runtest.all/topdir/subdir1/subfile2 | 2 - .../topdir/subdir1/subsubdir1/subsubfile1 | 2 - testsuite/runtest.all/topdir/subdir2/subfile2 | 2 - testsuite/runtest.all/utils.test | 117 ---------- 38 files changed, 1493 insertions(+), 1493 deletions(-) diff --git a/Makefile.am b/Makefile.am index bd0ac0e..89ea2e6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -142,32 +142,32 @@ CONTRIB = contrib/compare_tests contrib/sum2junit.sh \ # Testsuite. TESTSUITE_FILES = \ - testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 \ - testsuite/runtest.all/topdir/subdir1/subfile1 \ - testsuite/runtest.all/topdir/subdir1/subfile2 \ - testsuite/runtest.all/topdir/subdir2/subfile2 \ - testsuite/runtest.all/libs.exp \ - testsuite/runtest.all/options.exp \ - testsuite/runtest.all/remote.test \ - testsuite/runtest.all/stats-sub.exp \ - testsuite/runtest.all/stats.exp \ - testsuite/runtest.all/target.test \ - testsuite/runtest.all/utils.test \ - testsuite/runtest.all/clone_output.test \ - testsuite/runtest.all/config.test \ - testsuite/runtest.all/default_procs.tcl \ - testsuite/runtest.all/load_lib.exp \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile1 \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile2 \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir2/subfile2 \ + testsuite/dejagnu.dg/runtest.all/libs.exp \ + testsuite/dejagnu.dg/runtest.all/options.exp \ + testsuite/dejagnu.dg/runtest.all/remote.test \ + testsuite/dejagnu.dg/runtest.all/stats-sub.exp \ + testsuite/dejagnu.dg/runtest.all/stats.exp \ + testsuite/dejagnu.dg/runtest.all/target.test \ + testsuite/dejagnu.dg/runtest.all/utils.test \ + testsuite/dejagnu.dg/runtest.all/clone_output.test \ + testsuite/dejagnu.dg/runtest.all/config.test \ + testsuite/dejagnu.dg/runtest.all/default_procs.tcl \ + testsuite/dejagnu.dg/runtest.all/load_lib.exp \ testsuite/config/default.exp \ testsuite/lib/libsup.exp \ testsuite/lib/util-defs.exp \ - testsuite/libdejagnu/tunit.exp + testsuite/dejagnu.dg/libdejagnu/tunit.exp RUNTEST = ${top_srcdir}/runtest -RUNTESTDEFAULTFLAGS = --srcdir $(srcdir)/testsuite RUNTEST=$(RUNTEST) +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $(srcdir)/testsuite RUNTEST=$(RUNTEST) AM_CXXFLAGS = -I$(top_srcdir) -g check_PROGRAMS = unit -unit_SOURCES = testsuite/libdejagnu/unit.cc +unit_SOURCES = testsuite/dejagnu.dg/libdejagnu/unit.cc # Documentation. diff --git a/Makefile.in b/Makefile.in index 73d9c2f..854f516 100644 --- a/Makefile.in +++ b/Makefile.in @@ -122,7 +122,7 @@ mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__dirstamp = $(am__leading_dot)dirstamp -am_unit_OBJECTS = testsuite/libdejagnu/unit.$(OBJEXT) +am_unit_OBJECTS = testsuite/dejagnu.dg/libdejagnu/unit.$(OBJEXT) unit_OBJECTS = $(am_unit_OBJECTS) unit_LDADD = $(LDADD) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -488,30 +488,30 @@ CONTRIB = contrib/compare_tests contrib/sum2junit.sh \ # Testsuite. TESTSUITE_FILES = \ - testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 \ - testsuite/runtest.all/topdir/subdir1/subfile1 \ - testsuite/runtest.all/topdir/subdir1/subfile2 \ - testsuite/runtest.all/topdir/subdir2/subfile2 \ - testsuite/runtest.all/libs.exp \ - testsuite/runtest.all/options.exp \ - testsuite/runtest.all/remote.test \ - testsuite/runtest.all/stats-sub.exp \ - testsuite/runtest.all/stats.exp \ - testsuite/runtest.all/target.test \ - testsuite/runtest.all/utils.test \ - testsuite/runtest.all/clone_output.test \ - testsuite/runtest.all/config.test \ - testsuite/runtest.all/default_procs.tcl \ - testsuite/runtest.all/load_lib.exp \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile1 \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile2 \ + testsuite/dejagnu.dg/runtest.all/topdir/subdir2/subfile2 \ + testsuite/dejagnu.dg/runtest.all/libs.exp \ + testsuite/dejagnu.dg/runtest.all/options.exp \ + testsuite/dejagnu.dg/runtest.all/remote.test \ + testsuite/dejagnu.dg/runtest.all/stats-sub.exp \ + testsuite/dejagnu.dg/runtest.all/stats.exp \ + testsuite/dejagnu.dg/runtest.all/target.test \ + testsuite/dejagnu.dg/runtest.all/utils.test \ + testsuite/dejagnu.dg/runtest.all/clone_output.test \ + testsuite/dejagnu.dg/runtest.all/config.test \ + testsuite/dejagnu.dg/runtest.all/default_procs.tcl \ + testsuite/dejagnu.dg/runtest.all/load_lib.exp \ testsuite/config/default.exp \ testsuite/lib/libsup.exp \ testsuite/lib/util-defs.exp \ - testsuite/libdejagnu/tunit.exp + testsuite/dejagnu.dg/libdejagnu/tunit.exp RUNTEST = ${top_srcdir}/runtest -RUNTESTDEFAULTFLAGS = --srcdir $(srcdir)/testsuite RUNTEST=$(RUNTEST) +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $(srcdir)/testsuite RUNTEST=$(RUNTEST) AM_CXXFLAGS = -I$(top_srcdir) -g -unit_SOURCES = testsuite/libdejagnu/unit.cc +unit_SOURCES = testsuite/dejagnu.dg/libdejagnu/unit.cc # Documentation. dist_man_MANS = doc/runtest.1 @@ -556,15 +556,15 @@ $(am__aclocal_m4_deps): clean-checkPROGRAMS: -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) -testsuite/libdejagnu/$(am__dirstamp): - @$(MKDIR_P) testsuite/libdejagnu - @: > testsuite/libdejagnu/$(am__dirstamp) -testsuite/libdejagnu/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) testsuite/libdejagnu/$(DEPDIR) - @: > testsuite/libdejagnu/$(DEPDIR)/$(am__dirstamp) -testsuite/libdejagnu/unit.$(OBJEXT): \ - testsuite/libdejagnu/$(am__dirstamp) \ - testsuite/libdejagnu/$(DEPDIR)/$(am__dirstamp) +testsuite/dejagnu.dg/libdejagnu/$(am__dirstamp): + @$(MKDIR_P) testsuite/dejagnu.dg/libdejagnu + @: > testsuite/dejagnu.dg/libdejagnu/$(am__dirstamp) +testsuite/dejagnu.dg/libdejagnu/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) testsuite/dejagnu.dg/libdejagnu/$(DEPDIR) + @: > testsuite/dejagnu.dg/libdejagnu/$(DEPDIR)/$(am__dirstamp) +testsuite/dejagnu.dg/libdejagnu/unit.$(OBJEXT): \ + testsuite/dejagnu.dg/libdejagnu/$(am__dirstamp) \ + testsuite/dejagnu.dg/libdejagnu/$(DEPDIR)/$(am__dirstamp) unit$(EXEEXT): $(unit_OBJECTS) $(unit_DEPENDENCIES) $(EXTRA_unit_DEPENDENCIES) @rm -f unit$(EXEEXT) @@ -642,12 +642,12 @@ uninstall-djlibexecSCRIPTS: mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f testsuite/libdejagnu/*.$(OBJEXT) + -rm -f testsuite/dejagnu.dg/libdejagnu/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@testsuite/libdejagnu/$(DEPDIR)/unit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@testsuite/dejagnu.dg/libdejagnu/$(DEPDIR)/unit.Po@am__quote@ .cc.o: @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -1232,8 +1232,8 @@ distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f doc/$(am__dirstamp) - -rm -f testsuite/libdejagnu/$(DEPDIR)/$(am__dirstamp) - -rm -f testsuite/libdejagnu/$(am__dirstamp) + -rm -f testsuite/dejagnu.dg/libdejagnu/$(DEPDIR)/$(am__dirstamp) + -rm -f testsuite/dejagnu.dg/libdejagnu/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @@ -1246,7 +1246,7 @@ clean-am: clean-aminfo clean-checkPROGRAMS clean-generic \ distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf testsuite/libdejagnu/$(DEPDIR) + -rm -rf testsuite/dejagnu.dg/libdejagnu/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-DEJAGNU distclean-compile \ distclean-generic distclean-tags @@ -1387,7 +1387,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf testsuite/libdejagnu/$(DEPDIR) + -rm -rf testsuite/dejagnu.dg/libdejagnu/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-aminfo \ maintainer-clean-generic diff --git a/testsuite/config/default.exp b/testsuite/config/default.exp index 86d2b5e..e69de29 100644 --- a/testsuite/config/default.exp +++ b/testsuite/config/default.exp @@ -1,78 +0,0 @@ -# Copyright (C) 1992-2016 Free Software Foundation, Inc. -# -# This file is part of DejaGnu. -# -# DejaGnu 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 3 of the License, or -# (at your option) any later version. -# -# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -# This file was written by Rob Savoye <[email protected]>. - -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/dejagnu.dg/libdejagnu/tunit.exp b/testsuite/dejagnu.dg/libdejagnu/tunit.exp new file mode 100644 index 0000000..8b66b0a --- /dev/null +++ b/testsuite/dejagnu.dg/libdejagnu/tunit.exp @@ -0,0 +1,24 @@ +# Copyright (C) 1992-2016 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu 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 3 of the License, or +# (at your option) any later version. +# +# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +load_lib "dejagnu.exp" + +# Execute the test case, and analyse the output +if { [host_execute "unit"] != "" } { + perror "unit had an execution error" 0 +} diff --git a/testsuite/dejagnu.dg/libdejagnu/unit.cc b/testsuite/dejagnu.dg/libdejagnu/unit.cc new file mode 100644 index 0000000..92e1b7e --- /dev/null +++ b/testsuite/dejagnu.dg/libdejagnu/unit.cc @@ -0,0 +1,139 @@ +// unit.cc -- This is a test case for the dejagnu.h classes. +// Copyright (C) 2001-2016 Free Software Foundation, Inc. + +// This file is part of DejaGnu. + +// DejaGnu 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 3 of the License, or +// (at your option) any later version. + +// DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +#include <sys/types.h> +#include <iostream> +#include <regex.h> +#include <string> +#include <fstream> +#include <sstream> +#include <set> +#include <dejagnu.h> + +using namespace std; + +TestState runtest; +TestState test; + +class TestClass1 +{ +public: + string tname; + unsigned int tnum; +}; + +TestClass1 testClass1, testClass2, testClass3; +TestClass1 *testClassPtr; + +// We have to do this silly crap with renaming the output string, so +// the generic Tcl code that looks for the output state gets confused, +// and records random duplicate messages. +const char *os1[] = { + "FAI: ", "PAS: ", "UNT: ", "UNR: " +}; + +const char *os2[] = { + "FAILED: ", "PASSED: ", "UNTESTED: ", "UNRESOLVED: " +}; + +int +main (int argc, char *argv[]) +{ + regex_t regex_pat; + outstate = os1; + stringstream strbuf; + streambuf *pbuf; + + // Replace the output buffer for cout, so we can examine it to see + // what was displayed. Otherwise, there is no way we can test the + // logging functions completely. + pbuf = cout.rdbuf (); + + testClass1.tname = "testType1"; + testClass1.tnum = 1; + testClass2.tname = "testType2"; + testClass2.tnum = 2; + testClass3.tname = "testType3"; + testClass3.tnum = 3; + + // Test the pass message. + cout.rdbuf (strbuf.rdbuf ()); + strbuf.str (""); + test.pass ("bogus pass message for testing"); + outstate = os2; + cout.rdbuf (pbuf); + if (strncmp (strbuf.str().c_str(), "\tPAS: bogus pass message", 22) == 0) + runtest.pass ("Pass message"); + else + runtest.fail ("Pass message"); + + // Test the fail message. + cout.rdbuf (strbuf.rdbuf ()); + strbuf.str (""); + outstate = os1; + test.fail ("bogus fail message for testing"); + cout.rdbuf (pbuf); + outstate = os2; + if (strncmp (strbuf.str().c_str(), "\tFAI: bogus fail message", 22) == 0) + runtest.pass ("Fail message"); + else + runtest.fail ("Fail message"); + + // Test the untested message. + cout.rdbuf (strbuf.rdbuf ()); + strbuf.str (""); + outstate = os1; + test.untested ("bogus untested message for testing"); + cout.rdbuf (pbuf); + outstate = os2; + if (strncmp (strbuf.str().c_str(), "\tUNT: bogus untested message", 21) == 0) { + runtest.pass ("Untested message"); + } else { + runtest.fail ("Untested message"); + } + + // Test the unresolved message. + cout.rdbuf (strbuf.rdbuf ()); + strbuf.str (""); + outstate = os1; + test.unresolved ("bogus unresolved message for testing"); + cout.rdbuf (pbuf); + outstate = os2; + if (strncmp (strbuf.str().c_str(), "\tUNR: bogus unresolved message", 21) == 0) + runtest.pass ("Unresolved message"); + else + runtest.fail ("Unresolved message"); + + // Make sure we got everything in the totals. + cout.rdbuf (strbuf.rdbuf ()); + strbuf.str (""); + regcomp (®ex_pat, + "\t#passed.*#real failed.*#untested.*#unresolved", + REG_NOSUB); + + test.totals (); + cout.rdbuf (pbuf); + if (regexec (®ex_pat, strbuf.str().c_str(), 0, (regmatch_t *) 0, 0) == 0) + runtest.pass ("Totals message"); + else + runtest.fail ("Totals message"); + + return 0; +} + diff --git a/testsuite/dejagnu.dg/runtest.all/clone_output.test b/testsuite/dejagnu.dg/runtest.all/clone_output.test new file mode 100644 index 0000000..e1d1cd2 --- /dev/null +++ b/testsuite/dejagnu.dg/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/dejagnu.dg/runtest.all/config.test b/testsuite/dejagnu.dg/runtest.all/config.test new file mode 100644 index 0000000..50c701e --- /dev/null +++ b/testsuite/dejagnu.dg/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/dejagnu.dg/runtest.all/default_procs.tcl b/testsuite/dejagnu.dg/runtest.all/default_procs.tcl new file mode 100644 index 0000000..ae85bef --- /dev/null +++ b/testsuite/dejagnu.dg/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 { args } { + # 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/dejagnu.dg/runtest.all/libs.exp b/testsuite/dejagnu.dg/runtest.all/libs.exp new file mode 100644 index 0000000..7520e12 --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/libs.exp @@ -0,0 +1,88 @@ +# Copyright (C) 1997-2016 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu 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 3 of the License, or +# (at your option) any later version. +# +# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +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 +} + +# Clean up behind ourselves. +file delete .tmp [pwd]/setval.tmp diff --git a/testsuite/dejagnu.dg/runtest.all/load_lib.exp b/testsuite/dejagnu.dg/runtest.all/load_lib.exp new file mode 100644 index 0000000..315272b --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/load_lib.exp @@ -0,0 +1,45 @@ +# test load_lib + +# Verify that load_lib searches for a lib not only in its default +# search_dirs but also in the libdirs list of directories. + +# load_lib f exits with a failure if it does not find f. +# Arrange for the testcase to handle this: +rename exit saved_exit +proc exit { args } { return [lindex $args 0] } + +# The test right below is supposed to fail. +# Prettify default output by only printing the message in verbose mode. +rename send_error saved_send_error +proc send_error { args } { + verbose [lindex $args 0] 2 +} + +if { [ load_lib "subfile1" ] != 1} { + fail "load_lib subfile1 found per default" +} else { + pass "load_lib subfile1 not found per default" +} + +rename send_error "" +rename saved_send_error send_error + +set extradir [file join $srcdir $subdir "topdir" "subdir1" ] +global libdirs +lappend libdirs $extradir +verbose "now added libdirs: $libdirs" 2 + +# In this testcase, we did not exit 1 from load_lib as per above +# rename. subfile1 thus is in the loaded_libs LUT and we won't walk +# the search_dirs again. Use another file for testing the lappend +# worked. + +if { [load_lib "subfile2"] == ""} { + pass "load_lib subfile2 loaded" +} else { + fail "load_lib subfile2 not found" +} + +# cleanup after us +rename exit "" +rename saved_exit exit diff --git a/testsuite/dejagnu.dg/runtest.all/options.exp b/testsuite/dejagnu.dg/runtest.all/options.exp new file mode 100644 index 0000000..a6eeb3e --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/options.exp @@ -0,0 +1,87 @@ +# Copyright (C) 1992-2016 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu 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 3 of the License, or +# (at your option) any later version. +# +# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# This file was written by Rob Savoye <[email protected]>. + +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 { + { "-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 --target m68k-vxworks" "Target is m68k-vxworks" "--target option" } + { "-v --target_board flash" "Running target flash" "--target_board 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 --all" "Print all test output to screen" "--all option" } + { "-v --ignore foo.exp" "Ignoring test foo.exp" "--ignore 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 --reboot" "Will reboot the target" "--reboot option" } + { "-v --strace 1" "Source Trace level is now 1.* 1 if" "--strace option" } + { "-v --D0" "Tcl debugger is ON" "--D0 option" } + { "-V" "DejaGnu version.*Expect version.*Tcl version.*" "-V option" } + { "--version" "DejaGnu version.*Expect version.*Tcl version.*" "--version option" } + { "-v --xml" "XML logging turned on" "--xml option" } +} + +foreach t $tests { + if [util_test "$RUNTEST" "[lindex $t 0] -srcdir ${srcdir}/dejagnu.dg/runtest.all" "" "[lindex $t 1]"] { + fail "[lindex $t 2]" + } else { + pass "[lindex $t 2]" + } +} + + +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 + +# clean up log files left by the child runtest +foreach f [concat [glob $objdir/x.*] [glob $objdir/xXx.*]] { + file delete $f +} +file delete dbg.log diff --git a/testsuite/dejagnu.dg/runtest.all/remote.test b/testsuite/dejagnu.dg/runtest.all/remote.test new file mode 100644 index 0000000..23888c6 --- /dev/null +++ b/testsuite/dejagnu.dg/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/dejagnu.dg/runtest.all/stats-sub.exp b/testsuite/dejagnu.dg/runtest.all/stats-sub.exp new file mode 100644 index 0000000..c797ad1 --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/stats-sub.exp @@ -0,0 +1,36 @@ +# Copyright (C) 1997-2016 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu 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 3 of the License, or +# (at your option) any later version. +# +# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# 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" } + kpass { kpass "somebug" "kpass test" } + kfail { kfail "somebug" "kfail test" } + untested { untested "untested test" } + unresolved { unresolved "unresolved test" } + unsupported { unsupported "unsupported test" } +} diff --git a/testsuite/dejagnu.dg/runtest.all/stats.exp b/testsuite/dejagnu.dg/runtest.all/stats.exp new file mode 100644 index 0000000..1445b2f --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/stats.exp @@ -0,0 +1,56 @@ +# Copyright (C) 1995-2016 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu 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 3 of the License, or +# (at your option) any later version. +# +# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# 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 "file 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" } + { kpass "unknown successes\[ \t\]+1\n" } + { kfail "known 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] + } +} + +file delete -force $tmpdir diff --git a/testsuite/dejagnu.dg/runtest.all/target.test b/testsuite/dejagnu.dg/runtest.all/target.test new file mode 100644 index 0000000..6826b26 --- /dev/null +++ b/testsuite/dejagnu.dg/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/dejagnu.dg/runtest.all/topdir/subdir1/subfile1 b/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile1 new file mode 100644 index 0000000..8397fe3 --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile1 @@ -0,0 +1 @@ +# just so we don't look empty. diff --git a/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile2 b/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile2 new file mode 100644 index 0000000..7d1d836 --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subfile2 @@ -0,0 +1,2 @@ +# just so we don't look empty. + diff --git a/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 b/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 new file mode 100644 index 0000000..7d1d836 --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 @@ -0,0 +1,2 @@ +# just so we don't look empty. + diff --git a/testsuite/dejagnu.dg/runtest.all/topdir/subdir2/subfile2 b/testsuite/dejagnu.dg/runtest.all/topdir/subdir2/subfile2 new file mode 100644 index 0000000..7d1d836 --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/topdir/subdir2/subfile2 @@ -0,0 +1,2 @@ +# just so we don't look empty. + diff --git a/testsuite/dejagnu.dg/runtest.all/utils.test b/testsuite/dejagnu.dg/runtest.all/utils.test new file mode 100644 index 0000000..90591af --- /dev/null +++ b/testsuite/dejagnu.dg/runtest.all/utils.test @@ -0,0 +1,117 @@ +# Test procedures in lib/utils.exp. + +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" +} + +# Test getdirs: +# +if [lib_pat_test "getdirs" "${srcdir}/dejagnu.dg/runtest.all" "runtest.all/topdir" ] { + puts "FAILED: getdirs toplevel, no arguments" +} else { + puts "PASSED: getdirs toplevel, no arguments" +} + +if [lib_pat_test "getdirs" "${srcdir}/dejagnu.dg/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}/dejagnu.dg/runtest.all/topdir" "subdir1*subdir2" ] { + puts "FAILED: getdirs toplevel, two subdirs" +} else { + puts "PASSED: getdirs toplevel, two subdirs" +} + +# Test find: +# +if [string match "*/subdir2/subfile2" "[find ${srcdir}/dejagnu.dg/runtest.all/topdir/subdir2 sub*]"] { + puts "PASSED: find, only one level deep" +} else { + puts "FAILED: find, only one level deep" +} + +if [regexp ".*/subdir1/subsubdir1/subsubfile1( |$)" "[find ${srcdir}/dejagnu.dg/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 'which' using a relative path. +# +if {[which ./config.status] != 0} { + pass "which, relative path to config.status" +} else { + fail "which, relative path to config.status" +} + +# Test 'which' using an absolute path. +# +if {[which [file join $objdir config.status]] != 0} { + pass "which, absolute path to config.status" +} else { + fail "which, absolute path to config.status" +} + +# Test 'which make'. +# +if {[which make] != 0} { + pass "which, make" +} else { + pass "which, make" +} + +# grep args +# diff file_1 file_2 +# runtest_file_p diff --git a/testsuite/lib/dejagnu.exp b/testsuite/lib/dejagnu.exp new file mode 100644 index 0000000..86d2b5e --- /dev/null +++ b/testsuite/lib/dejagnu.exp @@ -0,0 +1,78 @@ +# Copyright (C) 1992-2016 Free Software Foundation, Inc. +# +# This file is part of DejaGnu. +# +# DejaGnu 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 3 of the License, or +# (at your option) any later version. +# +# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + +# This file was written by Rob Savoye <[email protected]>. + +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/libdejagnu/tunit.exp b/testsuite/libdejagnu/tunit.exp deleted file mode 100644 index 8b66b0a..0000000 --- a/testsuite/libdejagnu/tunit.exp +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 1992-2016 Free Software Foundation, Inc. -# -# This file is part of DejaGnu. -# -# DejaGnu 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 3 of the License, or -# (at your option) any later version. -# -# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -load_lib "dejagnu.exp" - -# Execute the test case, and analyse the output -if { [host_execute "unit"] != "" } { - perror "unit had an execution error" 0 -} diff --git a/testsuite/libdejagnu/unit.cc b/testsuite/libdejagnu/unit.cc deleted file mode 100644 index 6eb9067..0000000 --- a/testsuite/libdejagnu/unit.cc +++ /dev/null @@ -1,139 +0,0 @@ -// unit.cc -- This is a test case for the dejagnu.h classes. -// Copyright (C) 2001-2016 Free Software Foundation, Inc. - -// This file is part of DejaGnu. - -// DejaGnu 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 3 of the License, or -// (at your option) any later version. - -// DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -#include <sys/types.h> -#include <iostream> -#include <regex.h> -#include <string> -#include <fstream> -#include <sstream> -#include <set> -#include <dejagnu.h> - -using namespace std; - -TestState runtest; -TestState test; - -class TestClass1 -{ -public: - string tname; - unsigned int tnum; -}; - -TestClass1 testClass1, testClass2, testClass3; -TestClass1 *testClassPtr; - -// We have to do this silly crap with renaming the output string, so -// the generic Tcl code that looks for the output state gets confused, -// and records random duplicate messages. -const char *os1[] = { - "FAI: ", "PAS: ", "UNT: ", "UNR: " -}; - -const char *os2[] = { - "FAILED: ", "PASSED: ", "UNTESTED: ", "UNRESOLVED: " -}; - -int -main (int argc, char *argv[]) -{ - regex_t regex_pat; - outstate = os1; - stringstream strbuf; - streambuf *pbuf; - - // Replace the output buffer for cout, so we can examine it to see - // what was displayed. Otherwise, there is no way we can test the - // logging functions completely. - pbuf = cout.rdbuf (); - - testClass1.tname = "testType1"; - testClass1.tnum = 1; - testClass2.tname = "testType2"; - testClass2.tnum = 2; - testClass3.tname = "testType3"; - testClass3.tnum = 3; - - // Test the pass message. - cout.rdbuf (strbuf.rdbuf ()); - strbuf.str (""); - test.pass ("bogus pass message for testing"); - outstate = os2; - cout.rdbuf (pbuf); - if (strncmp (strbuf.str().c_str(), "\tPAS: bogus pass message", 22) == 0) - runtest.pass ("Pass message"); - else - runtest.fail ("Pass message"); - - // Test the fail message. - cout.rdbuf (strbuf.rdbuf ()); - strbuf.str (""); - outstate = os1; - test.fail ("bogus fail message for testing"); - cout.rdbuf (pbuf); - outstate = os2; - if (strncmp (strbuf.str().c_str(), "\tFAI: bogus fail message", 22) == 0) - runtest.pass ("Fail message"); - else - runtest.fail ("Fail message"); - - // Test the untested message. - cout.rdbuf (strbuf.rdbuf ()); - strbuf.str (""); - outstate = os1; - test.untested ("bogus untested message for testing"); - cout.rdbuf (pbuf); - outstate = os2; - if (strncmp (strbuf.str().c_str(), "\tUNT: bogus untested message", 21) == 0) { - runtest.pass ("Untested message"); - } else { - runtest.fail ("Untested message"); - } - - // Test the unresolved message. - cout.rdbuf (strbuf.rdbuf ()); - strbuf.str (""); - outstate = os1; - test.unresolved ("bogus unresolved message for testing"); - cout.rdbuf (pbuf); - outstate = os2; - if (strncmp (strbuf.str().c_str(), "\tUNR: bogus unresolved message", 21) == 0) - runtest.pass ("Unresolved message"); - else - runtest.fail ("Unresolved message"); - - // Make sure we got everything in the totals. - cout.rdbuf (strbuf.rdbuf ()); - strbuf.str (""); - regcomp (®ex_pat, - "\t#passed.*#real failed.*#untested.*#unresolved", - REG_NOSUB); - - test.totals (); - cout.rdbuf (pbuf); - if (regexec (®ex_pat, strbuf.str().c_str(), 0, (regmatch_t *) 0, 0) == 0) - runtest.pass ("Totals message"); - else - runtest.fail ("Totals message"); - - return 0; -} - diff --git a/testsuite/runtest.all/clone_output.test b/testsuite/runtest.all/clone_output.test deleted file mode 100644 index e1d1cd2..0000000 --- a/testsuite/runtest.all/clone_output.test +++ /dev/null @@ -1,68 +0,0 @@ -# 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 deleted file mode 100644 index 50c701e..0000000 --- a/testsuite/runtest.all/config.test +++ /dev/null @@ -1,138 +0,0 @@ -# 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 deleted file mode 100644 index c3358b3..0000000 --- a/testsuite/runtest.all/default_procs.tcl +++ /dev/null @@ -1,94 +0,0 @@ -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 { args } { - # 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 deleted file mode 100644 index 7520e12..0000000 --- a/testsuite/runtest.all/libs.exp +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (C) 1997-2016 Free Software Foundation, Inc. -# -# This file is part of DejaGnu. -# -# DejaGnu 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 3 of the License, or -# (at your option) any later version. -# -# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -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 -} - -# Clean up behind ourselves. -file delete .tmp [pwd]/setval.tmp diff --git a/testsuite/runtest.all/load_lib.exp b/testsuite/runtest.all/load_lib.exp deleted file mode 100644 index 315272b..0000000 --- a/testsuite/runtest.all/load_lib.exp +++ /dev/null @@ -1,45 +0,0 @@ -# test load_lib - -# Verify that load_lib searches for a lib not only in its default -# search_dirs but also in the libdirs list of directories. - -# load_lib f exits with a failure if it does not find f. -# Arrange for the testcase to handle this: -rename exit saved_exit -proc exit { args } { return [lindex $args 0] } - -# The test right below is supposed to fail. -# Prettify default output by only printing the message in verbose mode. -rename send_error saved_send_error -proc send_error { args } { - verbose [lindex $args 0] 2 -} - -if { [ load_lib "subfile1" ] != 1} { - fail "load_lib subfile1 found per default" -} else { - pass "load_lib subfile1 not found per default" -} - -rename send_error "" -rename saved_send_error send_error - -set extradir [file join $srcdir $subdir "topdir" "subdir1" ] -global libdirs -lappend libdirs $extradir -verbose "now added libdirs: $libdirs" 2 - -# In this testcase, we did not exit 1 from load_lib as per above -# rename. subfile1 thus is in the loaded_libs LUT and we won't walk -# the search_dirs again. Use another file for testing the lappend -# worked. - -if { [load_lib "subfile2"] == ""} { - pass "load_lib subfile2 loaded" -} else { - fail "load_lib subfile2 not found" -} - -# cleanup after us -rename exit "" -rename saved_exit exit diff --git a/testsuite/runtest.all/options.exp b/testsuite/runtest.all/options.exp deleted file mode 100644 index 53621a9..0000000 --- a/testsuite/runtest.all/options.exp +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 1992-2016 Free Software Foundation, Inc. -# -# This file is part of DejaGnu. -# -# DejaGnu 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 3 of the License, or -# (at your option) any later version. -# -# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -# This file was written by Rob Savoye <[email protected]>. - -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 { - { "-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 --target m68k-vxworks" "Target is m68k-vxworks" "--target option" } - { "-v --target_board flash" "Running target flash" "--target_board 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 --all" "Print all test output to screen" "--all option" } - { "-v --ignore foo.exp" "Ignoring test foo.exp" "--ignore 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 --reboot" "Will reboot the target" "--reboot option" } - { "-v --strace 1" "Source Trace level is now 1.* 1 if" "--strace option" } - { "-v --D0" "Tcl debugger is ON" "--D0 option" } - { "-V" "DejaGnu version.*Expect version.*Tcl version.*" "-V option" } - { "--version" "DejaGnu version.*Expect version.*Tcl version.*" "--version option" } - { "-v --xml" "XML logging turned on" "--xml option" } -} - -foreach t $tests { - if [util_test "$RUNTEST" "[lindex $t 0] -srcdir ${srcdir}/runtest.all" "" "[lindex $t 1]"] { - fail "[lindex $t 2]" - } else { - pass "[lindex $t 2]" - } -} - - -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 - -# clean up log files left by the child runtest -foreach f [concat [glob $objdir/x.*] [glob $objdir/xXx.*]] { - file delete $f -} -file delete dbg.log diff --git a/testsuite/runtest.all/remote.test b/testsuite/runtest.all/remote.test deleted file mode 100644 index 23888c6..0000000 --- a/testsuite/runtest.all/remote.test +++ /dev/null @@ -1,217 +0,0 @@ -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 deleted file mode 100644 index c797ad1..0000000 --- a/testsuite/runtest.all/stats-sub.exp +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 1997-2016 Free Software Foundation, Inc. -# -# This file is part of DejaGnu. -# -# DejaGnu 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 3 of the License, or -# (at your option) any later version. -# -# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -# 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" } - kpass { kpass "somebug" "kpass test" } - kfail { kfail "somebug" "kfail 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 deleted file mode 100644 index 1445b2f..0000000 --- a/testsuite/runtest.all/stats.exp +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 1995-2016 Free Software Foundation, Inc. -# -# This file is part of DejaGnu. -# -# DejaGnu 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 3 of the License, or -# (at your option) any later version. -# -# DejaGnu 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 DejaGnu; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - -# 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 "file 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" } - { kpass "unknown successes\[ \t\]+1\n" } - { kfail "known 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] - } -} - -file delete -force $tmpdir diff --git a/testsuite/runtest.all/target.test b/testsuite/runtest.all/target.test deleted file mode 100644 index 6826b26..0000000 --- a/testsuite/runtest.all/target.test +++ /dev/null @@ -1,247 +0,0 @@ -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 deleted file mode 100644 index 8397fe3..0000000 --- a/testsuite/runtest.all/topdir/subdir1/subfile1 +++ /dev/null @@ -1 +0,0 @@ -# just so we don't look empty. diff --git a/testsuite/runtest.all/topdir/subdir1/subfile2 b/testsuite/runtest.all/topdir/subdir1/subfile2 deleted file mode 100644 index 7d1d836..0000000 --- a/testsuite/runtest.all/topdir/subdir1/subfile2 +++ /dev/null @@ -1,2 +0,0 @@ -# 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 deleted file mode 100644 index 7d1d836..0000000 --- a/testsuite/runtest.all/topdir/subdir1/subsubdir1/subsubfile1 +++ /dev/null @@ -1,2 +0,0 @@ -# just so we don't look empty. - diff --git a/testsuite/runtest.all/topdir/subdir2/subfile2 b/testsuite/runtest.all/topdir/subdir2/subfile2 deleted file mode 100644 index 7d1d836..0000000 --- a/testsuite/runtest.all/topdir/subdir2/subfile2 +++ /dev/null @@ -1,2 +0,0 @@ -# just so we don't look empty. - diff --git a/testsuite/runtest.all/utils.test b/testsuite/runtest.all/utils.test deleted file mode 100644 index 201280f..0000000 --- a/testsuite/runtest.all/utils.test +++ /dev/null @@ -1,117 +0,0 @@ -# Test procedures in lib/utils.exp. - -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" -} - -# Test getdirs: -# -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" -} - -# Test find: -# -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" -} - -if [regexp ".*/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 'which' using a relative path. -# -if {[which ./config.status] != 0} { - pass "which, relative path to config.status" -} else { - fail "which, relative path to config.status" -} - -# Test 'which' using an absolute path. -# -if {[which [file join $objdir config.status]] != 0} { - pass "which, absolute path to config.status" -} else { - fail "which, absolute path to config.status" -} - -# Test 'which make'. -# -if {[which make] != 0} { - pass "which, make" -} else { - pass "which, make" -} - -# grep args -# diff file_1 file_2 -# runtest_file_p