Fix failed archive tests on linux and remove trait

- Change the test Archive Folder name, Extract Folder Name, and File List file to be all lowercase to prevent the 'ResolvePath' function in LocalFileIO when executed to cause issues on case sensitive file systems (#6277)
- Fix memory corruption in profile builds on Linux when using AZ::IO::PathView by using AZ::IO::FixedMaxPath instead

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
This commit is contained in:
Steve Pham
2021-12-09 10:18:11 -08:00
committed by GitHub
parent a8a96d3e66
commit 8fd603cd50
3 changed files with 7 additions and 32 deletions
@@ -14,7 +14,6 @@
#define AZ_TRAIT_UNIT_TEST_DILLER_TRIGGER_EVENT_COUNT 100000
#define AZ_TRAIT_DISABLE_FAILED_ATOM_RPI_TESTS true
#define AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS true
#define AZ_TRAIT_DISABLE_FAILED_FRAMEPROFILER_TEST true
#define AZ_TRAIT_DISABLE_FAILED_FRAMEWORK_TESTS true
@@ -158,16 +158,16 @@ namespace AzToolsFramework
bool success = true;
AZStd::vector<char> fileBuffer;
const AZ::IO::Path workingPath{ dirToArchive };
const AZ::IO::FixedMaxPath workingPath{ dirToArchive };
for (const auto& fileName : foundFiles.GetValue())
{
bool thisSuccess = false;
AZ::IO::PathView relativePath = AZ::IO::PathView{ fileName }.LexicallyRelative(workingPath);
AZ::IO::FixedMaxPath relativePath = AZ::IO::FixedMaxPath{ fileName }.LexicallyRelative(workingPath);
AZ::IO::FixedMaxPath fullPath = (workingPath / relativePath);
AZ::IO::Path fullPath = (workingPath / relativePath);
if (ArchiveUtils::ReadFile(fullPath, AZ::IO::OpenMode::ModeRead, fileBuffer))
if (ArchiveUtils::ReadFile(static_cast<AZ::IO::PathView>(fullPath), AZ::IO::OpenMode::ModeRead, fileBuffer))
{
int result = archive->UpdateFile(
relativePath.Native(), fileBuffer.data(), fileBuffer.size(), s_compressionMethod,
@@ -69,12 +69,12 @@ namespace UnitTest
QString GetArchiveFolderName()
{
return "Archive";
return "archive";
}
QString GetExtractFolderName()
{
return "Extracted";
return "extracted";
}
void CreateArchiveFolder(QString archiveFolderName, QStringList fileList)
@@ -90,7 +90,7 @@ namespace UnitTest
QString CreateArchiveListTextFile()
{
QString listFilePath = QDir(m_tempDir.GetDirectory()).absoluteFilePath("FileList.txt");
QString listFilePath = QDir(m_tempDir.GetDirectory()).absoluteFilePath("filelist.txt");
QString textContent = CreateArchiveFileList().join("\n");
EXPECT_TRUE(CreateDummyFile(listFilePath, textContent));
return listFilePath;
@@ -151,11 +151,7 @@ namespace UnitTest
UnitTest::ScopedTemporaryDirectory m_tempDir;
};
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveComponentTest, DISABLED_CreateArchive_FilesAtThreeDepths_ArchiveCreated)
#else
TEST_F(ArchiveComponentTest, CreateArchive_FilesAtThreeDepths_ArchiveCreated)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{
EXPECT_TRUE(m_tempDir.IsValid());
CreateArchiveFolder();
@@ -167,11 +163,7 @@ namespace UnitTest
EXPECT_TRUE(createResult);
}
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveComponentTest, DISABLED_ListFilesInArchive_FilesAtThreeDepths_FilesFound)
#else
TEST_F(ArchiveComponentTest, ListFilesInArchive_FilesAtThreeDepths_FilesFound)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{
EXPECT_TRUE(m_tempDir.IsValid());
CreateArchiveFolder();
@@ -190,11 +182,7 @@ namespace UnitTest
EXPECT_EQ(fileList.size(), 6);
}
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveComponentTest, DISABLED_CreateDeltaCatalog_AssetsNotRegistered_Failure)
#else
TEST_F(ArchiveComponentTest, CreateDeltaCatalog_AssetsNotRegistered_Failure)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{
QStringList fileList = CreateArchiveFileList();
@@ -213,11 +201,7 @@ namespace UnitTest
EXPECT_EQ(catalogCreated, false);
}
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveComponentTest, DISABLED_AddFilesToArchive_FromListFile_Success)
#else
TEST_F(ArchiveComponentTest, AddFilesToArchive_FromListFile_Success)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{
QString listFile = CreateArchiveListTextFile();
CreateArchiveFolder(GetArchiveFolderName(), CreateArchiveFileList());
@@ -233,11 +217,7 @@ namespace UnitTest
EXPECT_TRUE(result);
}
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveComponentTest, DISABLED_ExtractArchive_AllFiles_Success)
#else
TEST_F(ArchiveComponentTest, ExtractArchive_AllFiles_Success)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{
CreateArchiveFolder();
AZ_TEST_START_TRACE_SUPPRESSION;
@@ -264,11 +244,7 @@ namespace UnitTest
}
}
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveComponentTest, DISABLED_CreateDeltaCatalog_ArchiveWithoutCatalogAssetsRegistered_Success)
#else
TEST_F(ArchiveComponentTest, CreateDeltaCatalog_ArchiveWithoutCatalogAssetsRegistered_Success)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{
QStringList fileList = CreateArchiveFileList();