ams: support building unit test programs on windows/linux/macos

This commit is contained in:
Michael Scire 2022-03-06 12:08:20 -08:00 committed by SciresM
parent 9a38be201a
commit 64a97576d0
756 changed files with 33359 additions and 9372 deletions

View file

@ -18,6 +18,7 @@
namespace ams::pgl {
#if defined(ATMOSPHERE_OS_HORIZON)
class RemoteEventObserver {
NON_COPYABLE(RemoteEventObserver);
NON_MOVEABLE(RemoteEventObserver);
@ -55,5 +56,6 @@ namespace ams::pgl {
};
static_assert(pgl::sf::IsIEventObserver<RemoteEventObserver>);
static_assert(pgl::tipc::IsIEventObserver<RemoteEventObserver>);
#endif
}

View file

@ -56,6 +56,7 @@ namespace ams::pgl {
FreeToStaticExpHeap(obj);
}
#if defined(ATMOSPHERE_OS_HORIZON)
Result Initialize() {
return ::pglInitialize();
}
@ -134,5 +135,74 @@ namespace ams::pgl {
return ResultSuccess();
}
#else
Result Initialize() {
AMS_ABORT("TODO");
}
void Finalize() {
AMS_ABORT("TODO");
}
Result LaunchProgram(os::ProcessId *out, const ncm::ProgramLocation &loc, u32 process_flags, u8 pgl_flags) {
AMS_UNUSED(out, loc, process_flags, pgl_flags);
AMS_ABORT("TODO");
}
Result TerminateProcess(os::ProcessId process_id) {
AMS_UNUSED(process_id);
AMS_ABORT("TODO");
}
Result LaunchProgramFromHost(os::ProcessId *out, const char *content_path, u32 process_flags) {
AMS_UNUSED(out, content_path, process_flags);
AMS_ABORT("TODO");
}
Result GetHostContentMetaInfo(pgl::ContentMetaInfo *out, const char *content_path) {
AMS_UNUSED(out, content_path);
AMS_ABORT("TODO");
}
Result GetApplicationProcessId(os::ProcessId *out) {
AMS_UNUSED(out);
AMS_ABORT("TODO");
}
Result BoostSystemMemoryResourceLimit(u64 size) {
AMS_UNUSED(size);
AMS_ABORT("TODO");
}
Result IsProcessTracked(bool *out, os::ProcessId process_id) {
AMS_UNUSED(out, process_id);
AMS_ABORT("TODO");
}
Result EnableApplicationCrashReport(bool enabled) {
AMS_UNUSED(enabled);
AMS_ABORT("TODO");
}
Result IsApplicationCrashReportEnabled(bool *out) {
AMS_UNUSED(out);
AMS_ABORT("TODO");
}
Result EnableApplicationAllThreadDumpOnCrash(bool enabled) {
AMS_UNUSED(enabled);
AMS_ABORT("TODO");
}
Result TriggerApplicationSnapShotDumper(const char *arg, SnapShotDumpType dump_type) {
AMS_UNUSED(arg, dump_type);
AMS_ABORT("TODO");
}
Result GetEventObserver(pgl::EventObserver *out) {
AMS_UNUSED(out);
AMS_ABORT("TODO");
}
#endif
}

View file

@ -43,14 +43,14 @@ namespace ams::pgl::srv {
constinit bool g_enable_jit_debug = false;
constexpr inline size_t ProcessControlTaskStackSize = 8_KB;
constinit os::ThreadType g_process_control_task_thread;
constinit os::ThreadType g_process_control_task_thread = {};
alignas(os::ThreadStackAlignment) constinit u8 g_process_control_task_stack[ProcessControlTaskStackSize];
constinit os::SdkMutex g_observer_list_mutex;
constinit util::IntrusiveListBaseTraits<ShellEventObserverHolder>::ListType g_observer_list;
constinit os::SdkMutex g_process_data_mutex;
constinit ProcessData g_process_data[ProcessDataCount];
constinit ProcessData g_process_data[ProcessDataCount] = {};
constinit os::ProcessId g_crashed_process_id = os::InvalidProcessId;
constinit os::ProcessId g_creport_process_id = os::InvalidProcessId;
@ -215,7 +215,7 @@ namespace ams::pgl::srv {
/* Generate arguments. */
char arguments[0x40];
const size_t len = util::SNPrintf(arguments, sizeof(arguments), "%ld %d %d %d", static_cast<s64>(static_cast<u64>(process_id)), GetCrashReportDetailedArgument(data_flags), GetCrashReportScreenShotArgument(data_flags), g_enable_jit_debug);
const size_t len = util::SNPrintf(arguments, sizeof(arguments), "%" PRId64 " %d %d %d", static_cast<s64>(static_cast<u64>(process_id)), GetCrashReportDetailedArgument(data_flags), GetCrashReportScreenShotArgument(data_flags), g_enable_jit_debug);
if (R_FAILED(ldr::SetProgramArgument(ncm::SystemProgramId::Creport, arguments, len + 1))) {
return;
}