You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
* Fixed macos compile error * Fixed race condition in TestRemoteScheduleReuse [CL 32871469 by henrik karlsson in ue5-main branch]
93 lines
2.8 KiB
C++
93 lines
2.8 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "UbaTestSession.h"
|
|
#include "UbaScheduler.h"
|
|
|
|
namespace uba
|
|
{
|
|
bool TestLocalSchedule(LoggerWithWriter& logger, const StringBufferBase& testRootDir)
|
|
{
|
|
return RunLocal(logger, testRootDir, [](LoggerWithWriter& logger, SessionServer& session, const tchar* workingDir, const RunProcessFunction& runProcess)
|
|
{
|
|
SchedulerCreateInfo info(session);
|
|
Scheduler scheduler(info);
|
|
|
|
ProcessStartInfo processInfo;
|
|
processInfo.application = GetSystemApplication();
|
|
processInfo.workingDir = workingDir;
|
|
processInfo.arguments = GetSystemArguments();
|
|
|
|
EnqueueProcessInfo epi(processInfo);
|
|
scheduler.EnqueueProcess(epi);
|
|
scheduler.Start();
|
|
|
|
u32 queued, activeLocal, activeRemote, finished;
|
|
do { scheduler.GetStats(queued, activeLocal, activeRemote, finished); } while (finished != 1);
|
|
|
|
scheduler.Stop();
|
|
return true;
|
|
});
|
|
}
|
|
|
|
bool TestLocalScheduleReuse(LoggerWithWriter& logger, const StringBufferBase& testRootDir)
|
|
{
|
|
return RunLocal(logger, testRootDir, [](LoggerWithWriter& logger, SessionServer& session, const tchar* workingDir, const RunProcessFunction& runProcess)
|
|
{
|
|
SchedulerCreateInfo info(session);
|
|
info.enableProcessReuse = true;
|
|
Scheduler scheduler(info);
|
|
|
|
StringBuffer<> testApp;
|
|
GetTestAppPath(logger, testApp);
|
|
|
|
ProcessStartInfo processInfo;
|
|
processInfo.application = testApp.data;
|
|
processInfo.workingDir = workingDir;
|
|
processInfo.arguments = TC("-reuse");
|
|
|
|
EnqueueProcessInfo epi(processInfo);
|
|
scheduler.EnqueueProcess(epi);
|
|
scheduler.Start();
|
|
|
|
u32 queued, activeLocal, activeRemote, finished;
|
|
do { scheduler.GetStats(queued, activeLocal, activeRemote, finished); } while (finished != 1);
|
|
|
|
scheduler.Stop();
|
|
return true;
|
|
});
|
|
}
|
|
|
|
bool TestRemoteScheduleReuse(LoggerWithWriter& logger, const StringBufferBase& testRootDir)
|
|
{
|
|
return RunRemote(logger, testRootDir, [](LoggerWithWriter& logger, SessionServer& session, const tchar* workingDir, const RunProcessFunction& runProcess)
|
|
{
|
|
SchedulerCreateInfo info(session);
|
|
info.enableProcessReuse = true;
|
|
info.maxLocalProcessors = 0;
|
|
Scheduler scheduler(info);
|
|
|
|
StringBuffer<> testApp;
|
|
GetTestAppPath(logger, testApp);
|
|
|
|
ProcessStartInfo processInfo;
|
|
processInfo.application = testApp.data;
|
|
processInfo.workingDir = workingDir;
|
|
processInfo.arguments = TC("-reuse");
|
|
|
|
EnqueueProcessInfo epi(processInfo);
|
|
scheduler.EnqueueProcess(epi);
|
|
scheduler.Start();
|
|
|
|
u32 queued, activeLocal, activeRemote, finished;
|
|
do { scheduler.GetStats(queued, activeLocal, activeRemote, finished); } while (finished != 1);
|
|
|
|
session.GetServer().DisconnectClients(); // Must make sure all is disconnected since scheduler goes out of scope
|
|
|
|
scheduler.Stop();
|
|
return true;
|
|
});
|
|
}
|
|
}
|