This directory contains testing infrastructure and a set of regression
tests for m5.  

Contents:
1) Overview
2) Running do-tests.pl (short story)
3) Longer directions
4) Updating tests in the Bitkeeper repo
5) Adding tests
6) Regression tests

Overview
-------------------------
There are two main scripts in this directory - do-tests.pl and
regression.pl.  do-tests.pl is what most users will need to make sure
their code doesn't break anything before checking it in.
regression.pl is meant to be called from cron or a pool computer
nightly, and it will call do-tests.pl.


Running do-tests.pl (short story)
----------------------------------
There are a lot of options for this script. However, for many users,
the simplest is to just type "./do-tests.pl".  This will give you the
default options of:

 -O run tests on the opt binary
 -T run tests specified by the <BUILD>-interactive-tests file
 -t pwd (point to cwd as m5-test)
 -d ../m5/build (point to ../m5/build as build directory)

**In the end, the stdout will tell you if there were errors in the run,
and the details will be in the ERRORS file.  

**The simout.refs of each test will be saved in the log/ directory.

**All test diff-outs will be logged in the file diff-outputs.


Longer directions:
------------------

All the options:
 -F <builds_file> This indicates from which file to read the list of
builds to test. The default is BUILDS.  If you wanted to run only
ALPHA, you could make a file called FOO with one line, ALPHA, and call
do-tests.pl -F FOO.
    Additionally, if you would like to run only one Build, (like only KERNEL), then you could just say -F KERNEL.

 -D test only debug binaries

 -O test only opt binaries

 -T <arg> indicates which type of tests to run.  The script will run
<BUILD>-<arg>-tests. There are two hard coded args: "all" which runs
the Union of <BUILD>-*-tests, and "interactive" which is the default
and reads from <BUILD>-interactive-tests. Current convention uses
"daily" and "weekly" also, but this is not hard coded into the script.  
    Additionally, if you would like to run only one test (like test4 for example), you could say -T test4.

 -d <path> absolute path of build directory, e.g. /z/foo/build

 -t <path> absolute path of test directory, e.g. /z/foo/m5-test

 -m <flags> flags you want to pass to the make command. For example,
if when you make the binaries you would like make -j4, you would call
do-tests.pl with -m "-j4".

 -v verbose output.  output of diff-out will go to stdout, output of
make will go to stdout if there is an error in making.

 -C make clean first before making the m5 binaries

Updating tests in the Bitkeeper repository (or whatever version control)
--------------------------------------------------------------------------------------

The update-tests script will copy every simout.ref from the log
directory into the appropriate place in the m5-test directory.  The
user will have to commit, however.  The onus is also on the user to
make sure every test is run, update-tests will copy all of them
without regard to if it is an updated output from the latest binary.

The update-test script will run an individual test and update just
that one test.  Note that this differs from update-tests in that it
actually runs the test (not just copying the simout.ref).


Adding tests:
-------------

Create a new directory "test_name", within m5-test/ and add a run.ini
file that describes the test workload.  Run a copy of the
simulator **consistent with the head of the CVS tree** to generate the
reference output:

<simulator> test_name/run.ini >& test_name/simout.ref

If this test is meant for a certain build, add the test name to the
appropriate <BUILD>-type-tests file.  If it is a long test, you
probably don't want it in the interactive or daily tests file.

If this is for a new build not previously tested, add that build name
to the BUILDS file.

Finally, check in all the files you've added into CVS.  Don't check in
binaries, though, as that's not very useful.


Regression tests
----------------

To make sure nothing is broken each day, you can run regression tests
using the cron utility of a machine.  The regression.pl script just sets a few parameters and then proceeds to call do-tests.pl.  The tree is updated by Bitkeeper at every push to the root repo, so the nightly tests are the most updated.

Just "./regression.pl" will use "daily", making clean,
/z/m5/regression/m5/build as the -d option, and
/z/m5/regression/m5-test as the -t option as default.  

Specifiable arguments are -D, -O, -T, -d <arg>, -t <arg>.  Any of
these will just be passed to do-tests.pl unchanged.

