1
0
Fork 0
Commit graph

155 commits

Author SHA1 Message Date
James Turner
4c0965e3c1 Some initial tests for route discontinuities.
Probably many more to add, but this is some basic testing at least of
inserting, querying and removing discontinuities.
2020-04-15 16:11:33 +01:00
Stuart Buchanan
b561cc8fac Unit tests for initial position (Main/positioninit.cxx)
Various unit tests for
- airports
- runways
- vor
- ndb
- fix
- lat/lon
- carrier
- offsets from the above (except carriers)
2020-04-12 21:46:50 +01:00
James Turner
c12824bc94 Basic Canvas tests, including image pixel ops 2020-03-11 17:14:38 +00:00
James Turner
3f14d53286 FlightPlans: fix save/load of restrictions, deleting legs from Nasal
- Fix Leg ownership to avoid segfaults when deleting them via Nasal
- Modify FP save/load code so restrictions and holds are correctly
  saved and restored

Extend the tests to cover these cases.
2020-03-10 14:00:40 +00:00
legoboyvdlp R
b920a09fcf Correct whitespace in NasalPositioned.cxx; fix segfault in NasalPositioned by adding null check in the legGhostGetMember method; add test case for segfault 2020-01-27 16:27:46 +00:00
Edward d'Auvergne
1a7783c358 TestSuite: Reactivation of the ENABLE_AUTOTESTING CMake variable.
This was accidentally disabled by 22de9d30b5.
2020-01-09 12:38:45 +01:00
Scott Giese
a9365cd34e Embedded Resources: Fix for Ninja 1.9
Refactor to break circular references.
New custom target generates the resource files.
FGFS and Test_Suite targets declare a dependency to the generated files.
2019-12-26 01:26:44 -06: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
4fb149eeb2 TestSuite: Support for running more of the tests via CTest. 2019-11-07 10:13:55 +01:00
James Turner
45fbdaa9c9 Starting tests for RNAV/procedures
One test so far, attempting to reproduce a bug I see with the 737.

Note these tests are skipped unless you have procedures available
and set a magic env var to find them.
2019-10-16 23:28:52 +01:00
James Turner
22de9d30b5 Make the test_suite happier under MSBuild/VS
Use the  CMake target as the command to invoke, so various things
get set automatically, and set the MSVCIDE_RUN_PATH so DLLs
are found correctly.
2019-09-26 13:00:23 +01:00
Edward d'Auvergne
3e834ebb65 TestSuite: Improved output formatting on MS Windows.
For some reason, this OS needs a few more newlines output than other OSes.
2019-09-26 12:34:25 +02:00
Edward d'Auvergne
0bb968543b TestSuite: Renamed the run_test_suite binary to fgfs_test_suite.
This is on James' suggestion.  The 'fgfs_test_suite' or 'fgfs_test_suite.exe'
binary file name is significantly more obvious as to its purpose.
2019-09-25 14:59:11 +02:00
Edward d'Auvergne
3d13c16973 TestSuite: CMake fix for variables missing from the parent scope.
The test suite CMake target variables have been shifted back into
test_suite/CMakeLists.txt.  These are now correctly constructed and placed into
the parent scope where the test_suite target now resides.
2019-09-25 10:38:19 +02:00
James Turner
847275e65a Tweaks to test helper APIs
Incorporate some feedback from Edward.
2019-09-24 11:39:56 +01:00
James Turner
36f88f6f07 Rename test globals to testGlobals [.cxx|.hxx] 2019-09-24 11:39:34 +01:00
James Turner
18c19885c6 Improvements to Nasal hold API
Ensure changes from Nasal are picked up by delegates (such as GPS) when
they are made. Add a route-manager test which sets and exits a hold
using Nasal.

As part of this, update the test API to make it easy to run Nasal from
a test.
2019-09-24 11:29:05 +01:00
James Turner
fafc9e3e64 Fix windows build, hopefully. 2019-09-23 23:14:32 +01:00
James Turner
5ce8a942bf RNAV / GPS hold support
The GPS/RNAV system can now fly holds, both left and right-handed.
The correct entry is selected, and hold count can be selected.
Also there's lots of lovely test cases.
2019-09-23 23:01:12 +01:00
Edward d'Auvergne
b9a4101f61 Merge branch 'test_suite/log_options/r4' into fg-next 2019-09-20 20:08:19 +02: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
James Turner
45df8f51b2 Move GPS sequencing into Nasal (optionally)
GPS now lets the delegate handle the sequencing behaviour, by
setting a new config property. The default GPS delegate (in Nasal)
now sets this property.

This requires a corresponding FGData update.
2019-09-20 13:05:57 +01:00
James Turner
833cc61293 GPS intercept tests 2019-09-20 09:50:55 +01:00
James Turner
19af6994fb GPS : Offset flight test 2019-09-19 17:27:13 +01:00
James Turner
05e99d3a3b More GPS sequencing tests
Also extended the test helpers in various ways.
2019-09-19 17:27:13 +01:00
James Turner
fdb2120b68 GPS: tests for long great-circle legs
Check that everything behaves as expected with legs spanning very
large distances.
2019-09-19 17:27:13 +01:00
James Turner
2434c037c8 Improve Leg mode course/track computation 2019-09-19 17:27:13 +01:00
James Turner
21e9f3d5e9 Disable KML logging in Route-manager test 2019-09-18 23:47:13 +01:00
James Turner
1c09704903 Fix tests until GPS course changes land 2019-09-18 23:42:39 +01:00
James Turner
a2e9374c54 GPS tests 2019-09-18 23:42:39 +01:00
James Turner
1c58de62ed Route-manager unit-tests
Also contains large extensions to the TestPilot helper
2019-09-18 23:42:39 +01:00
James Turner
604a23166b Working on Direct-to tests 2019-09-18 23:42:38 +01:00
James Turner
21a8e89a0a Basic flight-plan/leg tests for GPS 2019-09-18 23:42:38 +01:00
James Turner
e15d67e637 TestPilot helper in the test API
Use this in the GPS tests.
2019-09-18 23:40:36 +01:00
James Turner
24f4de4681 Initial GPS unit test coverage 2019-09-18 23:40:36 +01:00
Edward d'Auvergne
f6efeb3f34 Test Suite: Workaround for aberrant MS Windows CMake behaviour.
The add_custom_target() CMake function for the test_suite target has been
shifted from test_suite/CMakeLists.txt to the top level CMakeLists.txt file.
The variable setting CMake code required for this has also been shifted.  This
allows for the same build command 'cmake --build .  --target test_suite' to work
on all operating systems.
2019-09-17 21:50:52 +02:00
Edward d'Auvergne
827dfbc2b1 TestSuite: Added a testing category for FGData. 2019-09-13 11:55:09 +02:00
Edward d'Auvergne
42459c05d1 TestSuite: Activation of a few unit tests not being run as CTests. 2019-07-30 15:54:25 +02:00
James Turner
8428cd2a44 Revert "CommRadio: fix tuning 25Khz and 75Khz channels"
Revert this change - I will re-add the unit-tests again, but we need
a different approach for 8.3 stations, than what I did here.

This reverts commit 91cc83abb5.
2019-07-01 06:29:05 +01:00
James Turner
9f8b6f50f9 Fix navRadio tests for revised power supply paths 2019-06-27 15:46:09 +01:00
James Turner
91cc83abb5 CommRadio: fix tuning 25Khz and 75Khz channels
In 8.3 mode, ensure that 25 and 75Khz channels can be tuned using the
abbreviated syntax (eg 118.02 for 118.025). 

As part of this, add test coverage of the CommRadio for basic and 8.3-
mode operation.
2019-06-27 15:45:53 +01:00
Edward d'Auvergne
128c3f0c03 TestSuite: Allow the test_suite target to build again.
Previously it could only be built if the ALL target was built first.
2019-06-14 15:04:17 +02:00
James Turner
64eaf6fe03 Fix for route-path when leg 0 is not a runway
Avoid doing turn-computation for the first waypoint, even if it’s not
a runway. Add a unit-test to cover this case.

Reported by Josh Davidson
2019-03-26 22:50:46 +01:00
James Turner
12eac24039 Tests: NavRadio GS tests
Also includes false GS lobe tests
2018-12-10 17:44:09 +00:00
James Turner
a9475bd0fa Basic nav-radio ILS testing
Complex cases still to be added, but this tests the basic reception.
2018-12-04 09:39:36 +01:00
James Turner
c7b28a1960 UNit-tests for the NavRadio
Still needs ILS and GS tests, but starting to be useful already.
2018-11-25 13:12:50 +00:00
James Turner
1cbcae9795 Bugfix: fix range/ident priority of loaded wpts
When the lat-lon of a waypoint disagrees with the discovered ident by
more than a threshold, assume we have a DB mismatch, and just revert
to a basic wpt specified by lat-lon. This avoids inserting huge
legs by selecting a very distant navaid with matching ident

https://sourceforge.net/p/flightgear/codetickets/1814/
2018-10-08 16:40:25 +01:00
James Turner
69dbfc0a27 Core airway and flight-plan enhancements
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.
2018-08-28 12:23:01 +01:00
James Turner
e3d032942e Move aircraft-performance code into a public API
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.
2018-08-26 14:39:42 +01:00
Edward d'Auvergne
401a0dd22d TestSuite: Silence some warnings. 2018-07-26 15:52:07 +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
f8c2cb5284 TestSuite: Migration of the old Navaids tests to the CppUnit framework.
This test suffers from significant bit-rot (it is designed for operation prior
to the NavDataCache), so it is deactivated.
2018-07-26 15:52:07 +02:00
Edward d'Auvergne
02c3c6dc97 TestSuite: Migration of the old GPS tests to the CppUnit framework.
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.
2018-07-26 15:52:07 +02:00
Edward d'Auvergne
fff923d2f4 TestSuite: Migration of the HIDInput tests to the CppUnit framework.
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.
2018-07-26 15:52:07 +02:00
Edward d'Auvergne
8d0db45c51 TestSuite: Shifted the non-functional src/GUI/layout-test.cxx file to the attic. 2018-07-26 15:52:07 +02:00
Edward d'Auvergne
0ea357b04c TestSuite: Improved memory management for the event manager.
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.
2018-07-26 15:52:07 +02:00
Edward d'Auvergne
dbe7c90115 TestSuite: Shifted the YASim atmosphere test into the CppUnit framework. 2018-07-26 15:52:07 +02:00
Edward d'Auvergne
ba5b472705 TestSuite: Elimination of the now unused ENABLE_TESTS CMake variable. 2018-07-26 15:52:07 +02:00
Edward d'Auvergne
feb854946e TestSuite: Complete removal of FG_TESTLIB. 2018-07-26 15:52:07 +02:00
Edward d'Auvergne
77b1ec5928 TestSuite: Move of all ancient non-functional tests into test_suite/attic/. 2018-07-26 15:52:06 +02:00
Edward d'Auvergne
2aa8d8ccbf TestSuite: Activation of the runtime headless mode whenever globals are set up. 2018-07-26 15:52:06 +02:00
Edward d'Auvergne
99a50508a7 TestSuite: Spun out the NavDataCache initialisation code.
Not all tests will require the NavDataCache, so it is no longer set up with the
dummy globals data structure.
2018-07-26 15:52:06 +02:00
Edward d'Auvergne
b0c5a5481d TestSuite: Migration of the autosaveMigration tests into the CppUnit infrastructure. 2018-07-26 15:52:06 +02:00
Edward d'Auvergne
63d751c15e TestSuite: Always capture OSG logging.
The NotifyLogger class from src/Viewer/fg_os_osgviewer.cxx has been shifted into
a simgear header file so that it can be reused within the test suite.
2018-07-26 15:52:06 +02:00
Edward d'Auvergne
acb3307a1a TestSuite: Migration of the AeroMesh tests into the CppUnit infrastructure. 2018-07-26 15:52:06 +02:00
Edward d'Auvergne
7aa034bc80 TestSuite: Migration of the AeroElement tests into the CppUnit infrastructure. 2018-07-26 15:52:06 +02:00
Edward d'Auvergne
88179ec9c1 TestSuite: Implementation of FGTestApi.
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.
2018-07-26 15:52:06 +02:00
Edward d'Auvergne
112d64f828 TestSuite: Helper functions for setting up a dummy renderer and FGScenery. 2018-06-07 11:17:04 +02:00
Edward d'Auvergne
3c9d3590d4 TestSuite: Migration of the Navaids tests into the CppUnit infrastructure. 2018-06-06 20:39:25 +02:00
Edward d'Auvergne
a22c53a807 TestSuite: Temporary fix for CTests yet to be ported into the CppUnit framework. 2018-06-05 14:33:01 +02:00
Edward d'Auvergne
8eb4d76411 TestSuite: Fix for the summary and return status of the tests. 2018-05-07 12:41:22 +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
3b79530b06 CMake: Split the target links and includes into separate CMake modules. 2018-04-05 21:06:02 +02:00
Edward d'Auvergne
6a730b5820 CMake: The main sources/headers have been shifted into FG_{SOURCES,HEADERS}.
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.
2018-04-05 21:06:02 +02:00
Edward d'Auvergne
08386db6ff TestSuite: Comment rewording as the CMake file is no longer a copy from Main. 2018-04-05 21:06:02 +02:00
Edward d'Auvergne
93c4aab885 CMake: Shifted the MSVC grouping code into its own CMake module.
This is for simplifying the main src/Main/CMakeLists.txt file and allowing the
code to be shared with the test suite.
2018-04-05 21:05:54 +02:00
Edward d'Auvergne
f8e57f921d CMake: Shifted the FlightGear embedded resources code into its own CMake module.
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.
2018-04-05 21:05:30 +02:00
Edward d'Auvergne
bd3a3db50b CMake: Shifted the target setup code into its own CMake module.
This is for simplifying the main src/Main/CMakeLists.txt file and allowing the
code to be shared with the test suite.
2018-04-05 21:05:16 +02:00
Edward d'Auvergne
28a77ed1d9 TestSuite: Only include Qt components if FG_TESTLIB is not set.
This is a fix for abc4cdb4c0 that allows fgfs to
build, without having to expand the fgtestlib to include Qt GUI sources.
2018-03-29 17:19:13 +02:00
Florent Rougon
abc4cdb4c0 TestSuite: call flightgear::shutdownQtApp() from fgtest::shutdownTestGlobals()
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
2018-03-29 00:39:38 +02:00
Edward d'Auvergne
32d74493c4 TestSuite: The fatal exit() call has been removed from the globals setup.
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.
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
98debee29c TestSuite: Addition of the ENABLE_AUTOTESTING CMake option.
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.
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
2786b6b678 TestSuite: Better memory management for globals by using std::unique_ptr. 2018-03-23 17:26:05 +01:00
Edward d'Auvergne
0f96032487 TestSuite: Shift of the globals unit test helper functions into the test suite.
The setting of the SG log levels and developer mode has been removed as this
clashes with the output control set by the test suite main() function.
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
7616f1ec3e TestSuite: Migration of the posinit unit tests. 2018-03-23 17:26:05 +01:00
Edward d'Auvergne
85ad420be1 TestSuite: Migration of the Add-ons management unit tests. 2018-03-23 17:26:05 +01:00
Edward d'Auvergne
d51e21c667 TestSuite: Migration of the LaRCSim matrix computation unit tests. 2018-03-23 17:26:05 +01: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
e66db5ca3a TestSuite: Support for building the FlightGear bundled CppUnit library.
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.
2018-03-23 17:26:05 +01:00
Edward d'Auvergne
73a9927c22 TestSuite: Migration of the Flightplan tests into the CppUnit infrastructure. 2018-03-23 17:26:05 +01:00
Edward d'Auvergne
f6b1ddfac6 TestSuite: Windows support for the run_test_suite custom cmake target.
A custom add_custom_target() function is required to allow the test suite to be
executed by cmake under MS Windows.
2018-03-23 17:26:05 +01:00