Skip to content
Permalink
Browse files

Fix temporary path crash in TestAuthDatabase (#7753)

The constructor of TestAuthDatabase was called immediately, at a time when the settings weren't initialized properly yet.
  • Loading branch information...
SmallJoker committed Sep 28, 2018
1 parent ce2d33e commit b9343a7da4b02f48ed298c5d352f4fbcda585822
Showing with 4 additions and 7 deletions.
  1. +4 −7 src/unittest/test_authdatabase.cpp
@@ -90,12 +90,7 @@ class SQLite3Provider : public AuthDatabaseProvider
class TestAuthDatabase : public TestBase
{
public:
TestAuthDatabase()
{
TestManager::registerTestModule(this);
// fixed directory, for persistence
test_dir = getTestTempDirectory();
}
TestAuthDatabase() { TestManager::registerTestModule(this); }
const char *getName() { return "TestAuthDatabase"; }

void runTests(IGameDef *gamedef);
@@ -112,14 +107,16 @@ class TestAuthDatabase : public TestBase
void testDelete();

private:
std::string test_dir;
AuthDatabaseProvider *auth_provider;
};

static TestAuthDatabase g_test_instance;

void TestAuthDatabase::runTests(IGameDef *gamedef)
{
// fixed directory, for persistence
thread_local const std::string test_dir = getTestTempDirectory();

// Each set of tests is run twice for each database type:
// one where we reuse the same AuthDatabase object (to test local caching),
// and one where we create a new AuthDatabase object for each call

0 comments on commit b9343a7

Please sign in to comment.
You can’t perform that action at this time.