1
0
Fork 0
Commit graph

14863 commits

Author SHA1 Message Date
Florent Rougon
692ab6835f terrasync.py: more thorough checking of .dirindex contents
- only accept ASCII-encoded .dirindex files (this is guaranteed to work
  fine "everywhere");

- reject .dirindex files with a 'path' entry that contains a backslash
  or starts with a slash;

- reject .dirindex files with a 'path' entry that contains a '..'
  component;

- reject .dirindex files with an 'f', 'd' or 't' entry whose name field
  contains a slash or a backslash;

- reject .dirindex files with an 'f', 'd' or 't' entry whose name field
  is '..';

- add comment lines (starting with '#') in the sample good .dirindex
  file used by unit tests.
2020-10-03 14:18:29 +02:00
Bertrand Coconnier
4049acd84e Bump the protocol version because Chris Speck's changes broke the backward compatibility. 2020-10-02 21:30:54 +02:00
Florent Rougon
2a991c9874 terrasync.py: test_virtual_path.py can't be run directly
Remove the 'if __name__ == "__main__": unittest.main()'. Indeed, the
module can't be run this way due to its imports. Tests from this module
can be run with:

  cd scripts/python/TerraSync
  python3 -m unittest tests.test_virtual_path
2020-10-02 16:38:08 +02:00
Florent Rougon
13f943b4a1 terrasync.py: rename DirIndex attributes and remove accessors
In Python, common usage is not to define accessors, but to directly use
class or instance attributes (especially when the associated data is
constant after instance creation). If it later happens that a given
attribute needs getter or setter logic, this can always be done via the
@property decorator, and doesn't affect calling code at all. See for
instance:

  https://docs.python.org/3/library/functions.html#property
  https://mail.python.org/pipermail/tutor/2012-December/thread.html#92990

Apply this to the DirIndex class and rename the following attributes for
better readability: f -> files, d -> directories, t -> tarballs.
2020-10-02 16:38:08 +02:00
Florent Rougon
477d9f7a9a terrasync.py: move the DirIndex class to its own module and add unit tests
The tests can be run from directory 'scripts/python/TerraSync' using:

  python3 -m unittest tests.test_dirindex

(or just 'python3 -m unittest' to run all tests pertaining to
terrasync.py).
2020-10-02 16:38:08 +02:00
Scott Giese
431844138b python compatibility: make __ne__ explicit.
python3 has a default implementation for __ne__ when __eq__ is defined.  The opposite is not true -- having only __ne__ does not have a default __eq__ implementation.
Also note that there are cases when eq/ne will both be True or both False, therefore, developers are encouraged to explicitly define these methods in pairs.
2020-10-01 23:06:37 -05:00
Scott Giese
22e9d0e2f1 python: use a with-statement to manage file close 2020-10-01 22:51:31 -05:00
Florent Rougon
7714abd56e terrasync.py: fix a DeprecationWarning
Using or importing the ABCs from 'collections' instead of from
'collections.abc' is deprecated since Python 3.3, and in 3.9 it will
stop working.
2020-10-01 19:44:19 +02:00
Florent Rougon
8985626ad5 Fix LaRCsim build errors
The previous commit (88c2b7a83) used '#if ENABLE_UIUC_MODEL' instead of
'#ifdef ENABLE_UIUC_MODEL' in a few places, causing a build error.
2020-09-30 16:45:11 +02:00
Erik Hofman
88c2b7a833 Make LaRCsim work again when UIUC is dissabled. Unfortunately only the c172 seems to be stable. The Navion and Cherokee fail to trim at the runway. 2020-09-30 15:39:30 +02:00
Florent Rougon
b1b12a924f Simplify NavDataCache::NavDataCachePrivate::findDatFiles()
- Use a range-based for loop instead of an iterator.

- Don't bother checking if the previously-visited directory was the
  same: the potential saving that the previous code was hoping should be
  null because FGGlobals::append_fg_scenery() doesn't add a path to
  FGGlobals::fg_scenery if it's already there---this assumes that all
  paths added to FGGlobals::fg_scenery go through
  FGGlobals::append_fg_scenery(), of course.

This should have no effect on FG's behavior.
2020-09-30 11:09:44 +02:00
James Turner
329d3cdd13 PLIB includes fix from Florent 2020-09-29 12:30:34 +01:00
Erik Hofman
56d4662468 Next big step: proper ground reactions. Also make it possible to run fgfs --aircraft=aisim --aero=<aircraft> for different aircraft configurations (which requires an upcoming update to FGData 2020-09-25 13:19:10 +02:00
James Turner
5329c4024b Sentry experiment: record warnings/alerts
This means that when a crash/exception occurs, we can see the preceding
warnings and alerts. Not sure if this will really help, so giving it
a test.
2020-09-18 10:34:40 +01:00
James Turner
d56e3857b6 Fix sentry setting of dist
Was missing header and string conversion, oops.
2020-09-18 10:14:23 +01:00
James Turner
3b5b301e98 Launcher: Disable Qt 5.15 QML warnings 2020-09-17 21:45:39 +01:00
James Turner
aea0a1a12a Sentry: set dist (build) data 2020-09-17 21:45:39 +01:00
James Turner
42b09ab948 Packaging: add AppStream metainfo
File by Corentin Noël, with some CMake machinery changes by me to
generate the version / data automatically.
2020-09-17 21:44:12 +01:00
James Turner
3a69e20248 Reduce the default log-level for the launcher. 2020-09-14 11:05:46 +01:00
James Turner
cae06a79b7 Attempt to fix crash-on-exit seen for Windows
Can’t reproduce this crash but it’s happening for some users on Windows,
so this should either fix it, or make the problem more obvious. Let’s
see.

https://sentry.io/organizations/flightgear/issues/1890563449
2020-09-14 11:05:46 +01:00
Erik Hofman
f2a96eaa6c Stabilize the forces and moments, clean up the code some more 2020-09-10 11:41:06 +02:00
James Turner
4fc0948dbf Fix Windows compilation 2020-09-08 21:51:57 +01:00
James Turner
e26a2ecab0 Crash:harden against malformed menu bar entries
If a menu-bar item is missing a <name>, we can end up building a string
from nullptr, which is a SEGV.

Reported as Sentry issue FLIGHTGEAR-1D

Will back-port to LTS once verified.
2020-09-08 14:01:39 +01:00
James Turner
830a890eff Tests: skeleton ViewManager/Views tests 2020-09-08 12:31:42 +01:00
James Turner
5da15c3773 TestSuite: Fix include paths for logging 2020-09-08 11:37:13 +01:00
James Turner
1fe82206a0 Make view subscripting more robust
Trying to fix a crash raised by Sentry
2020-09-08 11:23:14 +01:00
James Turner
395a3e70e9 Logging: use new MANDATORY_INFO level.
Requires corresponding SG commit.
2020-09-08 10:59:29 +01:00
Erik Hofman
abb8ce0120 AISim: Implement a JSON configuration file reader, fix gear positions and engine thrust calculation. 2020-09-07 11:48:38 +02:00
James Turner
e46c6f587b AIFlightPlan: remove ‘erase’ option from Decrement
Thankfully, the erase option to DecrementWaypoint was never used, so
remove it, since it’s … mental.
2020-09-05 11:16:36 +01:00
James Turner
02cfaeabba Tests: AIFlightPlan Increment/Decrement
Capture the current behaviour of Increment/DecrementWaypoint in
AI flightplans, prior to making some simplifications. Especially try
to test the behaviour of the ‘increment and erase’ logic.
2020-09-05 11:14:00 +01:00
James Turner
f802e09c57 ASan: QtMessageContext doesn’t copy file names
Use the ‘file name copying’ version of log(), to avoid an ASan use-
after-free. Note this requires SG change 
 908496d43dd7c3a7ca1de42b0e0c21aa0498c7df
to work correctly.
2020-09-05 10:44:43 +01:00
Slawek Mikula
c9d1d58146 [Launcher] #2316 - fixed sorting in the aircraft grid/listview.
When there are installed the same aircrafts from different sources 
(fgdata + fgaddon + git) with identical descriptions, use the URI to
provide stable sorting.
2020-09-05 10:44:43 +01:00
James Turner
f5b5828bd0 AIFlightPlan: add test for XML parsing
This meant some slight refactoring to expose some easier APIs for
testing, but the normal methods should be unaffected.
2020-09-05 10:44:43 +01:00
James Turner
3a3ff07883 Start testing FGAIFlightPlan 2020-09-05 10:44:43 +01:00
Erik Hofman
0272a4fa3f Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2020-09-04 16:03:39 +02:00
Erik Hofman
a95aaab0f4 use in-place declarations and clean up the code a bit 2020-09-04 16:03:04 +02:00
James Turner
2147eb8da9 Missed fixes from previous Yasim commit. 2020-09-04 13:05:11 +01:00
James Turner
d2fb16e071 Fix mismatched new/strdup/delete[] froub by ASan
See: https://sourceforge.net/p/flightgear/codetickets/2367/ for the
issue. Switch to using std::string instead of char*, and hence any
need to manually free the memory.
2020-09-04 12:41:56 +01:00
James Turner
4402d7b81d NavCache: only remove if the file exists.
Otherwise we block trying to re-create the cache, which is dumb. This
showed up as Sentry issue:
https://sentry.io/organizations/flightgear/issues/1875854826

Will back-port to 2020.2 once verified.
2020-09-04 12:29:45 +01:00
James Turner
1fd5502e9b Nasal removecommand: use a return value
Change removecommand() to indicate success or failure via a return
value: 1 for success, 0 for failure.
2020-09-04 10:56:41 +01:00
Erik Hofman
c6cb845f90 Merge branch 'next' of ssh://git.code.sf.net/p/flightgear/flightgear into next 2020-09-04 11:45:33 +02:00
Erik Hofman
6bd87586b0 Fix stability: CL and CD must be negative 2020-09-04 11:44:37 +02:00
Erik Hofman
e8fe8345bf Start using or own types for vectors and matrices for sharter and more readable code. Fix some sign issues 2020-09-04 10:58:18 +02:00
James Turner
9090d91be3 Fix a missed pu.h rename. 2020-09-03 20:25:14 +01:00
James Turner
22bad9db33 Fix for CMake/system libSGM issue: consistent path
Our copy of libGSM, and a system-wide version have different include
suffixes, so adjust the FindGsm.cmake so that the returned include-path
is consistent with our internal version.

See discussion in:https://sourceforge.net/p/flightgear/codetickets/2368/
2020-09-03 19:18:57 +01:00
James Turner
1f6b43c38f More AI tests 2020-09-03 17:51:40 +01:00
James Turner
61c6cfb050 AIAircraft: fix type of non-Swift aircraft 2020-09-03 17:51:40 +01:00
James Turner
d1fc4b58cb Start creating tests of AIModel code
First test just creates the manager, and ensures the user aircraft
updates in sync with the real aircraft.
2020-09-03 17:51:40 +01:00
Erik Hofman
ce1e85f656 Get the AISim FDM in a semi-flyable state 2020-09-03 14:39:38 +02:00
Erik Hofman
bdc66d5535 Rename our own version of pu.h to FlightGear_pu.h per James advice. Remove inclusion of pu.h where it isn't requirted. 2020-09-03 12:56:01 +02:00