Files
wiicompiled/runtime/tests/host_context_tests.cpp
Michael G 5c76e2b0df feature: add apple silicon native macOS support (#81)
* feature: add apple silicon native macOS support - #81

* (macos): Fix crash

This fixes a crash when viewing the rear camera

* fix(macos): keep interpolated presentation on main thread

* fix(macos): supply Retro-WFC payload during setup

* perf(windows): compile out flat-memory fallback check

* remove duplicate smoke test

* test(macos): name and focus host platform tests

* fix(macos): validate Retro-WFC payload cache

* fix(payload): preserve staged file access failures

* Limit flat-page checks to variable-page hosts

---------

Co-authored-by: patchzyy <64382339+patchzyy@users.noreply.github.com>
2026-09-01 18:57:15 +02:00

50 lines
1.1 KiB
C++

#include "host_context.h"
#include <cstdlib>
namespace {
// The worker yields twice; each return to the scheduler must preserve both
// context identities and the worker's continuation point.
HostContext::Handle g_scheduler = nullptr;
HostContext::Handle g_worker = nullptr;
int g_steps = 0;
void Worker(void*)
{
if (!HostContext::IsCurrent(g_worker)) {
std::abort();
}
++g_steps;
HostContext::Switch(g_scheduler);
if (!HostContext::IsCurrent(g_worker)) {
std::abort();
}
++g_steps;
HostContext::Switch(g_scheduler);
}
} // namespace
int main()
{
if (!HostContext::InitializeScheduler(&g_scheduler) ||
!HostContext::IsCurrent(g_scheduler)) {
return 1;
}
g_worker = HostContext::Create(64 * 1024, Worker, nullptr);
if (!g_worker) {
return 1;
}
HostContext::Switch(g_worker);
if (g_steps != 1 || !HostContext::IsCurrent(g_scheduler)) {
return 1;
}
HostContext::Switch(g_worker);
if (g_steps != 2 || !HostContext::IsCurrent(g_scheduler)) {
return 1;
}
HostContext::Destroy(g_worker);
HostContext::ShutdownScheduler(g_scheduler);
}