Skip to content

Commit

Permalink
Move clear db cache step to initial test setup
Browse files Browse the repository at this point in the history
Seems to yield more consistent test times
  • Loading branch information
csciguy8 committed Sep 11, 2023
1 parent a6a353b commit b1f22d8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Source/CesiumRuntime/Private/Tests/CesiumLoadTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ struct TestPass {
std::function<void(SceneGenerationContext&)> verifyStep;
};

void clearCacheDb() {
std::shared_ptr<CesiumAsync::ICacheDatabase> pCacheDatabase =
getCacheDatabase();
pCacheDatabase->clearAll();
}

bool RunLoadTest(
const FString& testName,
std::function<void(SceneGenerationContext&)> locationSetup,
Expand All @@ -148,6 +154,7 @@ bool RunLoadTest(
// Halt tileset updates and reset them
gLoadTestContext.creationContext.setSuspendUpdate(true);
gLoadTestContext.creationContext.refreshTilesets();
clearCacheDb ();

//
// Start async commands
Expand All @@ -161,7 +168,7 @@ bool RunLoadTest(
const TestPass& pass = *it;

// Wait a bit
ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(1.0f));
ADD_LATENT_AUTOMATION_COMMAND(FWaitLatentCommand(2.0f));

// Do our timing capture
FString loggingName = testName + ":" + pass.name;
Expand All @@ -179,20 +186,14 @@ bool RunLoadTest(
return true;
}

void clearCacheDb(SceneGenerationContext& context) {
std::shared_ptr<CesiumAsync::ICacheDatabase> pCacheDatabase =
getCacheDatabase();
pCacheDatabase->clearAll();
}

void refreshTilesets(SceneGenerationContext& context) {
gLoadTestContext.playContext.refreshTilesets();
}

bool FCesiumLoadTestDenver::RunTest(const FString& Parameters) {

std::vector<TestPass> testPasses;
testPasses.push_back(TestPass{"Cold Cache", clearCacheDb, nullptr});
testPasses.push_back(TestPass{"Cold Cache", nullptr, nullptr});
testPasses.push_back(TestPass{"Warm Cache", refreshTilesets, nullptr});

return RunLoadTest(GetTestName(), setupForDenver, testPasses);
Expand All @@ -201,7 +202,7 @@ bool FCesiumLoadTestDenver::RunTest(const FString& Parameters) {
bool FCesiumLoadTestGoogleplex::RunTest(const FString& Parameters) {

std::vector<TestPass> testPasses;
testPasses.push_back(TestPass{"Cold Cache", clearCacheDb, nullptr});
testPasses.push_back(TestPass{"Cold Cache", nullptr, nullptr});
testPasses.push_back(TestPass{"Warm Cache", refreshTilesets, nullptr});

return RunLoadTest(GetTestName(), setupForGoogleTiles, testPasses);
Expand Down Expand Up @@ -248,7 +249,7 @@ bool FCesiumLoadTestMontrealPointCloud::RunTest(const FString& Parameters) {
};

std::vector<TestPass> testPasses;
testPasses.push_back(TestPass{"Cold Cache", clearCacheDb, nullptr});
testPasses.push_back(TestPass{"Cold Cache", nullptr, nullptr});
testPasses.push_back(TestPass{"Adjust", adjustCamera, verifyVisibleTiles});

return RunLoadTest(GetTestName(), setupForMontrealPointCloud, testPasses);
Expand Down

0 comments on commit b1f22d8

Please sign in to comment.