CI: green again (moon update, wasmer + native deps, stale tests)
CI / test (push) Successful in 1m34s

CI has failed on every push since Nov 25. In order:

- `moon check` died resolving jqlssg/moonedn: the workflow never ran
  `moon update`, so the registry index was missing.
- The wasm-target `moon test` tried to instantiate compositor/{host,network,
  portal}, which import chandra:host/* on wasm and only run under the native
  host. scripts/test.sh now runs the wasm tests for everything outside
  compositor/, and compositor/network + compositor/portal join the native run.
- The JS (jco) host didn't know the launcher's new `session` and `power`
  imports; it now has in-memory versions and the configs grant them. Its tests
  expect the Digital Clock's 12-hour default ("2:07 PM").
- The native compositor links -lwasmer and kms needs libseat etc.:
  setup-toolchain.sh fetches the wasmer C API (WASMER_VERSION=6.1.0) into
  .tools/wasmer, test.sh puts it on the C paths, and the workflow apt-installs
  libseat/libdrm/libinput/libudev/libxkbcommon dev packages.
- Stale compositor tests: moon-disc has no source in the tree, so tests use
  network / clock-binary instead (the wasm test skips moon-disc with a notice
  when it isn't built); the in-tree layout module is a Tile | Float toggle, not
  a popup; the clock lists the calendar's two settings; the settings popup is
  390 wide, so the Panel-tab buttons moved right.

Locally scripts/test.sh passes end to end: 59 wasm, 15 host, 144 native tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiRjHvKRKCJHaGFekY
This commit is contained in:
Claude committed 2026-11-26 00:19:52 +00:00
1 parent 0feea23a06
commit acf2daa399
10 files changed
+103 -55

No files matched your search

+8 -1
View File
@@ -20,8 +20,15 @@ jobs:
run: | run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> "$GITHUB_PATH" echo "$HOME/.moon/bin" >> "$GITHUB_PATH"
# Fetch the package registry index, or registry deps (jqlssg/moonedn) aren't found.
"$HOME/.moon/bin/moon" update
- name: Install wasm-tools, wit-bindgen, wasmtime - name: Install native compositor build dependencies
run: |
apt-get update -q
apt-get install -y -q --no-install-recommends libseat-dev libdrm-dev libinput-dev libudev-dev libxkbcommon-dev
- name: Install wasm-tools, wit-bindgen, wasmtime, wasmer C API
run: scripts/setup-toolchain.sh run: scripts/setup-toolchain.sh
- name: Install host dependencies (jco) - name: Install host dependencies (jco)
+20 -36
View File
@@ -191,7 +191,7 @@ test "dragging the divider between two tiled windows resizes them" {
} }
///| ///|
test "the layout module opens a popup to pick Tiling, Monocle or Floating" { test "the layout module toggles between tiling and floating" {
let socket_path = "/tmp/wayland-moon-layout-" + let socket_path = "/tmp/wayland-moon-layout-" +
@sys.getpid().to_string() + @sys.getpid().to_string() +
".sock" ".sock"
@@ -200,33 +200,15 @@ test "the layout module opens a popup to pick Tiling, Monocle or Floating" {
let _a = open_and_configure_client(comp, socket_path, "A", "a") let _a = open_and_configure_client(comp, socket_path, "A", "a")
let _b = open_and_configure_client(comp, socket_path, "B", "b") let _b = open_and_configure_client(comp, socket_path, "B", "b")
ignore(comp.compose_frame()) ignore(comp.compose_frame())
let slot = comp.shell.slot_of("layout")
let (cx, cy) = center_of(comp, "layout") let (cx, cy) = center_of(comp, "layout")
comp.handle_input(@nested.InputEvent::PointerMove(cx, cy), 1U) comp.handle_input(@nested.InputEvent::PointerMove(cx, cy), 1U)
assert_eq(comp.desired_cursor(), 4U) // it is a button: hand cursor assert_eq(comp.desired_cursor(), 4U) // it is a button: hand cursor
// Pick row `i` from the popup the button opens.
let pick = fn(i : Int, t : UInt) raise {
click_at(comp, cx.to_int(), cy.to_int(), t) // open
let pr = comp.shell.slot_popup_rect(slot)
assert_true(pr.w > 0)
click_at(comp, pr.x + pr.w / 2, pr.y + 4 + i * 28 + 14, t + 3U)
assert_eq(comp.shell.slot_popup_rect(slot).w, 0)
}
assert_eq(comp.layout_mode, @wm.LayoutMode::Tiling) assert_eq(comp.layout_mode, @wm.LayoutMode::Tiling)
let tiled_w = comp.windows.get(1UL).unwrap().geometry.w let tiled_w = comp.windows.get(1UL).unwrap().geometry.w
// Opening alone changes nothing. // "Tile | Float": a click floats the windows, the next one tiles them again.
click_at(comp, cx.to_int(), cy.to_int(), 2U) click_at(comp, cx.to_int(), cy.to_int(), 2U)
assert_true(comp.shell.slot_popup_rect(slot).w > 0)
assert_eq(comp.layout_mode, @wm.LayoutMode::Tiling)
// Escape closes without picking.
comp.handle_input(@nested.InputEvent::Key(1U, true), 3U)
assert_eq(comp.shell.slot_popup_rect(slot).w, 0)
pick(1, 10U)
assert_eq(comp.layout_mode, @wm.LayoutMode::Monocle)
assert_true(comp.windows.get(1UL).unwrap().geometry.w > tiled_w + 100)
pick(2, 20U)
assert_eq(comp.layout_mode, @wm.LayoutMode::Floating) assert_eq(comp.layout_mode, @wm.LayoutMode::Floating)
pick(0, 30U) click_at(comp, cx.to_int(), cy.to_int(), 10U)
assert_eq(comp.layout_mode, @wm.LayoutMode::Tiling) assert_eq(comp.layout_mode, @wm.LayoutMode::Tiling)
assert_eq(comp.windows.get(1UL).unwrap().geometry.w, tiled_w) assert_eq(comp.windows.get(1UL).unwrap().geometry.w, tiled_w)
} }
@@ -375,6 +357,7 @@ test "right-click an app in the dock for its window's menu: Minimize, Maximize,
test "right-click a panel module to replace it in place, or remove it" { test "right-click a panel module to replace it in place, or remove it" {
let comp = new_comp("swap") let comp = new_comp("swap")
let before = comp.shell.slots() let before = comp.shell.slots()
let clock_at = before.search(comp.shell.slot_of("clock-digital")).unwrap()
let clock = rect_of(comp, "clock-digital") let clock = rect_of(comp, "clock-digital")
assert_true(clock.w > 0) assert_true(clock.w > 0)
let find_row = fn(label : String) { let find_row = fn(label : String) {
@@ -404,18 +387,18 @@ test "right-click a panel module to replace it in place, or remove it" {
assert_eq(comp.shell.slot_of("clock-digital"), "") assert_eq(comp.shell.slot_of("clock-digital"), "")
let after = comp.shell.slots() let after = comp.shell.slots()
assert_eq(after.length(), before.length()) assert_eq(after.length(), before.length())
assert_eq(after[after.length() - 1], comp.shell.slot_of("clock-binary")) // same place in the panel assert_eq(after[clock_at], comp.shell.slot_of("clock-binary")) // same place in the panel
assert_true(rect_of(comp, "clock-binary").w > 0) assert_true(rect_of(comp, "clock-binary").w > 0)
// Escape dismisses the menu; "Remove widget" unloads the module. // Escape dismisses the menu; "Remove widget" unloads the module.
let moon = rect_of(comp, "moon-disc") let net = rect_of(comp, "network")
click_at(comp, moon.x + moon.w / 2, moon.y + moon.h / 2, 20U, btn=273U) click_at(comp, net.x + net.w / 2, net.y + net.h / 2, 20U, btn=273U)
assert_true(comp.shell.menu_open) assert_true(comp.shell.menu_open)
comp.handle_input(@nested.InputEvent::Key(1U, true), 30U) comp.handle_input(@nested.InputEvent::Key(1U, true), 30U)
assert_true(!comp.shell.menu_open) assert_true(!comp.shell.menu_open)
click_at(comp, moon.x + moon.w / 2, moon.y + moon.h / 2, 40U, btn=273U) click_at(comp, net.x + net.w / 2, net.y + net.h / 2, 40U, btn=273U)
let m2 = comp.shell.menu_rect let m2 = comp.shell.menu_rect
click_at(comp, m2.x + m2.w / 2, m2.y + 26 + 28 * find_row("Remove widget") + 14, 50U) click_at(comp, m2.x + m2.w / 2, m2.y + 26 + 28 * find_row("Remove widget") + 14, 50U)
assert_eq(comp.shell.slot_of("moon-disc"), "") assert_eq(comp.shell.slot_of("network"), "")
assert_eq(comp.shell.slots().length(), before.length() - 1) assert_eq(comp.shell.slots().length(), before.length() - 1)
} }
@@ -527,12 +510,12 @@ test "the panel is saved to panel.edn and restored" {
let a = @shell.DesktopShell::new("x") let a = @shell.DesktopShell::new("x")
a.persist = true a.persist = true
a.set_output(theme, 1280, 720) a.set_output(theme, 1280, 720)
assert_true(a.unload_slot(a.slot_of("moon-disc"))) assert_true(a.unload_slot(a.slot_of("network")))
assert_true(a.load_module("clock-binary")) assert_true(a.load_module("clock-binary"))
let b = @shell.DesktopShell::new("x") let b = @shell.DesktopShell::new("x")
b.persist = true b.persist = true
b.set_output(theme, 1280, 720) b.set_output(theme, 1280, 720)
assert_eq(b.slot_of("moon-disc"), "") assert_eq(b.slot_of("network"), "")
assert_true(b.slot_of("clock-binary") != "") assert_true(b.slot_of("clock-binary") != "")
assert_eq(b.slots().length(), a.slots().length()) assert_eq(b.slots().length(), a.slots().length())
} }
@@ -666,23 +649,24 @@ test "the wasm picker opens the settings module's Panel tab, which loads and unl
test "dragging a panel module reorders it" { test "dragging a panel module reorders it" {
let comp = new_comp("wdrag") let comp = new_comp("wdrag")
let order0 = comp.shell.slots() let order0 = comp.shell.slots()
let moon = rect_of(comp, "moon-disc") let net_at = order0.search(comp.shell.slot_of("network")).unwrap()
let net = rect_of(comp, "network")
let clock = rect_of(comp, "clock-digital") let clock = rect_of(comp, "clock-digital")
assert_true(moon.x < clock.x) assert_true(net.x < clock.x)
let cy = (clock.y + clock.h / 2).to_double() let cy = (clock.y + clock.h / 2).to_double()
comp.handle_input(@nested.InputEvent::PointerMove((clock.x + clock.w / 2).to_double(), cy), 1U) comp.handle_input(@nested.InputEvent::PointerMove((clock.x + clock.w / 2).to_double(), cy), 1U)
assert_eq(comp.desired_cursor(), 4U) assert_eq(comp.desired_cursor(), 4U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, true), 2U) comp.handle_input(@nested.InputEvent::PointerButton(272U, true), 2U)
// Drag the clock left past the moon. // Drag the clock left past the network module.
comp.handle_input(@nested.InputEvent::PointerMove((moon.x + 2).to_double(), cy), 3U) comp.handle_input(@nested.InputEvent::PointerMove((net.x + 2).to_double(), cy), 3U)
assert_eq(comp.desired_cursor(), 17U) assert_eq(comp.desired_cursor(), 17U)
comp.handle_input(@nested.InputEvent::PointerButton(272U, false), 4U) comp.handle_input(@nested.InputEvent::PointerButton(272U, false), 4U)
ignore(comp.compose_frame()) ignore(comp.compose_frame())
let order1 = comp.shell.slots() let order1 = comp.shell.slots()
assert_eq(order1.length(), order0.length()) assert_eq(order1.length(), order0.length())
assert_true(order1 != order0) assert_true(order1 != order0)
assert_eq(order1[order1.length() - 2], comp.shell.slot_of("clock-digital")) assert_eq(order1[net_at], comp.shell.slot_of("clock-digital"))
assert_true(rect_of(comp, "clock-digital").x < rect_of(comp, "moon-disc").x) assert_true(rect_of(comp, "clock-digital").x < rect_of(comp, "network").x)
assert_true(comp.desired_cursor() != 17U) assert_true(comp.desired_cursor() != 17U)
} }
@@ -711,14 +695,14 @@ test "modules are added until the panel is full" {
let n0 = comp.shell.slots().length() let n0 = comp.shell.slots().length()
let mut added = 0 let mut added = 0
for _i = 0; _i < 40; _i = _i + 1 { for _i = 0; _i < 40; _i = _i + 1 {
if comp.shell.load_module("moon-disc") { if comp.shell.load_module("clock-binary") { // a clock can go in more than once
added = added + 1 added = added + 1
} }
} }
assert_true(added > 2 && added < 40) assert_true(added > 2 && added < 40)
assert_eq(comp.shell.slots().length(), n0 + added) assert_eq(comp.shell.slots().length(), n0 + added)
ignore(comp.compose_frame()) ignore(comp.compose_frame())
assert_true(rect_of(comp, "moon-disc").w > 0) assert_true(rect_of(comp, "clock-binary").w > 0)
} }
///| ///|
+26 -9
View File
@@ -69,6 +69,22 @@ fn load_module(name : String) -> Plasmoid {
} }
} }
///| Like load_module, for a module that may not be built (e.g. moon-disc, which has no source
/// in the tree): None, with a skip notice, when it isn't in build/components.
fn load_optional_module(name : String) -> Plasmoid? {
match load("build/components/" + name + ".wasm", test_tokens()) {
Ok(p) => Some(p)
Err(_) =>
match load("../../build/components/" + name + ".wasm", test_tokens()) {
Ok(p) => Some(p)
Err(_) => {
println("skip: \{name}.wasm is not in build/components (no source in the tree)")
None
}
}
}
}
///| ///|
fn texts_of(ops : Array[@types.DrawOp]) -> Array[String] { fn texts_of(ops : Array[@types.DrawOp]) -> Array[String] {
let out : Array[String] = [] let out : Array[String] = []
@@ -97,15 +113,15 @@ fn drain() -> Array[HostRequest] {
test "a module's own settings (module-config) are listed and set through wasmer" { test "a module's own settings (module-config) are listed and set through wasmer" {
let p = load_module("clock-digital") let p = load_module("clock-digital")
let items = p.config_items() let items = p.config_items()
// 12-hour by default: Time format, Show AM/PM, Show date. // 12-hour by default: Time format, Show AM/PM, Show date, then the calendar's two settings.
assert_eq(items.length(), 3) assert_eq(items.length(), 5)
assert_eq(items[0], { key: "format", label: "Time format", choices: ["24-hour", "12-hour"], value: "12-hour" }) assert_eq(items[0], { key: "format", label: "Time format", choices: ["24-hour", "12-hour"], value: "12-hour" })
assert_eq(items[1].choices.length(), 0) // an on/off switch assert_eq(items[1].choices.length(), 0) // an on/off switch
assert_true(p.set_config("format", "24-hour")) assert_true(p.set_config("format", "24-hour"))
assert_false(p.set_config("format", "24-hour")) // unchanged assert_false(p.set_config("format", "24-hour")) // unchanged
assert_false(p.set_config("bogus", "x")) assert_false(p.set_config("bogus", "x"))
assert_eq(p.config_items()[0].value, "24-hour") assert_eq(p.config_items()[0].value, "24-hour")
assert_eq(p.config_items().length(), 2) // no AM/PM switch in 24-hour mode assert_eq(p.config_items().length(), 4) // no AM/PM switch in 24-hour mode
let mut ampm = false let mut ampm = false
for op in p.render(p.pref_w, p.pref_h, test_tokens()) { for op in p.render(p.pref_w, p.pref_h, test_tokens()) {
match op { match op {
@@ -218,12 +234,12 @@ test "the settings module's Panel tab lists host modules and asks to load, move,
assert_false(ts.contains("x1")) assert_false(ts.contains("x1"))
} }
} }
// Below the tab bar (40): heading (28), the two panel rows (30 each, buttons up at x 222-246, // Below the tab bar (40): heading (28), the two panel rows (30 each; in the 390-wide popup the
// down 248-272, remove 284-308), heading (28), "Clocks" (22), two Add rows (42 each), Browse. // buttons are up at x 292-316, down 318-342, remove 354-378), heading (28), "Clocks" (22), two Add rows (42 each), Browse.
ignore(p.on_event(true, PointerDown(20, 82))) // w1's row itself: nothing ignore(p.on_event(true, PointerDown(20, 82))) // w1's row itself: nothing
ignore(p.on_event(true, PointerDown(234, 82))) // w1 is first: up does nothing ignore(p.on_event(true, PointerDown(304, 82))) // w1 is first: up does nothing
ignore(p.on_event(true, PointerDown(260, 82))) // down ignore(p.on_event(true, PointerDown(330, 82))) // down
ignore(p.on_event(true, PointerDown(296, 112))) // w2's remove ignore(p.on_event(true, PointerDown(366, 112))) // w2's remove
ignore(p.on_event(true, PointerDown(20, 190))) // add the moon ignore(p.on_event(true, PointerDown(20, 190))) // add the moon
ignore(p.on_event(true, PointerDown(160, 285))) // browse ignore(p.on_event(true, PointerDown(160, 285))) // browse
assert_eq(drain(), [ assert_eq(drain(), [
@@ -252,9 +268,10 @@ test "interface explorer module toggles through the inspector capability" {
///| ///|
test "moon and digital clock modules render from the clock capability" { test "moon and digital clock modules render from the clock capability" {
let m = load_module("moon-disc") if load_optional_module("moon-disc") is Some(m) {
assert_true(m.render(36, 36, test_tokens()).length() > 3) assert_true(m.render(36, 36, test_tokens()).length() > 3)
m.unload() m.unload()
}
let c = load_module("clock-digital") let c = load_module("clock-digital")
let ts = texts_of(c.render(120, 36, test_tokens())) let ts = texts_of(c.render(120, 36, test_tokens()))
assert_true(ts[0].has_suffix("AM") || ts[0].has_suffix("PM")) // 12-hour by default assert_true(ts[0].has_suffix("AM") || ts[0].has_suffix("PM")) // 12-hour by default
+1 -1
View File
@@ -3,7 +3,7 @@
"theme": "moon-night", "theme": "moon-night",
"shell": {"component": "shell", "grants": ["theme"]}, "shell": {"component": "shell", "grants": ["theme"]},
"panel": [ "panel": [
{"id": "launcher", "component": "launcher", "align": "start", "grants": ["theme", "app-catalog", "app-launch"]}, {"id": "launcher", "component": "launcher", "align": "start", "grants": ["theme", "app-catalog", "app-launch", "session", "power"]},
{"id": "clock", "component": "clock-binary", "align": "end", "grants": ["theme", "clock"]} {"id": "clock", "component": "clock-binary", "align": "end", "grants": ["theme", "clock"]}
] ]
} }
+1 -1
View File
@@ -3,7 +3,7 @@
"theme": "moon-night", "theme": "moon-night",
"shell": {"component": "shell", "grants": ["theme"]}, "shell": {"component": "shell", "grants": ["theme"]},
"panel": [ "panel": [
{"id": "launcher", "component": "launcher", "align": "start", "grants": ["theme", "app-catalog", "app-launch"]}, {"id": "launcher", "component": "launcher", "align": "start", "grants": ["theme", "app-catalog", "app-launch", "session", "power"]},
{"id": "clock", "component": "clock-digital", "align": "end", "grants": ["theme", "clock"]} {"id": "clock", "component": "clock-digital", "align": "end", "grants": ["theme", "clock"]}
] ]
} }
+17 -1
View File
@@ -10,6 +10,9 @@ export function createPlatform({ now = () => new Date(), apps, tokens }) {
launches: [], launches: [],
now, now,
launchable: new Set(apps.map((a) => a.id)), launchable: new Set(apps.map((a) => a.id)),
// Session and power requests are recorded, not acted on: this host is in-memory.
sessionRequests: [],
power: { screenOffMinutes: 10, suspendMinutes: 0, requests: [] },
}; };
/** Capability name -> WIT interface implementation (jco import shape). */ /** Capability name -> WIT interface implementation (jco import shape). */
p.interfaces = { p.interfaces = {
@@ -32,8 +35,21 @@ export function createPlatform({ now = () => new Date(), apps, tokens }) {
return { tag: 'ok', val: undefined }; return { tag: 'ok', val: undefined };
}, },
}), }),
session: () => ({
logout() { p.sessionRequests.push('logout'); },
reload() { p.sessionRequests.push('reload'); },
}),
power: () => ({
screenOffMinutes: () => p.power.screenOffMinutes,
setScreenOffMinutes(m) { p.power.screenOffMinutes = m; },
suspendMinutes: () => p.power.suspendMinutes,
setSuspendMinutes(m) { p.power.suspendMinutes = m; },
suspend() { p.power.requests.push('suspend'); },
powerOff() { p.power.requests.push('power-off'); },
reboot() { p.power.requests.push('reboot'); },
}),
}; };
return p; return p;
} }
export const CAPABILITIES = ['theme', 'clock', 'app-catalog', 'app-launch']; export const CAPABILITIES = ['theme', 'clock', 'app-catalog', 'app-launch', 'session', 'power'];
+3 -3
View File
@@ -27,7 +27,7 @@ test('boots shell + widgets and composes a frame', async () => {
assert.deepEqual(f.screen, { w: 1280, h: 720 }); assert.deepEqual(f.screen, { w: 1280, h: 720 });
assert.ok(f.ops.length > 50); assert.ok(f.ops.length > 50);
const t = texts(f.ops); const t = texts(f.ops);
assert.ok(t.includes('14:07'), `clock text missing: ${t}`); assert.ok(t.includes('2:07 PM'), `clock text missing (Digital Clock starts in 12-hour mode): ${t}`);
assert.ok(t.includes('Tue 24 Nov')); assert.ok(t.includes('Tue 24 Nov'));
assert.ok(t.includes('chandra')); assert.ok(t.includes('chandra'));
assert.ok(t.includes('Applications')); assert.ok(t.includes('Applications'));
@@ -115,11 +115,11 @@ test('hot-swap: clock-digital -> clock-binary at runtime, other components untou
const before = await Promise.all(files.map(async (f) => (await stat(f)).mtimeMs)); const before = await Promise.all(files.map(async (f) => (await stat(f)).mtimeMs));
const { desktop } = await bootDesktop({ now: fixed }); const { desktop } = await bootDesktop({ now: fixed });
const a = desktop.frame(); const a = desktop.frame();
assert.ok(texts(a.ops).includes('14:07')); assert.ok(texts(a.ops).includes('2:07 PM'));
const launcherInstance = desktop.widgets.find((w) => w.id === 'launcher').plasmoid; const launcherInstance = desktop.widgets.find((w) => w.id === 'launcher').plasmoid;
await desktop.swap('clock', 'clock-binary'); await desktop.swap('clock', 'clock-binary');
const b = desktop.frame(); const b = desktop.frame();
assert.ok(!texts(b.ops).includes('14:07')); assert.ok(!texts(b.ops).includes('2:07 PM'));
assert.ok(b.ops.filter((o) => o.tag === 'circle').length >= 20, 'binary clock dots drawn'); assert.ok(b.ops.filter((o) => o.tag === 'circle').length >= 20, 'binary clock dots drawn');
assert.equal(desktop.widgets.find((w) => w.id === 'launcher').plasmoid, launcherInstance, 'launcher instance reused'); assert.equal(desktop.widgets.find((w) => w.id === 'launcher').plasmoid, launcherInstance, 'launcher instance reused');
const after = await Promise.all(files.map(async (f) => (await stat(f)).mtimeMs)); const after = await Promise.all(files.map(async (f) => (await stat(f)).mtimeMs));
+12 -1
View File
@@ -40,5 +40,16 @@ if [ "$(cat "$CAPI/VERSION" 2>/dev/null)" != "$WASMTIME_VERSION" ]; then
cp -r "$tmp"/wasmtime-*-c-api/include "$tmp"/wasmtime-*-c-api/lib "$CAPI/" cp -r "$tmp"/wasmtime-*-c-api/include "$tmp"/wasmtime-*-c-api/lib "$CAPI/"
echo "$WASMTIME_VERSION" > "$CAPI/VERSION" echo "$WASMTIME_VERSION" > "$CAPI/VERSION"
fi fi
# The wasmer C API (libwasmer + wasm.h) for the native compositor (compositor/wasm, compositor/host,
# compositor/bin link -lwasmer): .tools/wasmer/{include,lib}. scripts/test.sh puts it on the C paths.
WASMER="$ROOT/.tools/wasmer"
if [ "$(cat "$WASMER/VERSION" 2>/dev/null)" != "$WASMER_VERSION" ]; then
echo ">> wasmer C API $WASMER_VERSION"
mkdir -p "$tmp/wasmer"
curl -fsSL "https://github.com/wasmerio/wasmer/releases/download/v$WASMER_VERSION/wasmer-linux-amd64.tar.gz" | tar xz -C "$tmp/wasmer"
rm -rf "$WASMER"; mkdir -p "$WASMER"
cp -r "$tmp"/wasmer/include "$tmp"/wasmer/lib "$WASMER/"
echo "$WASMER_VERSION" > "$WASMER/VERSION"
fi
echo "installed into $BIN:" echo "installed into $BIN:"
"$BIN/wasm-tools" --version; "$BIN/wit-bindgen" --version; "$BIN/wasmtime" --version; echo "wasmtime C API $(cat "$CAPI/VERSION") in $CAPI" "$BIN/wasm-tools" --version; "$BIN/wit-bindgen" --version; "$BIN/wasmtime" --version; echo "wasmtime C API $(cat "$CAPI/VERSION") in $CAPI"; echo "wasmer C API $(cat "$WASMER/VERSION") in $WASMER"
+14 -2
View File
@@ -14,7 +14,11 @@ step "moon check"
moon check moon check
step "moon test (pure logic, wasm target)" step "moon test (pure logic, wasm target)"
moon test # compositor/* is left out: on the wasm target those packages import chandra:host/* (the native
# host supplies them), so a plain wasm test runner can't instantiate them. They run natively below.
mapfile -t wasm_pkgs < <(find . -name moon.pkg -not -path './.mooncakes/*' -not -path './_build/*' \
-not -path './.tools/*' -not -path './compositor/*' -not -path '*/node_modules/*' -printf '%h\n' | sed 's#^\./##' | sort)
moon test "${wasm_pkgs[@]}"
step "build components" step "build components"
scripts/build.sh scripts/build.sh
@@ -36,6 +40,14 @@ step "host integration tests (jco + Node)"
(cd host && npm test) (cd host && npm test)
step "pure-MoonBit native Wayland compositor + wasi-gfx + e2e tests (compositor/)" step "pure-MoonBit native Wayland compositor + wasi-gfx + e2e tests (compositor/)"
# The native compositor links the wasmer C API (scripts/setup-toolchain.sh puts it in .tools/wasmer).
WASMER="$ROOT/.tools/wasmer"
if [ -d "$WASMER/lib" ]; then
export C_INCLUDE_PATH="$WASMER/include${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}"
export LIBRARY_PATH="$WASMER/lib${LIBRARY_PATH:+:$LIBRARY_PATH}"
export LD_LIBRARY_PATH="$WASMER/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
XDG_CONFIG_HOME="$(mktemp -d)" CHANDRA_TEST_CONFIG=1 \ XDG_CONFIG_HOME="$(mktemp -d)" CHANDRA_TEST_CONFIG=1 \
moon test --target native --warn-list -a compositor/renderer compositor/gfx compositor/wasm compositor/host moon test --target native --warn-list -a compositor/renderer compositor/gfx compositor/wasm \
compositor/network compositor/portal compositor/host
moon build --target native --warn-list -a compositor/bin moon build --target native --warn-list -a compositor/bin
+1
View File
@@ -3,3 +3,4 @@ WASM_TOOLS_VERSION=1.263.0
WIT_BINDGEN_VERSION=0.63.0 WIT_BINDGEN_VERSION=0.63.0
WASMTIME_VERSION=51.0.0 WASMTIME_VERSION=51.0.0
JCO_VERSION=1.42.0 JCO_VERSION=1.42.0
WASMER_VERSION=6.1.0