From: Daniel Dunbar Date: Mon, 2 Aug 2010 01:20:23 +0000 (+0000) Subject: docs/TestingGuide: Minimal update to describe 'lit' based regression testing X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cd3b117c76700ff26aee970c96440668b017df0a;p=oota-llvm.git docs/TestingGuide: Minimal update to describe 'lit' based regression testing instead of DejaGNU. Still a bit kooky, since the current test format still has some strong Tcl roots. Oh well! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110005 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/TestingGuide.html b/docs/TestingGuide.html index 2316eaba90a..e4db61656bb 100644 --- a/docs/TestingGuide.html +++ b/docs/TestingGuide.html @@ -16,22 +16,22 @@
  • Requirements
  • LLVM testing infrastructure organization
  • Quick start
  • -
  • DejaGNU structure +
  • Regression test structure
  • Test suite structure
  • @@ -46,8 +46,7 @@
    -

    Written by John T. Criswell, Reid Spencer, and Tanya Lattner

    +

    Written by John T. Criswell, Daniel Dunbar, Reid Spencer, and Tanya Lattner

    @@ -56,9 +55,9 @@
    -

    This document is the reference manual for the LLVM testing infrastructure. It documents -the structure of the LLVM testing infrastructure, the tools needed to use it, -and how to add and run tests.

    +

    This document is the reference manual for the LLVM testing infrastructure. It +documents the structure of the LLVM testing infrastructure, the tools needed to +use it, and how to add and run tests.

    @@ -68,17 +67,9 @@ and how to add and run tests.

    -

    In order to use the LLVM testing infrastructure, you will need all of the software -required to build LLVM, plus the following:

    - -
    -
    DejaGNU
    -
    The Feature and Regressions tests are organized and run by DejaGNU.
    -
    Expect
    -
    Expect is required by DejaGNU.
    -
    tcl
    -
    Tcl is required by DejaGNU.
    -
    +

    In order to use the LLVM testing infrastructure, you will need all of the +software required to build LLVM, as well +as Python 2.4 or later.

    @@ -88,29 +79,28 @@ required to build LLVM, plus the following:

    -

    The LLVM testing infrastructure contains two major categories of tests: code -fragments and whole programs. Code fragments are referred to as the "DejaGNU -tests" and are in the llvm module in subversion under the -llvm/test directory. The whole programs tests are referred to as the -"Test suite" and are in the test-suite module in subversion. +

    The LLVM testing infrastructure contains two major categories of tests: +regression tests and whole programs. The regression tests are contained inside +the LLVM repository itself under llvm/test and are expected to always +pass -- they should be run before every commit. The whole programs tests are +referred to as the "LLVM test suite" and are in the test-suite module +in subversion.

    -
    DejaGNU tests
    +
    Regression tests
    -

    Code fragments are small pieces of code that test a specific -feature of LLVM or trigger a specific bug in LLVM. They are usually -written in LLVM assembly language, but can be written in other -languages if the test targets a particular language front end (and the -appropriate --with-llvmgcc options were used -at configure time of the llvm module). These tests -are driven by the DejaGNU testing framework, which is hidden behind a -few simple makefiles.

    +

    The regression tests are small pieces of code that test a specific feature of +LLVM or trigger a specific bug in LLVM. They are usually written in LLVM +assembly language, but can be written in other languages if the test targets a +particular language front end (and the appropriate --with-llvmgcc +options were used at configure time of the llvm module). These +tests are driven by the 'lit' testing tool, which is part of LLVM.

    These code fragments are not complete programs. The code generated from them is never executed to determine correct behavior.

    @@ -157,8 +147,8 @@ generates code.

    -

    The tests are located in two separate Subversion modules. The - DejaGNU tests are in the main "llvm" module under the directory +

    The tests are located in two separate Subversion modules. The regressions + tests are in the main "llvm" module under the directory llvm/test (so you get these tests for free with the main llvm tree). The more comprehensive test suite that includes whole programs in C and C++ is in the test-suite module. This module should @@ -170,10 +160,10 @@ the test-suite directory will be automatically configured. Alternatively, you can configure the test-suite module manually.

    - + -

    To run all of the simple tests in LLVM using DejaGNU, use the master Makefile - in the llvm/test directory:

    +

    To run all of the LLVM regression tests, use master Makefile in + the llvm/test directory:

    @@ -189,38 +179,47 @@ Alternatively, you can configure the test-suite module manually.

    -

    To run only a subdirectory of tests in llvm/test using DejaGNU (ie. -Transforms), just set the TESTSUITE variable to the path of the -subdirectory (relative to llvm/test):

    +

    If you have Clang checked out and built, +you can run the LLVM and Clang tests simultaneously using:

    + +

    or

    -% gmake TESTSUITE=Transforms check
    +% gmake check-all
     
    -

    Note: If you are running the tests with objdir != subdir, you -must have run the complete testsuite before you can specify a -subdirectory.

    +

    To run the tests with Valgrind (Memcheck by default), just append +VG=1 to the commands above, e.g.:

    + +
    +
    +% gmake check VG=1
    +
    +
    -

    To run only a single test, set TESTONE to its path (relative to -llvm/test) and make the check-one target:

    +

    To run individual tests or subsets of tests, you can use the 'llvm-lit' +script which is built as part of LLVM. For example, to run the +'Integer/BitCast.ll' test by itself you can run:

    -% gmake TESTONE=Feature/basictest.ll check-one
    +% llvm-lit ~/llvm/test/Integer/BitCast.ll 
     
    -

    To run the tests with Valgrind (Memcheck by default), just append -VG=1 to the commands above, e.g.:

    +

    or to run all of the ARM CodeGen tests:

    -% gmake check VG=1
    +% llvm-lit ~/llvm/test/CodeGen/ARM
     
    +

    For more information on using the 'lit' tool, see 'llvm-lit --help' or the +'lit' man page.

    + @@ -274,11 +273,11 @@ that subdirectory.

    - +
    -

    The LLVM DejaGNU tests are driven by DejaGNU together with GNU Make and are - located in the llvm/test directory. +

    The LLVM regression tests are driven by 'lit' and are located in + the llvm/test directory.

    This directory contains a large array of small tests that exercise various features of LLVM and to ensure that regressions do not @@ -301,23 +300,24 @@ that subdirectory.

    - +
    -

    The DejaGNU structure is very simple, but does require some information to - be set. This information is gathered via configure and is written - to a file, site.exp in llvm/test. The llvm/test - Makefile does this work for you.

    - -

    In order for DejaGNU to work, each directory of tests must have a - dg.exp file. DejaGNU looks for this file to determine how to run the - tests. This file is just a Tcl script and it can do anything you want, but - we've standardized it for the LLVM regression tests. If you're adding a +

    The regression test structure is very simple, but does require some + information to be set. This information is gathered via configure and + is written to a file, lit.site.cfg + in llvm/test. The llvm/test Makefile does this work for + you.

    + +

    In order for the regression tests to work, each directory of tests must + have a dg.exp file. Lit looks for this file to determine how to + run the tests. This file is just a Tcl script and it can do anything you want, + but we've standardized it for the LLVM regression tests. If you're adding a directory of tests, just copy dg.exp from another directory to get - running. The standard dg.exp simply loads a Tcl - library (test/lib/llvm.exp) and calls the llvm_runtests - function defined in that library with a list of file names to run. The names - are obtained by using Tcl's glob command. Any directory that contains only + running. The standard dg.exp simply loads a Tcl library + (test/lib/llvm.exp) and calls the llvm_runtests function + defined in that library with a list of file names to run. The names are + obtained by using Tcl's glob command. Any directory that contains only directories does not need the dg.exp file.

    The llvm-runtests function lookas at each file that is passed to @@ -378,7 +378,8 @@ that subdirectory.

    There are some quoting rules that you must pay attention to when writing your RUN lines. In general nothing needs to be quoted. Tcl won't strip off any - ' or " so they will get passed to the invoked program. For example:

    + quote characters so they will get passed to the invoked program. For + example:

    @@ -695,7 +696,7 @@ define two separate CHECK lines that match on the same line.
     
    -
    Variables and +
    @@ -791,7 +792,7 @@ substitutions
    - +

    To make RUN line writing easier, there are several shell scripts located @@ -817,7 +818,7 @@ substitutions

    Sometimes it is necessary to mark a test case as "expected fail" or XFAIL. You can easily mark a test as XFAIL just by including XFAIL: on a line near the top of the file. This signals that the test case should succeed - if the test fails. Such test cases are counted separately by DejaGnu. To + if the test fails. Such test cases are counted separately by the testing tool. To specify an expected fail, use the XFAIL keyword in the comments of the test program followed by a colon and one or more regular expressions (separated by a comma). The regular expressions allow you to XFAIL the test conditionally by @@ -905,9 +906,10 @@ benchmarks, regression tests, code that is strange grammatically, etc. These organizations should be relatively self explanatory.

    Some tests are known to fail. Some are bugs that we have not fixed yet; -others are features that we haven't added yet (or may never add). In DejaGNU, -the result for such tests will be XFAIL (eXpected FAILure). In this way, you -can tell the difference between an expected and unexpected failure.

    +others are features that we haven't added yet (or may never add). In the +regression tests, the result for such tests will be XFAIL (eXpected FAILure). +In this way, you can tell the difference between an expected and unexpected +failure.

    The tests in the test suite have no such feature at this time. If the test passes, only warnings and other miscellaneous output will be generated. If @@ -1143,7 +1145,7 @@ example reports that can do fancy stuff.

    Valid HTML 4.01 - John T. Criswell, Reid Spencer, and Tanya Lattner
    + John T. Criswell, Daniel Dunbar, Reid Spencer, and Tanya Lattner
    The LLVM Compiler Infrastructure
    Last modified: $Date$