[+] Added process test
[*] Update Aurora
This commit is contained in:
parent
6b0e11741c
commit
0b8362a90d
@ -1 +1 @@
|
||||
Subproject commit c6d649e3de9cd1cdc3fc39a2713a0e1cc572e5e1
|
||||
Subproject commit 9e26996463b70f00bcdfa7e8439a8012c237683c
|
47
Tests/Public/11. Hello Processes/Main.cpp
Normal file
47
Tests/Public/11. Hello Processes/Main.cpp
Normal file
@ -0,0 +1,47 @@
|
||||
/***
|
||||
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
||||
|
||||
File: Main.cpp
|
||||
Date: 2022-2-18
|
||||
Author: Reece
|
||||
***/
|
||||
#include <AuroraRuntime.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
TEST(Process, RunSystem)
|
||||
{
|
||||
auto proc = "^/HelloSystem"
|
||||
#if defined(AURORA_PLATFORM_WIN32)
|
||||
".exe"
|
||||
#endif
|
||||
;
|
||||
|
||||
AuProcesses::StartupParmaters params;
|
||||
params.type = AuProcesses::ESpawnType::eSpawnChildProcessWorker;
|
||||
params.process = proc;
|
||||
params.fwdOut = true;
|
||||
params.fwdIn = true;
|
||||
params.noShowConsole = true;
|
||||
auto process = AuProcesses::SpawnUnique(params);
|
||||
ASSERT_TRUE(static_cast<bool>(process));
|
||||
|
||||
ASSERT_TRUE(process->Start());
|
||||
|
||||
AuByteBuffer stdoutPipe(4096 * 16);
|
||||
AuUInt written {};
|
||||
while (process->Read(AuProcesses::EStandardHandle::eStdOut, AuMemoryViewStreamWrite {stdoutPipe.begin(), stdoutPipe.end(), written}, false))
|
||||
{
|
||||
AuLogDbg("STDOUT {}", AuString(stdoutPipe.begin(), stdoutPipe.begin() + written));
|
||||
}
|
||||
|
||||
process->AsWaitable()->Lock();
|
||||
AuLogDbg("Exit Code: 0x{:x}", process->GetExitCode());
|
||||
}
|
||||
|
||||
void RunTests()
|
||||
{
|
||||
Aurora::RuntimeStartInfo info;
|
||||
info.console.fio.enableLogging = false;
|
||||
info.console.forceToolKitWindow = false;
|
||||
Aurora::RuntimeStart(info);
|
||||
}
|
Loading…
Reference in New Issue
Block a user