Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 b9343a7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/unittest/test_authdatabase.cpp
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit b9343a7

Please sign in to comment.