dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Learning DejaGnu


From: Ben Elliston
Subject: Re: Learning DejaGnu
Date: 25 Feb 2004 08:18:10 +1100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Braden McDaniel <address@hidden> writes:

> I'm trying to get a handle on using DejaGnu to do some basic
> testing, but I'm having quite a bit of difficulty. I've been looking
> over the manual and the calc and helloworld examples; and I'm still
> pretty mystified at how to run my test program with an argument. The
> manual's suggestions that I look at what gcc and gdb do are a bit
> overwhelming considering I still can't seem to figure out what in
> the DejaGnu configuration files allows "make check" to run the tests
> in "calc.test" (that is, I can establish that it doesn't work if I
> rename the directory to "calc.foo").

Projects that use Automake need only put "AUTOMAKE_OPTIONS = dejagnu"
in their Makefile.am and the Makefile will include a "check" target
that will do the right thing and invoke runtest for you.  The target
looks something like:

check-DEJAGNU: site.exp
        if [ -d testsuite ]; then \
          true; \
        else \
          mkdir testsuite; \
        fi
        rm -f testsuite/site.exp
        cp site.exp testsuite/site.exp
        rootme=`pwd`; export rootme; \
        srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
        EXPECT=${EXPECT} ; export EXPECT ; \
        if [ -f $(top_builddir)/../expect/expect ]; then \
          TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd`; \
          export TCL_LIBRARY; \
        fi; \
        runtest=$(RUNTEST); \
        cd testsuite; \
        if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
          $$runtest --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite \
                $(RUNTESTFLAGS); \
        else echo "WARNING: could not find \`runtest'" 1>&2; :;\
        fi

If you are not using Automake, you would need to write something like
this directly into your Makefile.

Now, "make check" will invoke runtest, passing the name of the tool
(--tool) and the location of your source directory (--src) and runtest
will scan that directory tree for .exp test scripts to run.

Ben







reply via email to

[Prev in Thread] Current Thread [Next in Thread]