Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 16 additions & 41 deletions checksums/tools/wasmtime.json
Original file line number Diff line number Diff line change
@@ -1,80 +1,55 @@
{
"tool_name": "wasmtime",
"github_repo": "bytecodealliance/wasmtime",
"latest_version": "39.0.1",
"last_checked": "2025-12-04T00:00:00.000000Z",
"latest_version": "41.0.1",
"last_checked": "2026-01-31T00:00:00.000000Z",
"versions": {
"39.0.1": {
"release_date": "2025-11-24",
"41.0.1": {
"release_date": "2026-01-26",
"platforms": {
"darwin_amd64": {
"sha256": "d9ecdc6b423a59f09a63abe352f470d48fcd03a4d6bc0db5fcf57830f2832be6",
"sha256": "19dfb6b23295fad88091f0a4fe9c651b99366f3973e3676f8cc9572589550b32",
"url_suffix": "x86_64-macos.tar.xz"
},
"darwin_arm64": {
"sha256": "3878fc98ab1fec191476ddec5d195e6d018d7fbe5376e54d2c23aedf38aa1bd2",
"sha256": "c5a248f051c79e0ab8060d50d50d7ad8c77b5952c2eb22a1f1ae99da48c52794",
"url_suffix": "aarch64-macos.tar.xz"
},
"linux_amd64": {
"sha256": "b90a36125387b75db59a67a1c402f2ed9d120fa43670d218a559571e2423d925",
"sha256": "e0e96b9123c6190e3de303ef569f10ea0443fe7b0a2e0cc601be282b12689bce",
"url_suffix": "x86_64-linux.tar.xz"
},
"linux_arm64": {
"sha256": "bff5ebd3e6781620f40e5586f1aa221f7da98128dacf0142bfb4b25d12242274",
"url_suffix": "aarch64-linux.tar.xz"
},
"windows_amd64": {
"sha256": "bccf64b4227d178c0d13f2856be68876eae3f2f657f3a85d46f076a5e1976198",
"url_suffix": "x86_64-windows.zip"
}
}
},
"35.0.0": {
"release_date": "2025-07-22",
"platforms": {
"darwin_amd64": {
"sha256": "1ef7d07b8a8ef7e261281ad6a1b14ebf462f84c534593ca20e70ec8097524247",
"url_suffix": "x86_64-macos.tar.xz"
},
"linux_arm64": {
"sha256": "304009a9e4cad3616694b4251a01d72b77ae33d884680f3586710a69bd31b8f8",
"sha256": "b9b67f7026725e08018ec48b72b8b70554ecb3db6b2d76468e517f8e5ecf68c1",
"url_suffix": "aarch64-linux.tar.xz"
},
"linux_amd64": {
"sha256": "e3d2aae710a5cef548ab13f7e4ed23adc4fa1e9b4797049f4459320f32224011",
"url_suffix": "x86_64-linux.tar.xz"
},
"windows_amd64": {
"sha256": "cb4d9b788e81268edfb43d26c37dc4115060635ff4eceed16f4f9e6f331179b1",
"sha256": "b15aab059caefca3afe69dcaac9abd21bba90d73e2939cd9c074050ce0539f1a",
"url_suffix": "x86_64-windows.zip"
},
"darwin_arm64": {
"sha256": "8ad8832564e15053cd982c732fac39417b2307bf56145d02ffd153673277c665",
"url_suffix": "aarch64-macos.tar.xz"
}
}
},
"37.0.2": {
"release_date": "2025-09-04",
"39.0.1": {
"release_date": "2025-11-24",
"platforms": {
"darwin_amd64": {
"sha256": "6bbc40d77e4779f711af60314b32c24371ffc9dbcb5d8b9961bd93ecd9e0f111",
"sha256": "d9ecdc6b423a59f09a63abe352f470d48fcd03a4d6bc0db5fcf57830f2832be6",
"url_suffix": "x86_64-macos.tar.xz"
},
"darwin_arm64": {
"sha256": "369012921015d627c51fa9e1d1c5b7dff9b3d799a7ec5ce7d0b27bc40434e91c",
"sha256": "3878fc98ab1fec191476ddec5d195e6d018d7fbe5376e54d2c23aedf38aa1bd2",
"url_suffix": "aarch64-macos.tar.xz"
},
"linux_amd64": {
"sha256": "a84fef229c2d11e3635ea369688971dc48abc0732f7b50b696699183043f962e",
"sha256": "b90a36125387b75db59a67a1c402f2ed9d120fa43670d218a559571e2423d925",
"url_suffix": "x86_64-linux.tar.xz"
},
"linux_arm64": {
"sha256": "eb306a71e3ec232815326ca6354597b43c565b9ceda7d771529bfc4bd468dde9",
"sha256": "bff5ebd3e6781620f40e5586f1aa221f7da98128dacf0142bfb4b25d12242274",
"url_suffix": "aarch64-linux.tar.xz"
},
"windows_amd64": {
"sha256": "9aaa2406c990e773cef8d90f409982fac28d3d330ad40a5fab1233b8c5d88795",
"sha256": "bccf64b4227d178c0d13f2856be68876eae3f2f657f3a85d46f076a5e1976198",
"url_suffix": "x86_64-windows.zip"
}
}
Expand Down
84 changes: 84 additions & 0 deletions test/moonbit/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
"""MoonBit WebAssembly Component Tests

Tests for MoonBit component integration, including:
- Analysis tests for moonbit_wasm_component rule
- Signed integer type tests (tracking upstream bug #1518)

Note: MoonBit toolchain is only available on:
- darwin_arm64 (Apple Silicon Mac)
- linux_amd64 (x86_64 Linux)
- windows_amd64 (x86_64 Windows)

Tests are tagged 'manual' to skip on unsupported platforms (darwin_amd64/Intel Mac).
"""

load("//moonbit:defs.bzl", "moonbit_wasm_component")
load(":moonbit_component_tests.bzl", "moonbit_component_analysis_test", "moonbit_signed_integers_test", "moonbit_test_suite")

package(default_visibility = ["//visibility:public"])

# =============================================================================
# Test Components
# =============================================================================

# Basic calculator component for analysis tests
moonbit_wasm_component(
name = "calculator_test_component",
srcs = ["//examples/moonbit_component:calculator.mbt"],
wit = "//examples/moonbit_component:calculator.wit",
world = "calculator",
tags = ["manual"], # MoonBit toolchain platform-limited
)

# Signed integers test component (tests upstream bug #1518)
moonbit_wasm_component(
name = "signed_integers_component",
srcs = ["signed_integers.mbt"],
wit = "signed_integers.wit",
world = "signed-integers",
tags = ["manual"], # MoonBit toolchain platform-limited
)

# =============================================================================
# Analysis Tests
# =============================================================================

# Test that moonbit_wasm_component provides correct WasmComponentInfo
moonbit_component_analysis_test(
name = "moonbit_component_analysis_test",
target_under_test = ":calculator_test_component",
tags = ["manual"], # MoonBit toolchain platform-limited
)

# Test signed integer types (s8, s16) build correctly
# Note: Runtime value corruption is tracked in upstream #1518
moonbit_signed_integers_test(
name = "signed_integers_analysis_test",
target_under_test = ":signed_integers_component",
tags = ["manual"], # MoonBit toolchain platform-limited
)

# =============================================================================
# Test Suite
# =============================================================================

moonbit_test_suite(
name = "moonbit_tests",
)

# =============================================================================
# Build Tests (for CI on supported platforms)
# =============================================================================

# Genrule to validate component structure with wasm-tools
genrule(
name = "validate_signed_integers",
srcs = [":signed_integers_component"],
outs = ["signed_integers_valid.marker"],
cmd = """
$(location @rules_wasm_component//toolchains:wasm_tools) component wit $(location :signed_integers_component) > /dev/null && \
echo "MoonBit signed integers component validated" > $@
""",
tags = ["manual"], # MoonBit toolchain platform-limited
tools = ["@rules_wasm_component//toolchains:wasm_tools"],
)
159 changes: 159 additions & 0 deletions test/moonbit/moonbit_component_tests.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
"""Analysis test rules for MoonBit WebAssembly components.

This module provides testing for MoonBit component integration:
- Analysis tests for moonbit_wasm_component rule
- Provider validation for WasmComponentInfo with MoonBit-specific metadata
- Signed integer type tests for upstream bug tracking (#1518)

Related upstream issues:
- bytecodealliance/wit-bindgen#1518: s8/s16 lift corruption
- bytecodealliance/wit-bindgen#1517: async, flags, Option<T> issues
"""

load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
load("@rules_wasm_component//providers:providers.bzl", "WasmComponentInfo")

def _moonbit_component_analysis_test_impl(ctx):
"""Test that moonbit_wasm_component provides correct WasmComponentInfo."""
env = analysistest.begin(ctx)
target_under_test = analysistest.target_under_test(env)

# Check that target provides WasmComponentInfo
asserts.true(
env,
WasmComponentInfo in target_under_test,
"moonbit_wasm_component should provide WasmComponentInfo",
)

component_info = target_under_test[WasmComponentInfo]

# Validate WASM file output
asserts.true(
env,
hasattr(component_info, "wasm_file"),
"WasmComponentInfo should have wasm_file field",
)

wasm_file = component_info.wasm_file
asserts.true(
env,
wasm_file.basename.endswith(".wasm"),
"wasm_file should have .wasm extension",
)

# MoonBit components should be "reactor" type (library component)
asserts.true(
env,
hasattr(component_info, "component_type"),
"WasmComponentInfo should have component_type field",
)

asserts.equals(
env,
component_info.component_type,
"reactor",
"MoonBit components should be type 'reactor'",
)

# Validate metadata contains MoonBit-specific information
asserts.true(
env,
hasattr(component_info, "metadata"),
"WasmComponentInfo should have metadata field",
)

metadata = component_info.metadata
asserts.equals(
env,
metadata.get("language"),
"moonbit",
"Component metadata should indicate 'moonbit' language",
)

# Check DefaultInfo provides files
default_info = target_under_test[DefaultInfo]
files = default_info.files.to_list()
asserts.true(
env,
len(files) > 0,
"Target should provide output files",
)

# Check that the main WASM file is in the output
wasm_files = [f for f in files if f.basename.endswith(".wasm")]
asserts.true(
env,
len(wasm_files) > 0,
"Target should provide .wasm output files",
)

return analysistest.end(env)

moonbit_component_analysis_test = analysistest.make(_moonbit_component_analysis_test_impl)

def _moonbit_signed_integers_test_impl(ctx):
"""Test MoonBit component with signed integer types (s8, s16).

This test validates that components using s8/s16 types build successfully.
Note: The upstream bug (#1518) causes value corruption at runtime, not build time.
This test catches build regressions; runtime testing requires wasmtime invocation.
"""
env = analysistest.begin(ctx)
target_under_test = analysistest.target_under_test(env)

# Check that target provides WasmComponentInfo
asserts.true(
env,
WasmComponentInfo in target_under_test,
"Signed integers component should provide WasmComponentInfo",
)

component_info = target_under_test[WasmComponentInfo]

# Verify the component built successfully
asserts.true(
env,
component_info.wasm_file.basename.endswith(".wasm"),
"Component should produce .wasm file",
)

# Verify it's a reactor (library) component
asserts.equals(
env,
component_info.component_type,
"reactor",
"Signed integers test should be a reactor component",
)

# Verify exports list includes the signed integer functions
# Note: exports may be empty if WIT parsing is incomplete
exports = component_info.exports
if exports:
# If exports are populated, verify we have the expected ones
expected_exports = ["signed-integers"]
for expected in expected_exports:
asserts.true(
env,
expected in exports,
"Component should export '{}'".format(expected),
)

return analysistest.end(env)

moonbit_signed_integers_test = analysistest.make(_moonbit_signed_integers_test_impl)

def moonbit_test_suite(name):
"""Creates the MoonBit component test suite.

Args:
name: Name of the test suite target.
"""
native.test_suite(
name = name,
tests = [
":moonbit_component_analysis_test",
":signed_integers_analysis_test",
],
# MoonBit toolchain only available on darwin_arm64, linux_amd64, windows_amd64
tags = ["manual"],
)
56 changes: 56 additions & 0 deletions test/moonbit/signed_integers.mbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/// MoonBit Signed Integer Test Component
///
/// Tests for wit-bindgen MoonBit s8/s16 lift corruption bug (upstream #1518).
/// These functions should pass values through unchanged, but the bug causes
/// s8 and s16 values to be corrupted when lifted from WASM to host.

/// Identity for s8 - returns the same value.
/// Expected: identity_s8(-1) == -1
/// Bug: May return corrupted value due to lift issue.
pub fn identity_s8(value : Int) -> Int {
value
}

/// Identity for s16 - returns the same value.
/// Expected: identity_s16(-1) == -1
/// Bug: May return corrupted value due to lift issue.
pub fn identity_s16(value : Int) -> Int {
value
}

/// Identity for s32 - should work correctly (not affected by bug).
pub fn identity_s32(value : Int) -> Int {
value
}

/// Negate an s8 value.
/// Expected: negate_s8(127) == -127
pub fn negate_s8(value : Int) -> Int {
-value
}

/// Negate an s16 value.
/// Expected: negate_s16(32767) == -32767
pub fn negate_s16(value : Int) -> Int {
-value
}

/// Return minimum s8 value (-128).
pub fn min_s8() -> Int {
-128
}

/// Return maximum s8 value (127).
pub fn max_s8() -> Int {
127
}

/// Return minimum s16 value (-32768).
pub fn min_s16() -> Int {
-32768
}

/// Return maximum s16 value (32767).
pub fn max_s16() -> Int {
32767
}
Loading