* Clean.tcl: Add -r to rm, so it gets rid of CVS directories.
authorRob Savoye <rob@welcomehome.org>
Thu, 12 Apr 2001 05:32:15 +0000 (05:32 +0000)
committerRob Savoye <rob@welcomehome.org>
Thu, 12 Apr 2001 05:32:15 +0000 (05:32 +0000)
* .clean: Don't install the debian or redhat packaging directories.
* Makefle.am: Install dejagnu.h. Fix dist2 target, so we build our
own tarballs, instead of letting automake do it for us.
* examples/cala/Makefile.am: Use noist_PROGRAMS, so calc doesn't
get installed.
* doc/Makefile.am: Install the man page for runtest.
* configure.in: Make VERSION 1.4.0, not just 1.4, so distributions
get built right.
* lib/dejagnu.exp: Test driver for embedded DejaGnu API.
* dejagnu.h: Embedded DejaGnu API main header file.
* config/default.exp: Default tool init file for simple test
suites.

ChangeLog
Makefile.am
Makefile.in
configure
configure.in
dejagnu.h [new file with mode: 0644]
doc/Makefile.am
doc/Makefile.in
lib/dejagnu.exp [new file with mode: 0755]

index 1bb6a81..922b9f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2001-04-11  Rob Savoye  <rob@slipknot.welcomehome.org>
+
+       * Clean.tcl: Add -r to rm, so it gets rid of CVS directories.
+       * .clean: Don't install the debian or redhat packaging directories.
+       * Makefle.am: Install dejagnu.h. Fix dist2 target, so we build our
+       own tarballs, instead of letting automake do it for us.
+       * examples/cala/Makefile.am: Use noist_PROGRAMS, so calc doesn't
+       get installed.
+       * doc/Makefile.am: Install the man page for runtest.
+       * configure.in: Make VERSION 1.4.0, not just 1.4, so distributions
+       get built right.
+
+2001-04-07  Rob Savoye  <rob@blackpeter.welcomehome.org>
+
+       * lib/dejagnu.exp: Test driver for embedded DejaGnu API.
+       * dejagnu.h: Embedded DejaGnu API main header file.
+       * config/default.exp: Default tool init file for simple test
+       suites.
+
 2001-04-06  Rob Savoye  <rob@slipknot.welcomehome.org>
 
        * Makefile.am: Add an empty check-DEJAGNU target, cause we only
index fd05622..8471e14 100644 (file)
@@ -3,13 +3,13 @@
 AUTOMAKE_OPTIONS = dejagnu
 
 # Install all the associated data files
-SUBDIRS = doc testsuite example
+SUBDIRS = doc testsuite example 
 
 # Install the bourne shell script driver in the bindir
 bin_SCRIPTS = runtest
 
 # Install the main DejaGnu expect file in the datadir
-pkgdata_SCRIPTS = config.guess runtest.exp
+pkgdata_SCRIPTS = runtest.exp
 
 # Install config.guess too, so we can use it to figure out
 # what type of machine we're running on.
@@ -29,22 +29,37 @@ check-DEJAGNU:
        @echo "Do nothing here, cause we don't want to run the tests twice"
 
 # Set ourselves up to build a RedHat package
-dist2: rpmspec overview.html
-       -rm -fr dejagnu-${VERSION}.0
-       cp -fpr $(srcdir) dejagnu-${VERSION}.0
-       @echo "clean up stuff we don't want in the source file"
-       (cd dejagnu-${VERSION}.0 ; $(srcdir)/Clean.tcl)
-       -mkdir -p doc/overview
-       -cp -fr doc/overview dejagnu-${VERSION}.0/doc/
-       tar cvf ../dejagnu-${VERSION}.0.tar dejagnu-${VERSION}.0
-       gzip -9fv ../dejagnu-${VERSION}.0.tar
-       cp -f ../dejagnu-${VERSION}.0.tar.gz /usr/src/redhat/SOURCES/
+#dist2: tarball rpmspec overview.html overview.ps overview.pdf \
+#       dejagnu-${VERSION}.tar.gz
+#      -rm -fr dejagnu-${VERSION}
+#      cp -fpr $(srcdir) dejagnu-${VERSION}
+#      @echo "clean up stuff we don't want in the source file"
+#      (cd dejagnu-${VERSION} ; $(srcdir)/Clean.tcl)
+#      -mkdir -p doc/overview
+#      -cp -fr doc/overview dejagnu-${VERSION}/doc/
+#      -cp -fr doc/overview.ps dejagnu-${VERSION}/doc/
+#      -cp -fr doc/overview.pdf dejagnu-${VERSION}/doc/
+#      tar cvf ../dejagnu-${VERSION}.tar dejagnu-${VERSION}.0
+#      gzip -9fv ../dejagnu-${VERSION}.tar
+#      cp -f ../dejagnu-${VERSION}.tar.gz /usr/src/redhat/SOURCES/
+#      cp -f $(srcdir)/redhat/dejagnu.spec /usr/src/redhat/SPECS/
+
+#tarball: overview.html overview.ps overview.pdf
+#      -rm -fr dejagnu-${VERSION}
+#      cp -fpr $(srcdir) dejagnu-${VERSION}
+#      @echo "clean up stuff we don't want in the source file"
+#      (cd dejagnu-${VERSION} ; $(srcdir)/Clean.tcl)
+#      -mkdir -p doc/overview
+#      -cp -fr doc/overview dejagnu-${VERSION}/doc/
+#      -cp -fr doc/overview.ps dejagnu-${VERSION}/doc/
+#      -cp -fr doc/overview.pdf dejagnu-${VERSION}/doc/
+#      tar cf ../dejagnu-${VERSION}.tar dejagnu-${VERSION}.0
+#      gzip -9fv ../dejagnu-${VERSION}.tar
+
+rpmspec: $(srcdir)/redhat/dejagnu.spec
        cp -f $(srcdir)/redhat/dejagnu.spec /usr/src/redhat/SPECS/
 
-rpmspec:
-       cp -f $(srcdir)/redhat/dejagnu.spec /usr/src/redhat/SPECS/
-
-rpm: dist rpmspec
+rpm: dist2 rpmspec
        cp -f $(distdir).tar.gz /usr/src/redhat/SOURCES/
        rpm -ba /usr/src/redhat/SPECS/dejagnu.spec
 
@@ -60,6 +75,8 @@ dist-hook: rpmspec overview.html
        cp -fpr $(srcdir) $(distdir)
        (cd $(distdir) ; $(TCLSH) $(srcdir)/Clean.tcl)
        -cp -fr doc/overview $(distdir)/doc/
+       -cp -fr doc/overview.ps $(distdir)/doc/
+       -cp -fr doc/overview.pdf $(distdir)/doc/
 
 
 # Below, host-independent data files that need to get installed.
@@ -85,6 +102,8 @@ install-data-local:
          test ! -f "$$f" || $(INSTALL_DATA) $$f $(baseboards_dest); \
        done
        #
+       $(INSTALL_DATA) $(srcdir)/dejagnu.h $(includedir); \
+       #
        $(mkinstalldirs) $(config_dest)
        for f in $(config_files); do \
          test ! -f "$$f" || $(INSTALL_DATA) $$f $(config_dest); \
@@ -101,7 +120,10 @@ uninstall-local:
          test ! -f "$$f" || rm -f $(baseboards_dest)/`basename "$$f"`; \
        done
 
-
+       for f in $(baseboards_files); do \
+         test ! -f "$$f" || rm -f $(baseboards_dest)/`basename "$$f"`; \
+       done
+       rm -f $(baseboards_dest)/`basename dejagnu.h`;
 
 
 
index 9df84c1..1bf099e 100644 (file)
@@ -71,13 +71,13 @@ tclsh = @tclsh@
 AUTOMAKE_OPTIONS = dejagnu
 
 # Install all the associated data files
-SUBDIRS = doc testsuite example
+SUBDIRS = doc testsuite example 
 
 # Install the bourne shell script driver in the bindir
 bin_SCRIPTS = runtest
 
 # Install the main DejaGnu expect file in the datadir
-pkgdata_SCRIPTS = config.guess runtest.exp
+pkgdata_SCRIPTS = runtest.exp
 
 # Install config.guess too, so we can use it to figure out
 # what type of machine we're running on.
@@ -92,6 +92,9 @@ RUNTEST = `   if [ -f ${srcdir}/runtest$(EXEEXT) ] ; then     echo ${srcdir}/run
 
 CLEANFILES = x.log x.sum site.bak setval.tmp
 
+SUBVERSION = 0
+FULLVERSION = $(VERSION).$(SUBVERSION)
+
 # Below, host-independent data files that need to get installed.
 # We do it this way so we can use globbing.
 
@@ -441,24 +444,38 @@ mostlyclean distclean maintainer-clean
 
 check-DEJAGNU:
        @echo "Do nothing here, cause we don't want to run the tests twice"
-
 # Set ourselves up to build a RedHat package
-dist2: rpmspec overview.html
-       -rm -fr dejagnu-${VERSION}.0
-       cp -fpr $(srcdir) dejagnu-${VERSION}.0
+dist2: tarball rpmspec overview.html overview.ps overview.pdf \
+       dejagnu-${FULLVERSION}.tar.gz
+#      -rm -fr dejagnu-${FULLVERSION}
+#      cp -fpr $(srcdir) dejagnu-${FULLVERSION}
+#      @echo "clean up stuff we don't want in the source file"
+#      (cd dejagnu-${FULLVERSION} ; $(srcdir)/Clean.tcl)
+#      -mkdir -p doc/overview
+#      -cp -fr doc/overview dejagnu-${FULLVERSION}/doc/
+#      -cp -fr doc/overview.ps dejagnu-${FULLVERSION}/doc/
+#      -cp -fr doc/overview.pdf dejagnu-${FULLVERSION}/doc/
+#      tar cvf ../dejagnu-${FULLVERSION}.tar dejagnu-${VERSION}.0
+#      gzip -9fv ../dejagnu-${FULLVERSION}.tar
+       cp -f ../dejagnu-${FULLVERSION}.tar.gz /usr/src/redhat/SOURCES/
+       cp -f $(srcdir)/redhat/dejagnu.spec /usr/src/redhat/SPECS/
+
+tarball:
+       -rm -fr dejagnu-${FULLVERSION}
+       cp -fpr $(srcdir) dejagnu-${FULLVERSION}
        @echo "clean up stuff we don't want in the source file"
-       (cd dejagnu-${VERSION}.0 ; $(srcdir)/Clean.tcl)
+       (cd dejagnu-${FULLVERSION} ; $(srcdir)/Clean.tcl)
        -mkdir -p doc/overview
-       -cp -fr doc/overview dejagnu-${VERSION}.0/doc/
-       tar cvf ../dejagnu-${VERSION}.0.tar dejagnu-${VERSION}.0
-       gzip -9fv ../dejagnu-${VERSION}.0.tar
-       cp -f ../dejagnu-${VERSION}.0.tar.gz /usr/src/redhat/SOURCES/
-       cp -f $(srcdir)/redhat/dejagnu.spec /usr/src/redhat/SPECS/
+       -cp -fr doc/overview dejagnu-${FULLVERSION}/doc/
+       -cp -fr doc/overview.ps dejagnu-${FULLVERSION}/doc/
+       -cp -fr doc/overview.pdf dejagnu-${FULLVERSION}/doc/
+       tar cf ../dejagnu-${FULLVERSION}.tar dejagnu-${VERSION}.0
+       gzip -9fv ../dejagnu-${FULLVERSION}.tar
 
-rpmspec:
+rpmspec: $(srcdir)/redhat/dejagnu.spec
        cp -f $(srcdir)/redhat/dejagnu.spec /usr/src/redhat/SPECS/
 
-rpm: dist rpmspec
+rpm: dist2 rpmspec
        cp -f $(distdir).tar.gz /usr/src/redhat/SOURCES/
        rpm -ba /usr/src/redhat/SPECS/dejagnu.spec
 
@@ -486,6 +503,8 @@ install-data-local:
          test ! -f "$$f" || $(INSTALL_DATA) $$f $(baseboards_dest); \
        done
        #
+       $(INSTALL_DATA) $(srcdir)/dejagnu.h $(includedir); \
+       #
        $(mkinstalldirs) $(config_dest)
        for f in $(config_files); do \
          test ! -f "$$f" || $(INSTALL_DATA) $$f $(config_dest); \
@@ -502,6 +521,11 @@ uninstall-local:
          test ! -f "$$f" || rm -f $(baseboards_dest)/`basename "$$f"`; \
        done
 
+       for f in $(baseboards_files); do \
+         test ! -f "$$f" || rm -f $(baseboards_dest)/`basename "$$f"`; \
+       done
+       rm -f $(baseboards_dest)/`basename dejagnu.h`;
+
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
index 23337d6..bc33d01 100755 (executable)
--- a/configure
+++ b/configure
@@ -700,7 +700,7 @@ fi
 
 PACKAGE=dejagnu
 
-VERSION=1.4
+VERSION=1.4.0
 
 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
   { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
index 93bbc55..a7de1e7 100644 (file)
@@ -4,7 +4,7 @@ AC_INIT(runtest.exp)
 dnl AC_CONFIG_AUX_DIR(..)
 
 dnl These are required by automake
-AM_INIT_AUTOMAKE(dejagnu, 1.4)
+AM_INIT_AUTOMAKE(dejagnu, 1.4.0)
 AM_MAINTAINER_MODE
 AC_PROG_MAKE_SET
 
diff --git a/dejagnu.h b/dejagnu.h
new file mode 100644 (file)
index 0000000..214d3ff
--- /dev/null
+++ b/dejagnu.h
@@ -0,0 +1,215 @@
+/* 
+ *   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* This is the include generated by configuring */
+#include <config.h>
+
+#ifndef __DEJAGNU_H__
+#define __DEJAGNU_H__
+
+#include <stdio.h>
+
+static int passed;
+static int failed;
+static int untest;
+static int unresolve;
+
+inline void
+pass (const char *s) {
+    passed++;
+    printf ("\tPASSED: %s\n", s);
+}
+
+inline void
+fail (const char *s) {
+    failed++;
+    printf ("\tFAILED: %s\n", s);
+}
+
+inline void
+untested (const char *s) {
+    untest++;
+    printf ("\tUNTESTED: %s\n", s);
+}
+
+inline void
+unresolved (const char *s) {
+    unresolve++;
+    printf ("\tUNRESOLVED: %s\n", s);
+}
+
+inline void
+totals (void) {
+    printf ("\nTotals:\n");
+    printf ("\t#passed:\t\t%d\n", passed);
+    printf ("\t#failed:\t\t%d\n", failed);
+    if (untest)
+        printf ("\t#untested:\t\t%d\n", untest);
+    if (unresolve)
+        printf ("\t#unresolved:\t\t%d\n", unresolved);
+}
+
+#ifdef __cplusplus
+
+#include <iostream>
+#include <iomanip>
+#include <fstream>
+#include <string>
+#include <strstream>
+
+char *outstate[] = {
+    "FAILED: ",
+    "PASSED: ",
+    "UNTESTED: ",
+    "UNRESOLVED: "
+};
+
+#if 0
+extern ios& __iomanip_testout (ios&, int);
+inline smanip<int> testout (int n) {
+    return smanip<int> (__iomanip_testout, n);
+}
+ios & __iomanip_testout (ios& i, int x) {
+    return i;
+}
+
+template<class T>
+class OMANIP {
+ private:
+    T i;
+    ostream &(*f)(ostream&, T);
+ public:
+    OMANIP(ostream& (*ff)(ostream&, T), T ii) : f(ff), i(ii) {
+    }
+    friend ostream operator<<(ostream& us, OMANIP& m) {
+      return m.f(os,m.i);
+    }
+};
+
+ostream&
+freakout(ostream& os, int x) {
+    return os << "FREAKOUT" ;
+//    return x << "TESTOUT " << x ;
+}
+
+OMANIP<int> testout(int i) {
+    return OMANIP<int>(&freakout,i);
+}
+#endif
+
+char *testout (int x) {
+    const int len = 128;
+    static char buf[len];
+    static ostrstream oss(buf, len, ios::out);
+    oss.seekp(ios::beg);
+    oss << outstate[x] << ends;
+    return buf;
+}
+
+enum teststate {FAILED, PASSED,UNTESTED,UNRESOLVED} laststate;
+
+class TestState {
+ private:
+    teststate laststate;
+    string lastmsg;
+ public:
+    TestState(void) {
+        passed = 0;
+        failed = 0;
+        untest = 0;
+        unresolve = 0;
+    }
+    ~TestState(void) {
+        totals();
+    };
+
+    void testrun (bool b, string s) {
+        if (b)
+            pass (s);
+        else
+            fail (s);
+    }
+
+    void pass (string s) {
+        passed++;
+        laststate = PASSED;
+        lastmsg = s;
+        cout << "\t" << testout(PASSED) << s << endl;
+    }
+    void pass (const char *c) {
+        string s = c;
+        pass (s);
+    }
+
+    void fail (string s) {
+        failed++;
+        laststate = FAILED;
+        lastmsg = s;
+        cout << "\t" << testout(FAILED) << s << endl;
+    }
+    void fail (const char *c) {
+        string s = c;
+        fail (s);
+    }
+
+    void untested (string s) {
+        untest++;
+        laststate = UNTESTED;
+        lastmsg = s;
+        cout << "\t" << testout(UNTESTED) << s << endl;
+    }
+    void untested (const char *c) {
+        string s = c;
+        untested (s);
+    }
+
+    void unresolved (string s) {
+        unresolve++;
+        laststate = UNRESOLVED;
+        lastmsg = s;
+        cout << "\t" << testout(UNRESOLVED) << s << endl;
+    }
+    void unresolved (const char *c) {
+        string s = c;
+        unresolved (s);
+    }
+    void totals (void) {
+        cout << "\t#passed:\t\t" << passed << endl;
+        cout << "\t#failed:\t\t" << failed << endl;
+        if (untest)
+            cout << "\t#untested:\t\t" << untest << endl;
+        if (unresolve)
+            cout << "\t#unresolved:\t\t" << unresolve << endl;
+    }
+
+    friend ostream & operator << (ostream &os, TestState& t) {
+        return os << "\t" << outstate[t.laststate] << t.lastmsg ;
+    }
+
+    int GetState(void) {
+        return laststate;
+    }
+    string GetMsg(void) {
+        return lastmsg;
+    }
+};
+
+#endif         // __cplusplus
+#endif          // _DEJAGNU_H_
+
+
index 68e05f4..9aa89b3 100644 (file)
@@ -2,6 +2,10 @@
 
 # AUTOMAKE_OPTIONS =
 
+man_MANS = runtest.1
+# FIXME: We need to generate an info doc from SGML somehow, but for
+# now, don't install the old texinfo document from version 1.3
+# info_TEXINFOS = dejagnu.texi
 DOCBOOK = @DOCBOOK@
 TARGETS = overview.html overview.rtf overview.ps # overview.pdf overview.dvi
 
@@ -45,5 +49,7 @@ install-doc: $(TARGETS)
        $(INSTALL_DATA) overview/stylesheet-images/*.png $(DESTDIR)$(pkgdatadir)/html/stylesheet-images
        $(INSTALL_DATA) overview.rtf $(DESTDIR)$(pkgdatadir)/dejagnu.ps
        $(INSTALL_DATA) overview.ps $(DESTDIR)$(pkgdatadir)/dejagnu.ps
-#      $(INSTALL_DATA) overview.pdf $(DESTDIR)$(pkgdatadir)/dejagnu.pdf
+       $(INSTALL_DATA) overview.pdf $(DESTDIR)$(pkgdatadir)/dejagnu.pdf
+       $(INSTALL_DATA) runtest.1 $(mandir)/man1/
+
 
index 2938945..a9a4def 100644 (file)
@@ -70,10 +70,18 @@ TCLSH = @TCLSH@
 VERSION = @VERSION@
 tclsh = @tclsh@
 
+man_MANS = runtest.1
+# FIXME: We need to generate an info doc from SGML somehow, but for
+# now, don't install the old texinfo document from version 1.3
+# info_TEXINFOS = dejagnu.texi
 DOCBOOK = @DOCBOOK@
 TARGETS = overview.html overview.rtf overview.ps # overview.pdf overview.dvi
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES = 
+man1dir = $(mandir)/man1
+MANS = $(man_MANS)
+
+NROFF = nroff
 DIST_COMMON =  README Makefile.am Makefile.in configure configure.in
 
 
@@ -90,6 +98,45 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status $(BUILT_SOURCES)
        cd $(top_builddir) \
          && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+
+install-man1:
+       $(mkinstalldirs) $(DESTDIR)$(man1dir)
+       @list='$(man1_MANS)'; \
+       l2='$(man_MANS)'; for i in $$l2; do \
+         case "$$i" in \
+           *.1*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+         else file=$$i; fi; \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+         echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+         $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+       done
+
+uninstall-man1:
+       @list='$(man1_MANS)'; \
+       l2='$(man_MANS)'; for i in $$l2; do \
+         case "$$i" in \
+           *.1*) list="$$list $$i" ;; \
+         esac; \
+       done; \
+       for i in $$list; do \
+         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+         echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+         rm -f $(DESTDIR)$(man1dir)/$$inst; \
+       done
+install-man: $(MANS)
+       @$(NORMAL_INSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) install-man1
+uninstall-man:
+       @$(NORMAL_UNINSTALL)
+       $(MAKE) $(AM_MAKEFLAGS) uninstall-man1
 tags: TAGS
 TAGS:
 
@@ -125,19 +172,20 @@ installcheck: installcheck-am
 install-exec-am:
 install-exec: install-exec-am
 
-install-data-am:
+install-data-am: install-man
 install-data: install-data-am
 
 install-am: all-am
        @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
 install: install-am
-uninstall-am:
+uninstall-am: uninstall-man
 uninstall: uninstall-am
-all-am: Makefile
+all-am: Makefile $(MANS)
 all-redirect: all-am
 install-strip:
        $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
 installdirs:
+       $(mkinstalldirs)  $(DESTDIR)$(mandir)/man1
 
 
 mostlyclean-generic:
@@ -167,12 +215,12 @@ maintainer-clean-am:  maintainer-clean-generic distclean-am
 
 maintainer-clean: maintainer-clean-am
 
-.PHONY: tags distdir info-am info dvi-am dvi check check-am \
-installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
+.PHONY: install-man1 uninstall-man1 install-man uninstall-man tags \
+distdir info-am info dvi-am dvi check check-am installcheck-am \
+installcheck install-exec-am install-exec install-data-am install-data \
+install-am install uninstall-am uninstall all-redirect all-am all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
 
 
 docs: $(TARGETS)
@@ -215,7 +263,8 @@ install-doc: $(TARGETS)
        $(INSTALL_DATA) overview/stylesheet-images/*.png $(DESTDIR)$(pkgdatadir)/html/stylesheet-images
        $(INSTALL_DATA) overview.rtf $(DESTDIR)$(pkgdatadir)/dejagnu.ps
        $(INSTALL_DATA) overview.ps $(DESTDIR)$(pkgdatadir)/dejagnu.ps
-#      $(INSTALL_DATA) overview.pdf $(DESTDIR)$(pkgdatadir)/dejagnu.pdf
+       $(INSTALL_DATA) overview.pdf $(DESTDIR)$(pkgdatadir)/dejagnu.pdf
+       $(INSTALL_DATA) runtest.1 $(mandir)/man1/
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/lib/dejagnu.exp b/lib/dejagnu.exp
new file mode 100755 (executable)
index 0000000..f98effb
--- /dev/null
@@ -0,0 +1,174 @@
+# a hairy pattern to recognize text
+set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]"
+
+set SIZE size
+if { [which $SIZE] == 0 } {
+    perror "Can't find $SIZE."
+}
+
+# Get the size of the various section in an object file
+proc exe_size {object} {
+    global SIZE
+
+    # Make sure size exists
+    if { [which $SIZE] == 0 } {
+       return [list "-1" "Can't find $SIZE."]
+    } else {
+       verbose "Using $SIZE for \"size\" program." 2
+    }
+    set status [catch "exec $SIZE -V" output]
+    if {[regexp "GNU size" $output] == 0} {
+       perror "Need GNU size from the binutils" 0
+       return [list "-1" "Need GNU size."]
+    }
+    
+    # Get the object size. We pass -x, to force hex output
+    verbose "Getting the object file size for $object" 2
+    set status [catch "exec $SIZE -x $object" output]
+    verbose -log "Size of $object is\n$output" 2
+
+    # Remove the header line from the size output. This currently only
+    # works with GNU size
+    regsub "text.*filename\[\r\n\]*" $output "" output
+
+    # look for the size of the .text section
+    regexp "\[\r\n\]*0x\[0-9a-fA-F\]*" $output text
+    regsub "\[\r\n\]*0x\[0-9a-fA-F\]*\[ \t\]*" $output "" output
+
+    # look for the size of the .data section
+    regexp "0x\[0-9a-fA-F\]*\[ \t\]*" $output data
+    regsub "0x\[0-9a-fA-F\]*\[ \t\]*" $output "" output
+
+    # Values returns as hex
+    return [list $text $data]
+}
+
+# Run the host's native compiler, not the cross one. Filter out the 
+# warnings and other extraneous stuff.
+#    Returns:
+#      A "" (empty) string if everything worked, or the
+#       output if there was a problem.
+proc host_compile {compline} {
+    global INCLUDES
+    global LIBS
+    global CXX, CC
+
+    # execute the compiler
+    verbose "Compiling for the host using: $CC $INCLUDES $LIBS $compline" 2
+    set status [catch "exec $CC $INCLUDES $LIBS $compline" comp_output];
+    verbose "Compiler returned $comp_output" 2
+    
+    # prune common warnings and other stuff we can safely ignore
+    set comp_output [prune_warnings $comp_output];
+
+    # Trim multiple CR/LF pairs out to keep things consistant
+    regsub "^\[\r\n\]+" $comp_output "" comp_output;
+
+    # if we got a compiler error, log it
+    if { [lindex $status 0] != 0 } {
+       verbose -log "compiler exited with status [lindex $status 0]";
+    }
+    if { [lindex $status 1] != "" } {
+       verbose -log "output is:\n[lindex $status 1]" 2;
+    }
+
+    # return the filtered output
+    return ${comp_output}
+}
+
+# Execute the executable file, and anaylyse the output for the 
+# test state keywords.
+#    Returns:
+#      A "" (empty) string if everything worked, or an error message
+#      if there was a problem.
+proc host_execute {args} {
+    global text
+
+    set timeoutmsg "Timed out: Never got started, "
+    set timeout 100
+    set file all
+    set timetol 0
+    set arguments ""
+    
+    expect_before buffer_full { perror "Buffer full" }
+    
+    if { [llength $args] == 0} {
+       set executable $args
+    } else {
+       set executable [string trimleft [lindex [split $args " "] 0] "\{"]
+       set params [string trimleft [lindex [split $args " "] 1] "\{"]
+       set params [string trimright $params "\}"]
+    }
+
+    verbose "The executable is $executable" 2
+    if ![file exists ${executable}] {
+       perror "The executable, \"$executable\" is missing" 0
+       return "No source file found"
+    }
+
+    # spawn the executable and look for the DejaGnu output messages from the
+    # test case.
+    # spawn -noecho -open [open "|./${executable}" "r"]
+    spawn -noecho "./${executable}" ${params}
+    expect {
+       -re "\[0-9\]\[0-9\]:..:..:${text}\r\n" {
+           regsub "\[\n\r\t\]*NOTE: " $expect_out(0,string) "" output
+           verbose "$output" 3
+           set timetol 0
+           exp_continue
+       }
+       -re "NOTE:${text}*" {
+           regsub "\[\n\r\t\]*NOTE: " $expect_out(0,string) "" output
+           verbose "$output" 2
+           set timetol 0
+           exp_continue
+       }
+       -re "PASSED:${text}*" {
+           regsub "\[\n\r\t\]*PASSED: " $expect_out(0,string) "" output
+           pass "$output"
+           set timetol 0
+           exp_continue
+       }
+       -re "FAILED:${text}*" {
+           regsub "\[\n\r\t\]*FAILED: " $expect_out(0,string) "" output
+           fail "$output"
+           set timetol 0
+           exp_continue
+       }
+       -re "UNTESTED:${text}*" {
+           regsub "\[\n\r\t\]*TESTED: " $expect_out(0,string) "" output
+           untested "$output"
+           set timetol 0
+           exp_continue
+       }
+       -re "UNRESOLVED:${text}*" {
+           regsub "\[\n\r\t\]*UNRESOLVED: " $expect_out(0,string) "" output
+           unresolved "$output"
+           set timetol 0
+           exp_continue
+       }
+       -re "Totals" {
+           verbose "All done" 2
+       }
+       eof {
+#          unresolved "${executable} died prematurely"
+#          catch close
+#          return "${executable} died prematurely"
+       }
+       timeout {
+           warning "Timed out executing test case"
+           if { $timetol <= 2 } {
+               incr timetol
+               exp_continue
+           } else {
+-              catch close
+               return "Timed out executing test case"
+           }
+       }
+    }
+
+    # force a close of the executable to be safe.
+    catch close
+    return ""
+}
+