18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-19 19:14:59 +01:00

feat(simulation): the pass and the standstill wait for the train under test only

Both waited for every vehicle of the scenery to stand still, so on a scenery
with AI traffic a test could pass only when the traffic happened to stand too,
and the standstill end hardly ever came.

A test scenery names the train under test with test.vehicle <name> in its
config block (once for each train, if several): the pass and the standstill wait
for the consists of these vehicles as they are at the moment, so a train the
tested one couples to counts with it. A name the scenery doesn't have ends the
test with the error code. Without test.vehicle every vehicle counts, as before.
A signal passed at danger counts for every train either way.

run.py puts the case's lead vehicle into test.vehicle. test_mode_standstill_traffic
has the train under test standing on track 2 of Stacja1 while AI traffic leaves
track 1 on the timetable: it ends on its 100 s standstill, where counting every
vehicle runs into the 300 s timeout. Physicslogs of the other trains of a case
(<something>_<vehicle>) are moved out of the game dir too.
This commit is contained in:
jerrrrycho
2026-11-08 11:39:52 +01:00
parent 03a417c7b0
commit e5aafd154f
12 changed files with 120 additions and 30 deletions

View File

@@ -477,6 +477,17 @@ bool global_settings::ConfigParseTest(cParser& Parser, std::string_view const To
return true;
}
if (Token == "test.vehicle")
{
// a vehicle of a train under test, by its name in the scenery; the pass and the standstill wait for its
// consist only, not for other trains (eu07/maszyna#541). given more than once, for each of them
std::string name;
ParseOne(Parser, name, 1, true);
if (false == name.empty() && std::ranges::find(test.vehicles, name) == test.vehicles.end())
test.vehicles.emplace_back(name);
return true;
}
if (Token == "test.standstill")
{
ParseOne(Parser, test.standstill);
@@ -1802,6 +1813,9 @@ global_settings::export_as_text( std::ostream &Output ) const {
export_as_text( Output, "test.pass_on_standstill", test.pass_on_standstill );
export_as_text( Output, "test.fail_if_stop_overran", test.fail_if_stop_overran );
export_as_text( Output, "test.no_movement_before_pass", test.no_movement_before_pass );
for( auto const &vehicle : test.vehicles ) {
export_as_text( Output, "test.vehicle", vehicle );
}
export_as_text( Output, "gfx.envmap.enabled", gfx_envmap_enabled );
export_as_text( Output, "gfx.postfx.motionblur.enabled", gfx_postfx_motionblur_enabled );
export_as_text( Output, "gfx.postfx.motionblur.shutter", gfx_postfx_motionblur_shutter );

View File

@@ -91,10 +91,11 @@ struct global_settings {
struct test_settings {
bool enabled{ false };
double timeout{ 3600.0 }; // [s] of simulation time; no result by then fails the test
double standstill{ 300.0 }; // [s] every vehicle standing still this long ends the test; 0 = never
double standstill{ 300.0 }; // [s] the tested trains standing still this long ends the test; 0 = never
bool pass_on_standstill{ false }; // the standstill end passes the test instead of failing it
bool fail_if_stop_overran{ true }; // a train passing a signal at stop ends the test as failed; with false it's only logged
bool no_movement_before_pass{ true }; // a pass waits until every vehicle stands still; with false it ends the test at once
bool no_movement_before_pass{ true }; // a pass waits until the tested trains stand still; with false it ends the test at once
std::vector<std::string> vehicles; // test.vehicle: the trains under test are the consists of these; none = every vehicle
bool timeout_from_command_line{ false }; // --test-timeout given, the scenery doesn't override it
std::optional<double> wall_timeout; // [s] of real time since the start; none = test.timeout + time for the loading, 0 = no limit
bool wall_timeout_from_command_line{ false }; // --test-wall-timeout given, the scenery doesn't override it