mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-19 02:56:01 +01:00
fix(simulation): a test run that can't start ends with the error code and says why
- `--test` is looked for before the rest of the command line is read. An unknown option before it (e.g. `-s x.scn --test-timout 90 --test`) used to end the run with exit code 0, which a caller reads as a pass. - `--test-timeout` without a value, or with one that isn't a number of seconds, fails the run instead of leaving the default or, through atof, turning the timeout off. - These, a missing -s, a failed start and an exception caught in main() end the test through test_manager::conclude(), which writes the usual `test: error (exit code 5) ... : <reason>` line to stdout and the log. Before, `eu07 --test` alone exited with 5 and nothing anywhere: the error went to the log queue and the process ended before the log thread wrote it. In test mode main() now stops the log thread and waits for it before _Exit(). Outside the test mode nothing changes: conclude() does nothing there.
This commit is contained in:
@@ -46,8 +46,11 @@ public:
|
||||
void update(double Deltatime);
|
||||
// reported by a driver whose train went past a signal showing stop
|
||||
void signal_passed_at_danger(std::string_view Vehicle, std::string_view Signal);
|
||||
// ends the test with given result; the first call wins
|
||||
// ends the test with given result and closes the application; the first call wins
|
||||
void finish(test_result Result, std::string_view Reason);
|
||||
// ends the test with given result, without closing the application: for the ways out that close it anyway
|
||||
// (a bad command line, a failed start, an exception). returns false if the test had already ended
|
||||
bool conclude(test_result Result, std::string_view Reason);
|
||||
|
||||
bool finished() const { return m_finished; }
|
||||
// exit code of the process: the result, or error while the test hasn't finished
|
||||
|
||||
Reference in New Issue
Block a user