Fix tests in Linux and discover path comparison problem in Windows (fixed)

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago
parent 4a5ac0e204
commit ae46eea1e8

@ -7,9 +7,9 @@
*/ */
#include <AZTestShared/Utils/Utils.h> #include <AZTestShared/Utils/Utils.h>
#include "AzCore/Component/Entity.h" #include <AzCore/Component/Entity.h>
#include "AzCore/Asset/AssetManager.h" #include <AzCore/Asset/AssetManager.h>
#include "AzCore/Slice/SliceComponent.h" #include <AzCore/Slice/SliceComponent.h>
namespace UnitTest namespace UnitTest
{ {

@ -279,14 +279,11 @@ namespace AZ
return SystemFile::Exists(resolvedPath); return SystemFile::Exists(resolvedPath);
} }
void LocalFileIO::CheckInvalidWrite(const char* path) void LocalFileIO::CheckInvalidWrite([[maybe_unused]] const char* path)
{ {
(void)path;
#if defined(AZ_ENABLE_TRACING) #if defined(AZ_ENABLE_TRACING)
const char* assetsAlias = GetAlias("@assets@"); const char* assetsAlias = GetAlias("@assets@");
if (path && assetsAlias && AZ::IO::PathView(path).IsRelativeTo(assetsAlias))
if (((path) && (assetsAlias) && (azstrnicmp(path, assetsAlias, strlen(assetsAlias)) == 0)))
{ {
AZ_Error("FileIO", false, "You may not alter data inside the asset cache. Please check the call stack and consider writing into the source asset folder instead.\n" AZ_Error("FileIO", false, "You may not alter data inside the asset cache. Please check the call stack and consider writing into the source asset folder instead.\n"
"Attempted write location: %s", path); "Attempted write location: %s", path);

@ -24,6 +24,7 @@
#include <QStandardPaths> #include <QStandardPaths>
#include <QTemporaryDir> #include <QTemporaryDir>
#include <QTextStream> #include <QTextStream>
#include <Utils/Utils.h>
namespace UnitTest namespace UnitTest
{ {
@ -73,7 +74,7 @@ namespace UnitTest
void CreateArchiveFolder( QString archiveFolderName, QStringList fileList ) void CreateArchiveFolder( QString archiveFolderName, QStringList fileList )
{ {
QDir tempPath = QDir(m_tempDir.path()).filePath(archiveFolderName); QDir tempPath = QDir(m_tempDir.GetDirectory()).filePath(archiveFolderName);
for (const auto& thisFile : fileList) for (const auto& thisFile : fileList)
{ {
@ -89,12 +90,12 @@ namespace UnitTest
QString GetArchivePath() QString GetArchivePath()
{ {
return QDir(m_tempDir.path()).filePath("TestArchive.pak"); return QDir(m_tempDir.GetDirectory()).filePath("TestArchive.pak");
} }
QString GetArchiveFolder() QString GetArchiveFolder()
{ {
return QDir(m_tempDir.path()).filePath(GetArchiveFolderName()); return QDir(m_tempDir.GetDirectory()).filePath(GetArchiveFolderName());
} }
bool CreateArchive() bool CreateArchive()
@ -115,7 +116,7 @@ namespace UnitTest
if (auto fileIoBase = AZ::IO::FileIOBase::GetInstance(); fileIoBase != nullptr) if (auto fileIoBase = AZ::IO::FileIOBase::GetInstance(); fileIoBase != nullptr)
{ {
fileIoBase->SetAlias("@assets@", m_tempDir.path().toUtf8().data()); fileIoBase->SetAlias("@assets@", m_tempDir.GetDirectory());
} }
} }
@ -126,16 +127,12 @@ namespace UnitTest
} }
AZStd::unique_ptr<ToolsTestApplication> m_app; AZStd::unique_ptr<ToolsTestApplication> m_app;
QTemporaryDir m_tempDir {QDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation)).filePath("ArchiveTests-")}; UnitTest::ScopedTemporaryDirectory m_tempDir;
}; };
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveTest, DISABLED_CreateArchiveBlocking_FilesAtThreeDepths_ArchiveCreated)
#else
TEST_F(ArchiveTest, CreateArchiveBlocking_FilesAtThreeDepths_ArchiveCreated) TEST_F(ArchiveTest, CreateArchiveBlocking_FilesAtThreeDepths_ArchiveCreated)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{ {
EXPECT_TRUE(m_tempDir.isValid()); EXPECT_TRUE(m_tempDir.IsValid());
CreateArchiveFolder(); CreateArchiveFolder();
bool createResult = CreateArchive(); bool createResult = CreateArchive();
@ -143,13 +140,9 @@ namespace UnitTest
EXPECT_EQ(createResult, true); EXPECT_EQ(createResult, true);
} }
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveTest, DISABLED_ListFilesInArchiveBlocking_FilesAtThreeDepths_FilesFound)
#else
TEST_F(ArchiveTest, ListFilesInArchiveBlocking_FilesAtThreeDepths_FilesFound) TEST_F(ArchiveTest, ListFilesInArchiveBlocking_FilesAtThreeDepths_FilesFound)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{ {
EXPECT_TRUE(m_tempDir.isValid()); EXPECT_TRUE(m_tempDir.IsValid());
CreateArchiveFolder(); CreateArchiveFolder();
EXPECT_EQ(CreateArchive(), true); EXPECT_EQ(CreateArchive(), true);
@ -161,11 +154,7 @@ namespace UnitTest
EXPECT_EQ(fileList.size(), 6); EXPECT_EQ(fileList.size(), 6);
} }
#if AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
TEST_F(ArchiveTest, DISABLED_CreateDeltaCatalog_AssetsNotRegistered_Failure)
#else
TEST_F(ArchiveTest, CreateDeltaCatalog_AssetsNotRegistered_Failure) TEST_F(ArchiveTest, CreateDeltaCatalog_AssetsNotRegistered_Failure)
#endif // AZ_TRAIT_DISABLE_FAILED_ARCHIVE_TESTS
{ {
QStringList fileList = CreateArchiveFileList(); QStringList fileList = CreateArchiveFileList();
@ -209,7 +198,9 @@ namespace UnitTest
} }
bool catalogCreated{ false }; bool catalogCreated{ false };
AZ_TEST_START_TRACE_SUPPRESSION;
AzToolsFramework::AssetBundleCommandsBus::BroadcastResult(catalogCreated, &AzToolsFramework::AssetBundleCommandsBus::Events::CreateDeltaCatalog, GetArchivePath().toStdString().c_str(), true); AzToolsFramework::AssetBundleCommandsBus::BroadcastResult(catalogCreated, &AzToolsFramework::AssetBundleCommandsBus::Events::CreateDeltaCatalog, GetArchivePath().toStdString().c_str(), true);
AZ_TEST_STOP_TRACE_SUPPRESSION_NO_COUNT; // produces different counts in different platforms
EXPECT_EQ(catalogCreated, true); EXPECT_EQ(catalogCreated, true);
} }
} }

@ -21,6 +21,7 @@
#include <AzToolsFramework/AssetCatalog/PlatformAddressedAssetCatalog.h> #include <AzToolsFramework/AssetCatalog/PlatformAddressedAssetCatalog.h>
#include <AzToolsFramework/UnitTest/ToolsTestApplication.h> #include <AzToolsFramework/UnitTest/ToolsTestApplication.h>
#include <AzCore/UserSettings/UserSettingsComponent.h> #include <AzCore/UserSettings/UserSettingsComponent.h>
#include <Utils/Utils.h>
namespace // anonymous namespace // anonymous
{ {
@ -57,7 +58,8 @@ namespace UnitTest
AZ::IO::FileIOBase::SetInstance(nullptr); AZ::IO::FileIOBase::SetInstance(nullptr);
AZ::IO::FileIOBase::SetInstance(m_localFileIO); AZ::IO::FileIOBase::SetInstance(m_localFileIO);
AZ::IO::FileIOBase::GetInstance()->SetAlias("@assets@", GetTestFolderPath().c_str()); AZ::IO::FileIOBase::GetInstance()->SetAlias("@assets@", m_tempDir.GetDirectory());
AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(AzFramework::PlatformId::PC); AZStd::string assetRoot = AzToolsFramework::PlatformAddressedAssetCatalog::GetAssetRootForPlatform(AzFramework::PlatformId::PC);
for (int idx = 0; idx < TotalAssets; idx++) for (int idx = 0; idx < TotalAssets; idx++)
@ -69,9 +71,11 @@ namespace UnitTest
assetRegistry.RegisterAsset(m_assets[idx], info); assetRegistry.RegisterAsset(m_assets[idx], info);
AzFramework::StringFunc::Path::Join(assetRoot.c_str(), info.m_relativePath.c_str(), m_assetsPath[idx]); AzFramework::StringFunc::Path::Join(assetRoot.c_str(), info.m_relativePath.c_str(), m_assetsPath[idx]);
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[idx].Open(m_assetsPath[idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[idx].Open(m_assetsPath[idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
m_fileStreams[idx].Write(info.m_relativePath.size(), info.m_relativePath.data()); m_fileStreams[idx].Write(info.m_relativePath.size(), info.m_relativePath.data());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
} }
else else
{ {
@ -115,10 +119,12 @@ namespace UnitTest
// Modify contents of asset2 // Modify contents of asset2
int fileIndex = 2; int fileIndex = 2;
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[fileIndex].Open(m_assetsPath[fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[fileIndex].Open(m_assetsPath[fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
AZStd::string fileContent = AZStd::string::format("new Asset%d.txt", fileIndex);// changing file content AZStd::string fileContent = AZStd::string::format("new Asset%d.txt", fileIndex);// changing file content
m_fileStreams[fileIndex].Write(fileContent.size(), fileContent.c_str()); m_fileStreams[fileIndex].Write(fileContent.size(), fileContent.c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
} }
else else
{ {
@ -127,10 +133,12 @@ namespace UnitTest
// Modify contents of asset 4 // Modify contents of asset 4
fileIndex = 4; fileIndex = 4;
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[fileIndex].Open(m_assetsPath[fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[fileIndex].Open(m_assetsPath[fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
AZStd::string fileContent = AZStd::string::format("new Asset%d.txt", fileIndex);// changing file content AZStd::string fileContent = AZStd::string::format("new Asset%d.txt", fileIndex);// changing file content
m_fileStreams[fileIndex].Write(fileContent.size(), fileContent.c_str()); m_fileStreams[fileIndex].Write(fileContent.size(), fileContent.c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
} }
else else
{ {
@ -152,7 +160,9 @@ namespace UnitTest
{ {
if (fileIO->Exists(TempFiles[idx])) if (fileIO->Exists(TempFiles[idx]))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(TempFiles[idx]); fileIO->Remove(TempFiles[idx]);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
} }
@ -163,14 +173,18 @@ namespace UnitTest
m_fileStreams[idx].Close(); m_fileStreams[idx].Close();
if (fileIO->Exists(m_assetsPath[idx].c_str())) if (fileIO->Exists(m_assetsPath[idx].c_str()))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(m_assetsPath[idx].c_str()); fileIO->Remove(m_assetsPath[idx].c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
} }
auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC); auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
if (fileIO->Exists(pcCatalogFile.c_str())) if (fileIO->Exists(pcCatalogFile.c_str()))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(pcCatalogFile.c_str()); fileIO->Remove(pcCatalogFile.c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
delete m_pcCatalog; delete m_pcCatalog;
@ -728,6 +742,7 @@ namespace UnitTest
} }
ToolsTestApplication* m_application; ToolsTestApplication* m_application;
UnitTest::ScopedTemporaryDirectory m_tempDir;
AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog; AzToolsFramework::PlatformAddressedAssetCatalog* m_pcCatalog;
AZ::IO::FileIOBase* m_priorFileIO = nullptr; AZ::IO::FileIOBase* m_priorFileIO = nullptr;
AZ::IO::FileIOBase* m_localFileIO = nullptr; AZ::IO::FileIOBase* m_localFileIO = nullptr;

@ -87,10 +87,12 @@ namespace UnitTest
for (int idx = 0; idx < s_totalAssets; idx++) for (int idx = 0; idx < s_totalAssets; idx++)
{ {
AzFramework::StringFunc::Path::Join(assetRoot.c_str(), m_assetsPath[idx].c_str(), m_assetsPathFull[platformCount][idx]); AzFramework::StringFunc::Path::Join(assetRoot.c_str(), m_assetsPath[idx].c_str(), m_assetsPathFull[platformCount][idx]);
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[platformCount][idx].Open(m_assetsPathFull[platformCount][idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[platformCount][idx].Open(m_assetsPathFull[platformCount][idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
m_fileStreams[platformCount][idx].Write(m_assetsPath[idx].size(), m_assetsPath[idx].data()); m_fileStreams[platformCount][idx].Write(m_assetsPath[idx].size(), m_assetsPath[idx].data());
m_fileStreams[platformCount][idx].Close(); m_fileStreams[platformCount][idx].Close();
AZ_TEST_STOP_TRACE_SUPPRESSION(thisPlatform == AzFramework::PlatformId::PC ? 1 : 0); // writing to asset cache folder, only invalid for PC
} }
else else
{ {
@ -112,7 +114,9 @@ namespace UnitTest
m_testDynamicSliceAssetId = testDynamicSliceAsset; m_testDynamicSliceAssetId = testDynamicSliceAsset;
m_assetRegistry->RegisterAsset(testDynamicSliceAsset, dynamicSliceAssetInfo); m_assetRegistry->RegisterAsset(testDynamicSliceAsset, dynamicSliceAssetInfo);
AZ_TEST_START_TRACE_SUPPRESSION;
AZ::IO::FileIOStream dynamicSliceFileIOStream(TestDynamicSliceAssetPath, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText); AZ::IO::FileIOStream dynamicSliceFileIOStream(TestDynamicSliceAssetPath, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
AZ::Data::AssetInfo sliceAssetInfo; AZ::Data::AssetInfo sliceAssetInfo;
sliceAssetInfo.m_relativePath = TestSliceAssetPath; sliceAssetInfo.m_relativePath = TestSliceAssetPath;
@ -124,7 +128,9 @@ namespace UnitTest
secondSliceAssetInfo.m_assetId = secondTestSliceAsset; secondSliceAssetInfo.m_assetId = secondTestSliceAsset;
m_assetRegistry->RegisterAsset(secondTestSliceAsset, secondSliceAssetInfo); m_assetRegistry->RegisterAsset(secondTestSliceAsset, secondSliceAssetInfo);
AZ_TEST_START_TRACE_SUPPRESSION;
AZ::IO::FileIOStream sliceFileIOStream(TestSliceAssetPath, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText); AZ::IO::FileIOStream sliceFileIOStream(TestSliceAssetPath, AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
// asset0 -> asset1 -> asset2 -> asset4 // asset0 -> asset1 -> asset2 -> asset4
// --> asset3 // --> asset3
@ -186,7 +192,6 @@ namespace UnitTest
AZ::IO::Path assetRoot(AZ::Utils::GetProjectPath()); AZ::IO::Path assetRoot(AZ::Utils::GetProjectPath());
assetRoot /= "Cache"; assetRoot /= "Cache";
AZ::IO::FileIOBase::GetInstance()->SetAlias("@root@", assetRoot.c_str()); AZ::IO::FileIOBase::GetInstance()->SetAlias("@root@", assetRoot.c_str());
} }
void TearDown() override void TearDown() override
@ -195,7 +200,9 @@ namespace UnitTest
if (fileIO->Exists(s_catalogFile)) if (fileIO->Exists(s_catalogFile))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(s_catalogFile); fileIO->Remove(s_catalogFile);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
for (size_t platformCount = 0; platformCount < s_totalTestPlatforms; ++platformCount) for (size_t platformCount = 0; platformCount < s_totalTestPlatforms; ++platformCount)
@ -206,26 +213,34 @@ namespace UnitTest
// we need to close the handle before we try to remove the file // we need to close the handle before we try to remove the file
if (fileIO->Exists(m_assetsPathFull[platformCount][idx].c_str())) if (fileIO->Exists(m_assetsPathFull[platformCount][idx].c_str()))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(m_assetsPathFull[platformCount][idx].c_str()); fileIO->Remove(m_assetsPathFull[platformCount][idx].c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(platformCount == 0 ? 1 : 0); // deleting from asset cache folder
} }
} }
} }
if (fileIO->Exists(TestSliceAssetPath)) if (fileIO->Exists(TestSliceAssetPath))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(TestSliceAssetPath); fileIO->Remove(TestSliceAssetPath);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
if (fileIO->Exists(TestDynamicSliceAssetPath)) if (fileIO->Exists(TestDynamicSliceAssetPath))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(TestDynamicSliceAssetPath); fileIO->Remove(TestDynamicSliceAssetPath);
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC); auto pcCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::PC);
auto androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID); auto androidCatalogFile = AzToolsFramework::PlatformAddressedAssetCatalog::GetCatalogRegistryPathForPlatform(AzFramework::PlatformId::ANDROID_ID);
if (fileIO->Exists(pcCatalogFile.c_str())) if (fileIO->Exists(pcCatalogFile.c_str()))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(pcCatalogFile.c_str()); fileIO->Remove(pcCatalogFile.c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // deleting from asset cache folder
} }
if (fileIO->Exists(androidCatalogFile.c_str())) if (fileIO->Exists(androidCatalogFile.c_str()))
@ -629,11 +644,13 @@ namespace UnitTest
EXPECT_EQ(assetList1.m_fileInfoList.size(), 1); EXPECT_EQ(assetList1.m_fileInfoList.size(), 1);
EXPECT_TRUE(Search(assetList1, assets[fileIndex])); EXPECT_TRUE(Search(assetList1, assets[fileIndex]));
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[0][fileIndex].Open(m_assetsPathFull[0][fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[0][fileIndex].Open(m_assetsPathFull[0][fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
AZStd::string fileContent = AZStd::string::format("asset%d.txt", fileIndex); AZStd::string fileContent = AZStd::string::format("asset%d.txt", fileIndex);
m_fileStreams[0][fileIndex].Write(fileContent.size(), fileContent.c_str()); m_fileStreams[0][fileIndex].Write(fileContent.size(), fileContent.c_str());
m_fileStreams[0][fileIndex].Close(); m_fileStreams[0][fileIndex].Close();
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
} }
AzToolsFramework::AssetFileInfoList assetList2 = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC); AzToolsFramework::AssetFileInfoList assetList2 = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);
@ -660,11 +677,13 @@ namespace UnitTest
EXPECT_EQ(assetList1.m_fileInfoList.size(), 1); EXPECT_EQ(assetList1.m_fileInfoList.size(), 1);
EXPECT_TRUE(Search(assetList1, assets[fileIndex])); EXPECT_TRUE(Search(assetList1, assets[fileIndex]));
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[0][fileIndex].Open(m_assetsPathFull[0][fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[0][fileIndex].Open(m_assetsPathFull[0][fileIndex].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
AZStd::string fileContent = AZStd::string::format("asset%d.txt", fileIndex + 1);// changing file content AZStd::string fileContent = AZStd::string::format("asset%d.txt", fileIndex + 1);// changing file content
m_fileStreams[0][fileIndex].Write(fileContent.size(), fileContent.c_str()); m_fileStreams[0][fileIndex].Write(fileContent.size(), fileContent.c_str());
m_fileStreams[0][fileIndex].Close(); m_fileStreams[0][fileIndex].Close();
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
} }
AzToolsFramework::AssetFileInfoList assetList2 = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC); AzToolsFramework::AssetFileInfoList assetList2 = m_assetSeedManager->GetDependencyList(AzFramework::PlatformId::PC);

@ -83,9 +83,11 @@ namespace UnitTest
info.m_assetId = m_assets[platformNum][idx]; info.m_assetId = m_assets[platformNum][idx];
assetRegistry->RegisterAsset(m_assets[platformNum][idx], info); assetRegistry->RegisterAsset(m_assets[platformNum][idx], info);
m_assetsPath[platformNum][idx] = info.m_relativePath; m_assetsPath[platformNum][idx] = info.m_relativePath;
AZ_TEST_START_TRACE_SUPPRESSION;
if (m_fileStreams[platformNum][idx].Open(m_assetsPath[platformNum][idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath)) if (m_fileStreams[platformNum][idx].Open(m_assetsPath[platformNum][idx].c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeBinary | AZ::IO::OpenMode::ModeCreatePath))
{ {
m_fileStreams[platformNum][idx].Write(info.m_relativePath.size(), info.m_relativePath.data()); m_fileStreams[platformNum][idx].Write(info.m_relativePath.size(), info.m_relativePath.data());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // writing to asset cache folder
} }
else else
{ {
@ -131,7 +133,9 @@ namespace UnitTest
m_fileStreams[platformNum][idx].Close(); m_fileStreams[platformNum][idx].Close();
if (fileIO->Exists(m_assetsPath[platformNum][idx].c_str())) if (fileIO->Exists(m_assetsPath[platformNum][idx].c_str()))
{ {
AZ_TEST_START_TRACE_SUPPRESSION;
fileIO->Remove(m_assetsPath[platformNum][idx].c_str()); fileIO->Remove(m_assetsPath[platformNum][idx].c_str());
AZ_TEST_STOP_TRACE_SUPPRESSION(1); // removing from asset cache folder
} }
} }
} }

Loading…
Cancel
Save