Permalink
Browse files

Seed mapgen in tests for reproducibility (#27416)

Previously we were seeding the RNG before each test, but not before
mapgen, so some failures were not reproducible.
  • Loading branch information...
jbytheway authored and kevingranade committed Jan 5, 2019
1 parent c818148 commit 878805734e8f39404c88a8151ee67b769391efd0
Showing with 7 additions and 0 deletions.
  1. +7 −0 tests/test_main.cpp
@@ -254,6 +254,13 @@ int main( int argc, const char *argv[] )

setupDebug( DebugOutput::std_err );

// Set the seed for mapgen (the seed will also be reset before each test)
unsigned int seed = session.config().rngSeed();
if( seed ) {
srand( seed );
rng_set_engine_seed( seed );
}

try {
// TODO: Only init game if we're running tests that need it.
init_global_game_state( mods, option_overrides_for_test_suite );

0 comments on commit 8788057

Please sign in to comment.