Cleanup before merge
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include <AzCore/Jobs/JobCompletion.h>
|
||||
#include <AzCore/Jobs/JobCompletionSpin.h>
|
||||
#include <AzCore/Jobs/JobFunction.h>
|
||||
#include <AzCore/Jobs/LegacyJobExecutor.h>
|
||||
#include <AzCore/Jobs/JobManager.h>
|
||||
#include <AzCore/Jobs/task_group.h>
|
||||
#include <AzCore/Jobs/Algorithms.h>
|
||||
@@ -1398,103 +1397,6 @@ namespace UnitTest
|
||||
run();
|
||||
}
|
||||
|
||||
using JobLegacyJobExecutorIsRunning = DefaultJobManagerSetupFixture;
|
||||
TEST_F(JobLegacyJobExecutorIsRunning, Test)
|
||||
{
|
||||
// Note: Legacy JobExecutor exists as an adapter to Legacy CryEngine jobs.
|
||||
// When writing new jobs instead favor direct use of the AZ::Job type family
|
||||
AZ::LegacyJobExecutor jobExecutor;
|
||||
EXPECT_FALSE(jobExecutor.IsRunning());
|
||||
|
||||
// Completion fences and IsRunning()
|
||||
{
|
||||
jobExecutor.PushCompletionFence();
|
||||
EXPECT_TRUE(jobExecutor.IsRunning());
|
||||
jobExecutor.PopCompletionFence();
|
||||
EXPECT_FALSE(jobExecutor.IsRunning());
|
||||
}
|
||||
|
||||
AZStd::atomic_bool jobExecuted{ false };
|
||||
AZStd::binary_semaphore jobSemaphore;
|
||||
|
||||
jobExecutor.StartJob([&jobSemaphore, &jobExecuted]
|
||||
{
|
||||
// Wait until the test thread releases
|
||||
jobExecuted = true;
|
||||
jobSemaphore.acquire();
|
||||
}
|
||||
);
|
||||
EXPECT_TRUE(jobExecutor.IsRunning());
|
||||
|
||||
// Allow the job to complete
|
||||
jobSemaphore.release();
|
||||
|
||||
// Wait for completion
|
||||
jobExecutor.WaitForCompletion();
|
||||
EXPECT_FALSE(jobExecutor.IsRunning());
|
||||
EXPECT_TRUE(jobExecuted);
|
||||
}
|
||||
|
||||
using JobLegacyJobExecutorWaitForCompletion = DefaultJobManagerSetupFixture;
|
||||
TEST_F(JobLegacyJobExecutorWaitForCompletion, Test)
|
||||
{
|
||||
// Note: Legacy JobExecutor exists as an adapter to Legacy CryEngine jobs.
|
||||
// When writing new jobs instead favor direct use of the AZ::Job type family
|
||||
AZ::LegacyJobExecutor jobExecutor;
|
||||
|
||||
// Semaphores used to park job threads until released
|
||||
const AZ::u32 numParkJobs = AZ::JobContext::GetGlobalContext()->GetJobManager().GetNumWorkerThreads();
|
||||
AZStd::vector<AZStd::binary_semaphore> jobSemaphores(numParkJobs);
|
||||
|
||||
// Data destination for workers
|
||||
const AZ::u32 workJobCount = numParkJobs * 2;
|
||||
AZStd::vector<AZ::u32> jobData(workJobCount, 0);
|
||||
|
||||
// Touch completion multiple times as a test of correctly transitioning in and out of the all jobs completed state
|
||||
AZ::u32 NumCompletionCycles = 5;
|
||||
for (AZ::u32 completionItrIdx = 0; completionItrIdx < NumCompletionCycles; ++completionItrIdx)
|
||||
{
|
||||
// Intentionally park every job thread
|
||||
for (auto& jobSemaphore : jobSemaphores)
|
||||
{
|
||||
jobExecutor.StartJob([&jobSemaphore]
|
||||
{
|
||||
jobSemaphore.acquire();
|
||||
}
|
||||
);
|
||||
}
|
||||
EXPECT_TRUE(jobExecutor.IsRunning());
|
||||
|
||||
// Kick off verifiable "work" jobs
|
||||
for (AZ::u32 i = 0; i < workJobCount; ++i)
|
||||
{
|
||||
jobExecutor.StartJob([i, &jobData]
|
||||
{
|
||||
jobData[i] = i + 1;
|
||||
}
|
||||
);
|
||||
}
|
||||
EXPECT_TRUE(jobExecutor.IsRunning());
|
||||
|
||||
// Now released our parked job threads
|
||||
for (auto& jobSemaphore : jobSemaphores)
|
||||
{
|
||||
jobSemaphore.release();
|
||||
}
|
||||
|
||||
// And wait for all jobs to finish
|
||||
jobExecutor.WaitForCompletion();
|
||||
EXPECT_FALSE(jobExecutor.IsRunning());
|
||||
|
||||
// Verify our workers ran and clear data
|
||||
for (size_t i = 0; i < workJobCount; ++i)
|
||||
{
|
||||
EXPECT_EQ(jobData[i], i + 1);
|
||||
jobData[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class JobCompletionCompleteNotScheduled
|
||||
: public DefaultJobManagerSetupFixture
|
||||
{
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <AzFramework/Entity/PrefabEntityOwnershipService.h>
|
||||
|
||||
namespace AzFramework
|
||||
{
|
||||
}
|
||||
@@ -121,7 +121,6 @@ set(FILES
|
||||
Entity/SliceGameEntityOwnershipService.cpp
|
||||
Entity/SliceGameEntityOwnershipServiceBus.h
|
||||
Entity/PrefabEntityOwnershipService.h
|
||||
Entity/PrefabEntityOwnershipService.cpp
|
||||
Components/ComponentAdapter.h
|
||||
Components/ComponentAdapter.inl
|
||||
Components/ComponentAdapterHelpers.h
|
||||
|
||||
@@ -14,7 +14,12 @@ sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../bui
|
||||
import ci_build
|
||||
|
||||
EXTENSIONS_OF_INTEREST = ('.c', '.cc', '.cpp', '.cxx', '.h', '.hpp', '.hxx', '.inl')
|
||||
EXCLUSIONS = ('AZ_DECLARE_MODULE_CLASS')
|
||||
EXCLUSIONS = (
|
||||
'AZ_DECLARE_MODULE_CLASS(',
|
||||
'REGISTER_QT_CLASS_DESC(',
|
||||
'TEST(',
|
||||
'TEST_F('
|
||||
)
|
||||
|
||||
def create_filelist(path):
|
||||
filelist = set()
|
||||
@@ -42,6 +47,13 @@ def is_excluded(file):
|
||||
normalized_file = os.path.normpath(file)
|
||||
if '\\Platform\\' in normalized_file and not '\\Windows\\' in normalized_file:
|
||||
return True
|
||||
if '\\Template\\' in normalized_file:
|
||||
return True
|
||||
with open(file, 'r') as file:
|
||||
contents = file.readlines()
|
||||
for exclusion_term in EXCLUSIONS:
|
||||
if exclusion_term in contents:
|
||||
return True
|
||||
return False
|
||||
|
||||
def filter_from_processed(filelist, filter_file_path):
|
||||
@@ -49,11 +61,7 @@ def filter_from_processed(filelist, filter_file_path):
|
||||
return # nothing to filter
|
||||
|
||||
with open(filter_file_path, 'r') as filter_file:
|
||||
try:
|
||||
processed_files = [s.strip() for s in filter_file.readlines()]
|
||||
except UnicodeDecodeError as err:
|
||||
print('Error reading file {}, err: {}'.format(filter_file_path, err))
|
||||
sys.exit(1)
|
||||
processed_files = [s.strip() for s in filter_file.readlines()]
|
||||
filelist -= set(processed_files)
|
||||
filelist = [f for f in filelist if not is_excluded(f)]
|
||||
|
||||
@@ -65,10 +73,11 @@ def cleanup_unused_compilation(path):
|
||||
# starting over. Removing the "unusued_compilation_processed.txt" will start over.
|
||||
filter_file_path = os.path.join(os.getcwd(), 'unusued_compilation_processed.txt')
|
||||
filter_from_processed(filelist, filter_file_path)
|
||||
sorted_filelist = sorted(filelist)
|
||||
# 3. For each file
|
||||
total_files = len(filelist)
|
||||
total_files = len(sorted_filelist)
|
||||
current_files = 1
|
||||
for file in filelist:
|
||||
for file in sorted_filelist:
|
||||
print(f"[{current_files}/{total_files}] Trying {file}")
|
||||
# b. create backup
|
||||
shutil.copy(file, file + '.bak')
|
||||
|
||||
Reference in New Issue
Block a user