31 lines
1011 B
Lua
31 lines
1011 B
Lua
-- Full-boot e2e: replicate the real boot path (startup/boot.lua) closely enough
|
|
-- to prove the whole stack works end to end. Sets the cloud.* settings, creates
|
|
-- the global event loop, runs the REAL servers/cloud.lua daemon, then under
|
|
-- parallel waits for the connection and runs the REAL `cloud status` program.
|
|
--
|
|
-- Args (via shell.run): url, secret ('' => none).
|
|
-- NOTE: shell.run drops empty-string args; the harness passes '-' for "no secret".
|
|
local args = { ... };
|
|
local url = args[1];
|
|
local secret = args[2];
|
|
|
|
settings.set('cloud.url', url);
|
|
if secret and secret ~= '' and secret ~= '-' then
|
|
settings.set('cloud.password', secret);
|
|
end
|
|
|
|
_G.bootEventLoop = require('/apis/eventloop')();
|
|
|
|
-- Start the real daemon (reads cloud.url/cloud.password, opens the WS).
|
|
shell.run('/servers/cloud.lua');
|
|
|
|
parallel.waitForAny(
|
|
function() _G.bootEventLoop.runLoop(true); end,
|
|
function()
|
|
os.pullEvent('trapos_cloud_connected');
|
|
shell.run('/programs/cloud.lua', 'status');
|
|
end
|
|
);
|
|
|
|
os.shutdown();
|