1
0
Fork 0
Commit graph

22 commits

Author SHA1 Message Date
Julian Smith
3a754799c2 test_suite/testSuite.cxx: added example -u <unit-test-name>. 2021-03-07 21:57:50 +00:00
James Turner
5da15c3773 TestSuite: Fix include paths for logging 2020-09-08 11:37:13 +01:00
Edward d'Auvergne
04ee8c34a4 TestSuite: Execution of multiple tests or suites using comma separated lists.
This enables options such as '-u AeroElementTests,YASimAtmosphereTests'.  It
should help tracking down bugs whereby a test failure or error is triggered
solely due to a previous test.
2020-08-17 20:14:32 +02:00
Edward d'Auvergne
032f65e643 TestSuite: Documentation for the FG_ROOT environmental variable. 2020-05-02 14:18:43 +02:00
Edward d'Auvergne
85c889f13d TestSuite: FGData existence and version validation check prior to running tests.
This mimics the validation normally performed by Options::setupRoot().
2019-11-08 13:59:17 +01:00
Edward d'Auvergne
4f5b0c8291 TestSuite: Environmental variables support for controlling the test suite.
This includes the addition of FG_TEST_LOG_LEVEL, FG_TEST_LOG_CLASS,
FG_TEST_LOG_SPLIT, FG_TEST_TIMINGS, and FG_TEST_DEBUG.  These match the command
line option naming.
2019-09-20 19:45:33 +02:00
Edward d'Auvergne
c5dd4d3715 TestSuite: Simplification of the command line option processing.
Most of the code has been shifted into separate functions.  This will allow for
its reuse when environmental variable support is added.
2019-09-20 19:45:28 +02:00
Edward d'Auvergne
f9f201b830 TestSuite: Renamed the 'verbose' command line option to 'timings'.
This is to better reflect what the option does.  The -v or --verbose options are
now called -t or --timings respectively.
2019-09-20 19:42:57 +02:00
Edward d'Auvergne
aee367e8c2 TestSuite: Addition of the --log-class option for selecting SG_LOG classes.
This option mimics the fgfs option of the same name but additionally supports
the "particles", "headless", "osg", "undefined", and "all" classes.
2019-09-20 19:41:51 +02:00
Edward d'Auvergne
b58a63543e TestSuite: Implementation of the --log-split command line option. 2019-09-20 19:37:29 +02:00
Edward d'Auvergne
8b777a74c9 TestSuite: Addition of the --log-level option for setting the logging priority.
This option mimics the fgfs option of the same name.  However for the test suite
option, additionally the SG_POPUP, SG_DEV_WARN and SG_DEV_ALERT priorities are
supported.

The default test suite output has been modified to only show the interleaved log
with the logging priority set to the command line supplied value or defaulting
to SG_INFO.
2019-09-20 19:36:48 +02:00
Edward d'Auvergne
d448b8ceb4 TestSuite: Command line option processing simplification by using std::string. 2019-09-20 19:36:22 +02:00
Edward d'Auvergne
827dfbc2b1 TestSuite: Added a testing category for FGData. 2019-09-13 11:55:09 +02:00
Edward d'Auvergne
688f0b5ea0 TestSuite: Minor output formatting changes and disabling of the GUI tests.
The GUI tests are disabled as there are no such tests yet.
2018-07-26 15:52:07 +02:00
Edward d'Auvergne
ab36c9760d TestSuite: Command line option for disabling the summary printout. 2018-07-26 15:52:07 +02:00
Edward d'Auvergne
9583e2d7ad TestSuite: Addition of a test data store singleton.
This is for currently for storing the path to FGData for use in any tests
requiring it.
2018-04-13 10:17:30 +02:00
Edward d'Auvergne
0030f655e0 TestSuite: Added a debugging command line option.
This is to enable full output from passing tests to help with debugging.
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
f8e6295272 TestSuite: CTest support for running each test suite as a separate ctest.
The --ctest command line option has also been added to allow for a simplified
output from the test suite more suitable for the ctest verbose output.
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
d63211409c TestSuite: Addition of command line options for fine control of the executable.
This includes the following help message detailing all of the new options:

"""
Usage: run_test_suite [options]

Options:
  -h, --help            show this help message and exit.

  Test selection options:
    -s, --system-tests  execute the system/functional tests.
    -u, --unit-tests    execute the unit tests.
    -g, --gui-tests     execute the GUI tests.
    -m, --simgear-tests execute the simgear tests.

    The -s, -u, -g, and -m options accept an optional argument to perform a
    subset of all tests.  This argument should either be the name of a test
    suite or the full name of an individual test.

    Full test names consist of the test suite name, the separator '::' and then
    the individual test name.  The test names can revealed with the verbose
    option.

  Verbosity options:
    -v, --verbose       verbose output including names and timings for all
                        tests.
"""
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
3bd60e96c8 TestSuite: Capture and reporting of all simgear logstream priorities.
Each of the global logstream priorities are captured into its own
std::ostringstream stream, all held together in the test suite global _iostreams
class instance.  This object can be obtained by calling getIOstreams().  The
streams are captured using the StreamLogCallback class, which is a simple
modification of the simgear FileLogCallback class, registered with the global
logstream's addCallback() function.

When tests fail, all of contents the different simgear logstreams are now
reported.  The failure report consists of the following sections:

  - Failure information.
  - SG_BULK simgear logstream (all messages).
  - SG_BULK only simgear logstream.
  - SG_DEBUG only simgear logstream.
  - SG_INFO only simgear logstream.
  - SG_WARN only simgear logstream.
  - SG_ALERT only simgear logstream.
  - Combined STDOUT and STDERR streams.

Any empty sections, except for SG_BULK, will not be shown.
2018-03-23 17:26:04 +01:00
Edward d'Auvergne
e88b6543b0 TestSuite: Custom output formatting.
A large number of improvements have been made by subclassing the CppUnit classes
and overriding the base functions, including CompilerOutputter, TestListener,
and TextTestRunner.  All IO has also been captured by the test runner.

The result is that during the test suite run, only the characters '.', 'F', and
'E' are output for a pass, failure and error state.  At the end of each test
suite category, all failures and errors are reported in full detail, including
the different captured IO streams.  A final synopsis is printed out, improving
the overview in the case of too many tests failing.

For the fgCompilerOutputter class, the printSuccess(), printFailureReport(),
printFailureDetail(), and printSuiteStats() functions have been replaced to
implement the above printout design.  The class also stores the std::vector of
TestIOCapt structures for the final printouts.

The fgTestListener class handles the events from the running of the test suite.
The startTest() and endTest() functions are used for IO capture.  The IO is
placed into a TestIOCapt data structure, with one std::string for holding the
combined STDOUT and STDERR IO, and another for the SG_LOG IO.  If failures
occur, the TestIOCapt structure is appended to the fgCompilerOutputter vector.
The startTest() and endTest() functions are also used for starting and stopping
a timer to allow the full test suite to be timed.  And the addFailure() function
simply registers test failures or errors.

The fgTestRunner class overrides the CppUnit::TextTestRunner::run() function,
simply to prevent the base method from spawning a second test listener, causing
the test output to be duplicated.

Some auxiliary formatting functions have been added to print out titles,
sections, and synopsis summary lines.
2018-03-23 17:26:04 +01:00
Edward d'Auvergne
8b438cb97e TestSuite: Initial support for a FlightGear test suite based on CppUnit.
This includes the basic CMake infrastructure for building and executing the test
suite.  Four test categories have been added - unit, system/functional, GUI, and
simgear unit tests.  The test suite is run by typing 'make test_suite'.

All of the fgfs sources are included in the new run_test_suite executable,
excluding the bootstrap routine and its main() function.  The test suite
currently consists of a single dummy unit test for the NasalSys subsystem, and a
single demonstration simgear/props unit test.
2018-03-23 17:26:04 +01:00