Changeset 2228


Ignore:
Timestamp:
Mar 25, 2010, 1:28:14 PM (12 years ago)
Author:
Peter
Message:

Using the parallel-tests driver. All tests are now by default verbose,
but 'make check' is still silent and the output is collected in log
files. Please refer to test/README or the Automake manual for more
details.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r2227 r2228  
    4848
    4949AC_CONFIG_HEADERS([config.h])
    50 AM_INIT_AUTOMAKE([1.11 std-options color-tests])
     50AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests])
    5151
    5252dnl The empty help-string for --with-gsl-prefix and
  • trunk/test/README

    r2121 r2228  
    77========
    88
    9 Running all tests
     9Running the tests
    1010-----------------
    1111
    12   make check
     12  To run all tests:
    1313
     14    make check
     15
     16  To run only failed tests:
     17
     18    make recheck
     19
     20  To run only a subset of tests, use TESTS variable:
     21
     22    make check TESTS="first_test second_test"
     23
     24  To enable test output you can use the VERBOSE variable
     25
     26    make check VERBOSE=1
    1427
    1528Interpretation
     
    3144-----------------------------
    3245
    33   You can run a specific test directly. Add a '-v' flag to trigger verbosity
    34 
    35     ./program_test -v
    36 
    37   If you want to run the test suite in verbose mode, you can invoke
    38   make as follows:
    39 
    40     env VERBOSE=1 make -e check
    41 
    42   If you want to run only a subset of tests, you can invoke make as follows
    43 
    44     env TESTS="first_test second_test" make -e check
     46  You can run the test directly, `./foo_test'; it will be verbose. The
     47  verbose output is also available in `foo_test.log'. A summary log is
     48  created in the file `test-suite.log'.
    4549
    4650
     
    6973  test::Suite::return_value()). If the test should be skipped for some
    7074  reason it shall return 77.
    71 
    72   When a test is run without verbose flag, it should be silent also at
    73   failure. Achieve this behaviour by sending output through
    74   test::Suite class (see functions err() and out()).
    7575
    7676  When writing numerical tests, it is typically desired to allow for
  • trunk/test/Suite.cc

    r2121 r2228  
    3939
    4040  Suite::Suite(int argc, char* argv[])
    41     : dev_null_(NULL), known_issues_(0), ok_(true)
     41    : known_issues_(0), ok_(true)
    4242  {
    43     char* buffer=std::getenv("YAT_TEST_VERBOSE");
    44     if (buffer)
    45       std::cerr << "WARNING: environment variable `YAT_TEST_VERBOSE' "
    46                 << "is deprecated\n  use `VERBOSE' instead.\n";
    47     char* env_verbose=std::getenv("VERBOSE");
    48 
    49     if ( (argc>1 && argv[1]==std::string("-v")) ||
    50          (buffer && buffer == std::string("1")) ||
    51          env_verbose) {
    52       verbose_ = true;
    53       // synchronize cerr and cout, i.e., cout is flushed before
    54       // writing anything to cerr.
    55       std::cerr.tie(&std::cout);
    56     }
    57     else {
    58       verbose_ = false;
    59       dev_null_ = new std::ofstream("/dev/null");
    60       if (argc>1){
    61         std::stringstream ss(argv[0]);
    62         std::string prog;
    63         while(getline(ss, prog, '/'));
    64         if (prog.substr(0,3)=="lt-")
    65           prog = prog.substr(3);
    66         std::cout << prog << " -v : for printing extra information\n";
    67       }
    68     }
     43    // synchronize cerr and cout, i.e., cout is flushed before
     44    // writing anything to cerr.
     45    std::cerr.tie(&std::cout);
    6946  }
    7047
     
    7249  Suite::~Suite(void)
    7350  {
    74     if (dev_null_)
    75       delete dev_null_;
    7651  }
    7752
     
    9267  std::ostream& Suite::err(void) const
    9368  {
    94     if (verbose_)
    95       return std::cerr;
    96     return *dev_null_;
     69    return std::cerr;
    9770  }
    9871
     
    144117  std::ostream& Suite::out(void) const
    145118  {
    146     if (verbose_)
    147       return std::cout;
    148     return *dev_null_;
     119    return std::cout;
    149120  }
    150121
  • trunk/test/Suite.h

    r2202 r2228  
    155155
    156156  private:
    157     std::ofstream* dev_null_;
    158157    unsigned int known_issues_;
    159158    bool ok_;
    160     bool verbose_;
    161 
    162159  };
    163160
  • trunk/test/common_defs.sh.in

    r2225 r2228  
    4949
    5050me=$0
    51 
    52 while test $# -gt 0; do
    53     case "$1" in
    54     -v)
    55     VERBOSE=1
    56     ;;
    57     esac
    58     shift
    59 done
    60 
    61 if test -n "$YAT_TEST_VERBOSE"; then
    62   VERBOSE=YAT_TEST_VERBOSE;
    63   echo "WARNING: environment variable \`YAT_TEST_VERBOSE' is deprecated;";
    64   echo "  use \`VERBOSE' instead.";
    65 fi
    66 
    67 if test -z "$VERBOSE"; then
    68   exec > /dev/null 2>&1
    69 fi
    7051
    7152echo "=== Running $me ==="
     
    170151 
    171152# turn on shell traces when in verbose mode
    172 if test -n "$VERBOSE"; then
    173     set -x
    174 fi
     153set -x
  • trunk/test/documentation_test.sh.in

    r2202 r2228  
    2525have_doxygen="@have_doxygen@"
    2626
    27 while test $# -gt 0; do
    28     case "$1" in
    29     -v)
    30     VERBOSE=1
    31     ;;
    32     esac
    33     shift
    34 done
    35 
    36 if test -n "$YAT_TEST_VERBOSE"; then
    37   VERBOSE=YAT_TEST_VERBOSE;
    38   echo "WARNING: environment variable \`YAT_TEST_VERBOSE' is deprecated;";
    39   echo "  use \`VERBOSE' instead.";
    40 fi
    41 
    42 if test -z "$VERBOSE"; then
    43   exec > /dev/null 2>&1
    44 fi
    45 
    4627if test $have_doxygen = "no"; then
    4728    echo Skipped;
Note: See TracChangeset for help on using the changeset viewer.