adding.html   [plain text]


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML
><HEAD
><TITLE
>Adding A Test Case To A Test Suite.</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="DejaGnu"
HREF="book1.html"><LINK
REL="UP"
TITLE="Extending DejaGnu"
HREF="extending.html"><LINK
REL="PREVIOUS"
TITLE="Debugging A Test Case"
HREF="debugging.html"><LINK
REL="NEXT"
TITLE="Hints On Writing A Test Case"
HREF="hints.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>DejaGnu: The GNU Testing Framework</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="debugging.html"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Extending DejaGnu</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="hints.html"
>Next &#62;&#62;&#62;</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="ADDING"
>Adding A Test Case To A Test Suite.</A
></H1
><P
>There are two slightly different ways to add a test
      case. One is to add the test case to an existing directory. The
      other is to create a new directory to hold your test. The
      existing test directories represent several styles of testing,
      all of which are slightly different; examine the directories for
      the tool of interest to see which (if any) is most suitable.</P
><P
>Adding a GCC test can be very simple: just add the C code
      to any directory beginning with <TT
CLASS="FILENAME"
>gcc</TT
>. and it
      runs on the next <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="PROGRAMLISTING"
>runtest --tool
      gcc</PRE
></TD
></TR
></TABLE
>.</P
><P
>To add a test to GDB, first add any source code you will
      need to the test directory. Then you can either create a new
      expect file, or add your test to an existing one (any
      file with a <I
CLASS="EMPHASIS"
>.exp</I
> suffix).  Creating a new
      .exp file is probably a better idea if the test is significantly
      different from existing tests. Adding it as a separate file also
      makes upgrading easier. If the C code has to be already compiled
      before the test will run, then you'll have to add it to the
      <TT
CLASS="FILENAME"
>Makefile.in</TT
> file for that test directory,
      then run <B
CLASS="COMMAND"
>configure</B
> and
      <B
CLASS="COMMAND"
>make</B
>.</P
><P
>Adding a test by creating a new directory is very
      similar:</P
><P
></P
><UL
><LI
STYLE="list-style-type: disc"
><P
>Create the new directory. All subdirectory names
      begin with the name of the tool to test; e.g. G++ tests might be
      in a directory called <TT
CLASS="FILENAME"
>g++.other</TT
>. There can
      be multiple test directories that start with the same tool name
      (such as <I
CLASS="EMPHASIS"
>g++</I
>).</P
></LI
><LI
STYLE="list-style-type: disc"
><P
>Add the new directory name to the
      <SPAN
CLASS="SYMBOL"
>configdirs</SPAN
> definition in the
      <TT
CLASS="FILENAME"
>configure.in</TT
> file for the test suite
      directory. This way when <B
CLASS="COMMAND"
>make</B
> and
      <B
CLASS="COMMAND"
>configure</B
> next run, they include the new
      directory.</P
></LI
><LI
STYLE="list-style-type: disc"
><P
>Add the new test case to the directory, as
      above. </P
></LI
><LI
STYLE="list-style-type: disc"
><P
>To add support in the new directory for
      configure and make, you must also create a
      <TT
CLASS="FILENAME"
>Makefile.in</TT
> and a
      <TT
CLASS="FILENAME"
>configure.in</TT
>.</P
></LI
></UL
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="debugging.html"
>&#60;&#60;&#60; Previous</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="hints.html"
>Next &#62;&#62;&#62;</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Debugging A Test Case</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="extending.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Hints On Writing A Test Case</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>