Add better airway support, fix various issues with VIA, and add
parsing / generation of ICAO route strings. Also fix the
serialisation of flight-plans with airway enroute segments, so these
can be restored correctly.
Upcoming flight-planning changes want to use the perf computation code
in route-path, so move it to a public class, and implement some of the
missing functionality, especially correct GS computation for altitude.
As this code has significant bit-rot and requires a lot of work to compile and
run again, it is currently deactivated.
The test also writes to the files "/Users/jmt/Desktop/airways.kml" and
"/Users/jmt/Desktop/procedures.kml" and would need to be modified to write to a
temporary directory and the file contents reread and checked by the test.
The extractBits(), signExtend(), and writeBits() functions of the anonymous
namespace in Input/FGHIDEventInput.cxx have been shifted out of the namespace
and are now exposed via the header. This is needed as
<Input/FGHIDEventInput.cxx> cannot be imported within the CppUnit
infrastructure, as it is already built into the run_test_suite binary.
In the initTestGlobals() helper function, the event manager is added to the subsystem manager (both
created by the FGGlobals ctor). This allows the event manager to be destroyed via the subsystem
manager in the FGGlobals dtor.
The test_suite/helpers directory has been renamed to test_suite/FGTestApi/ and
all the fgtest namespaces renamed to FGTestApi. The helper functions are now
also placed into either a setUp or tearDown namespace depending on their
function. And a new FGTestApi::PrivateAccessor::FDM namespace has been created
for holding friend classes used to access private or protected variables or
functions from solely within the test suite.
This allows the sources and headers in src/Main/ to be used by other targets.
They are grouped into the new "Main" flightgear component via the macro in the
FlightGearComponent CMake module. The bootstrap.cxx file with its main function
has been separated out into a separate variable MAIN_SOURCE for use by the fgfs
binary.
All these files have therefore been removed from the test_suite CMakeLists.txt
file, as they are added via FG_SOURCES and FG_HEADERS. The MSVC grouping code
also does not need to deal with the now deleted separate SOURCE and HEADER
variables for these files.
This is for simplifying the main src/Main/CMakeLists.txt file and allowing the
code to be shared with the test suite.
The generated source and header files have also been removed from the main
source list and placed in the CMake module as the global variables
EMBEDDED_RESOURCE_SOURCES and EMBEDDED_RESOURCE_HEADERS.
Some of the unit tests defined with the new test infrastructure[1]
initialize the QApplication; for these tests, it is necessary to ensure
that the QApplication instance is destroyed before exit() begins,
otherwise we get a segfault when run_test_suite terminates (see [2]).
In order to prevent this segfault from happening, call
flightgear::shutdownQtApp() unconditionally from
fgtest::shutdownTestGlobals() as long as Qt support is compiled in
(flightgear::shutdownQtApp() is safe to call even if the QApplication
hasn't been initialized).
[1] Currently, the three PosInitTests::* tests.
[2] https://bugreports.qt.io/browse/QTBUG-48709
The exceptions that occur after this call can be handled by CppUnit, but the
exit() results in the test suite silently exiting without restoring stdout and
stderr.
This allows for finer control of the test suite execution. The default of ON
will cause the test-suite to be executed after compiling the test_suite target.
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.
"""
The CppUnit source is built as a static library and linked to the run_test_suite
executable. The FlightGear CppUnit library is now build using CMake rather than
using the Autotools build system.
This required many time related include files, functions, and variables to be
tested for via CMake, and converted to macros via #cmakedefine, so that they
would be automatically set for the test-mktime.cxx file.
This old standalone test, from Curt back in 2001, was converted to the format
required for the CppUnit test suite. As most of simgear/math/sg_geodesy.hxx no
longer exists, the code was updated using SGGeod and SGGeoc. Hardcoded values
are used to permanently lock in the values currently calculated by simgear.
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.