Address PR comments

This commit is contained in:
jonawals
2021-06-02 11:16:36 +01:00
parent 9be54d4e5b
commit 105eca52d7
3 changed files with 147 additions and 65 deletions
@@ -38,28 +38,16 @@ namespace TestImpact
//! Temporary workspace configuration.
struct Temp
{
//! Paths relative to root.
struct RelativePaths
{
RepoPath m_artifactDirectory; //!< Path to read and write runtime artifacts to and from.
};
RepoPath m_root; //!< Path to the temporary workspace (cleaned prior to use).
RelativePaths m_relativePaths;
RepoPath m_artifactDirectory; //!< Path to read and write runtime artifacts to and from.
};
//! Active persistent data workspace configuration.
struct Active
{
//! Paths relative to root.
struct RelativePaths
{
RepoPath m_sparTIAFile; //!< Path to the test impact analysis data.
RepoPath m_enumerationCacheDirectory; //!< Path to the test enumerations cache.
};
RepoPath m_root; //!< Path to the persistent workspace tracked by the repository.
RelativePaths m_relativePaths;
RepoPath m_sparTIAFile; //!< Path to the test impact analysis data.
RepoPath m_enumerationCacheDirectory; //!< Path to the test enumerations cache.
};
Temp m_temp;
@@ -101,8 +101,8 @@ namespace TestImpact
m_testEngine = AZStd::make_unique<TestEngine>(
m_config.m_repo.m_root,
m_config.m_target.m_outputDirectory,
m_config.m_workspace.m_active.m_relativePaths.m_enumerationCacheDirectory,
m_config.m_workspace.m_temp.m_relativePaths.m_artifactDirectory,
m_config.m_workspace.m_active.m_enumerationCacheDirectory,
m_config.m_workspace.m_temp.m_artifactDirectory,
m_config.m_testEngine.m_testRunner.m_binary,
m_config.m_testEngine.m_instrumentation.m_binary,
m_maxConcurrency);
@@ -110,7 +110,7 @@ namespace TestImpact
try
{
// Populate the dynamic dependency map with the existing source coverage data (if any)
const auto tiaDataRaw = ReadFileContents<Exception>(m_config.m_workspace.m_active.m_relativePaths.m_sparTIAFile);
const auto tiaDataRaw = ReadFileContents<Exception>(m_config.m_workspace.m_active.m_sparTIAFile);
const auto tiaData = DeserializeSourceCoveringTestsList(tiaDataRaw);
if (tiaData.GetNumSources())
{
@@ -136,7 +136,7 @@ namespace TestImpact
}
catch ([[maybe_unused]]const Exception& e)
{
AZ_Printf("No test impact analysis data found at %s", m_config.m_workspace.m_active.m_relativePaths.m_sparTIAFile.c_str());
AZ_Printf("No test impact analysis data found at %s", m_config.m_workspace.m_active.m_sparTIAFile.c_str());
}
}
@@ -233,7 +233,7 @@ namespace TestImpact
void Runtime::ClearDynamicDependencyMapAndRemoveExistingFile()
{
DeleteFile(m_config.m_workspace.m_active.m_relativePaths.m_sparTIAFile);
DeleteFile(m_config.m_workspace.m_active.m_sparTIAFile);
m_dynamicDependencyMap->ClearAllSourceCoverage();
}
@@ -247,7 +247,7 @@ namespace TestImpact
m_dynamicDependencyMap->ReplaceSourceCoverage(sourceCoverageTestsList);
const auto sparTIA = m_dynamicDependencyMap->ExportSourceCoverage();
const auto sparTIAData = SerializeSourceCoveringTestsList(sparTIA);
WriteFileContents<RuntimeException>(sparTIAData, m_config.m_workspace.m_active.m_relativePaths.m_sparTIAFile);
WriteFileContents<RuntimeException>(sparTIAData, m_config.m_workspace.m_active.m_sparTIAFile);
m_hasImpactAnalysisData = true;
}