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
77 changes: 42 additions & 35 deletions .github/workflows/actions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ workflows:
- 'actions/checkout@v7.0.1'
- 'mlugg/setup-zig@v2.2.1'
'.github/workflows/governance.yml':
- 'hyperpolymath/standards@571cc734cd69fb846032ec77a662aa8ee4fc32cd'
- 'metadatastician/standards@be39f900665fb7c042c05d1165da018adc1860f4'
'.github/workflows/hypatia-scan.yml':
- 'hyperpolymath/standards@571cc734cd69fb846032ec77a662aa8ee4fc32cd'
- 'metadatastician/standards@be39f900665fb7c042c05d1165da018adc1860f4'
'.github/workflows/instant-sync.yml':
- 'peter-evans/repository-dispatch@v4.0.1'
'.github/workflows/label-triage.yml': []
'.github/workflows/labels.yml': []
'.github/workflows/lock-sync-gate.yml': []
'.github/workflows/mirror.yml':
- 'hyperpolymath/standards@571cc734cd69fb846032ec77a662aa8ee4fc32cd'
- 'metadatastician/standards@be39f900665fb7c042c05d1165da018adc1860f4'
'.github/workflows/push-email-notify.yml':
- 'dawidd6/action-send-mail@27bf7a883db6de205849f760badd38a1a3ce0dd0'
'.github/workflows/rust-ci.yml':
- 'actions/checkout@v7.0.1'
- 'dtolnay/rust-toolchain@v1'
- 'swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0'
'.github/workflows/scorecard.yml':
- 'hyperpolymath/standards@571cc734cd69fb846032ec77a662aa8ee4fc32cd'
- 'metadatastician/standards@be39f900665fb7c042c05d1165da018adc1860f4'
'.github/workflows/secret-scanner.yml':
- 'hyperpolymath/standards@571cc734cd69fb846032ec77a662aa8ee4fc32cd'
- 'metadatastician/standards@be39f900665fb7c042c05d1165da018adc1860f4'
'.github/workflows/status-gate.yml':
- 'actions/checkout@v7.0.1'
- 'dtolnay/rust-toolchain@v1'
Expand All @@ -54,9 +54,14 @@ dependencies:
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a':
ref: 'v7.0.1'
commit: 'sha1-043fb46d1a93c77aae656e7c1c64a875d1fc6a0a'
'actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333':
ref: 'v8.0.2'
commit: 'sha1-9000827ccba6bdab643e8b6fd33ac0654aef8333'
owner_id: 44036562
repo_id: 192626254
'actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9':
ref: 'v7.0.2'
commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9'
owner_id: 44036562
repo_id: 192625955
'dawidd6/action-send-mail@27bf7a883db6de205849f760badd38a1a3ce0dd0':
Expand All @@ -69,19 +74,19 @@ dependencies:
commit: 'sha1-22d081ff2d3a40755e97629de92e3bcbfa7cf2ed'
owner_id: 42048915
repo_id: 356423100
'dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772':
ref: '6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772'
commit: 'sha1-6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772'
'dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8':
ref: 'v1'
commit: 'sha1-683b588c487a69d01f6c6ddf40f036ff682cc2c8'
owner_id: 1940490
repo_id: 260749683
'dtolnay/rust-toolchain@v1':
ref: 'v1'
commit: 'sha1-02cb101ec7c40f2c49e1d9714d64511d8e1b74de'
owner_id: 1940490
repo_id: 260749683
'editorconfig-checker/action-editorconfig-checker@840e866d93b8e032123c23bac69dece044d4d84c':
ref: 'v2.2.0'
commit: 'sha1-840e866d93b8e032123c23bac69dece044d4d84c'
'editorconfig-checker/action-editorconfig-checker@51f63319f592f97930c73d9c46184d20bd206393':
ref: 'v3.0.0'
commit: 'sha1-51f63319f592f97930c73d9c46184d20bd206393'
owner_id: 26415196
repo_id: 297874902
'erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124':
Expand All @@ -94,54 +99,56 @@ dependencies:
commit: 'sha1-33d7b85da1a04171e211befe2c739303b9a4c066'
owner_id: 9919
repo_id: 259445878
'github/codeql-action@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28':
ref: 'v4.37.8'
commit: 'sha1-db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28'
'github/codeql-action@b96794f015dfd88f77b49b1c93e0fa7110f94c63':
ref: 'v4.38.0'
commit: 'sha1-b96794f015dfd88f77b49b1c93e0fa7110f94c63'
owner_id: 9919
repo_id: 259445878
'goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406':
ref: 'v2.2.1'
commit: 'sha1-abea47f85e598557f500fa1fd2ab7464fcb39406'
owner_id: 1006268
repo_id: 212984112
'hyperpolymath/standards@571cc734cd69fb846032ec77a662aa8ee4fc32cd':
ref: '571cc734cd69fb846032ec77a662aa8ee4fc32cd'
commit: 'sha1-571cc734cd69fb846032ec77a662aa8ee4fc32cd'
owner_id: 6759885
'metadatastician/standards@be39f900665fb7c042c05d1165da018adc1860f4':
ref: 'be39f900665fb7c042c05d1165da018adc1860f4'
commit: 'sha1-be39f900665fb7c042c05d1165da018adc1860f4'
owner_id: 297579217
repo_id: 1116521501
uses:
- 'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9'
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
- 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a'
- 'actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333'
- 'actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9'
- 'denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed'
- 'dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772'
- 'editorconfig-checker/action-editorconfig-checker@840e866d93b8e032123c23bac69dece044d4d84c'
- 'dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8'
- 'editorconfig-checker/action-editorconfig-checker@51f63319f592f97930c73d9c46184d20bd206393'
- 'erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124'
- 'github/codeql-action@db488ddef3bf6cb639b32c2e9a7c0a7ea8271d28'
- 'github/codeql-action@b96794f015dfd88f77b49b1c93e0fa7110f94c63'
- 'goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406'
- 'ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc'
- 'swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6'
- 'ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e'
- 'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6'
- 'swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0'
- 'webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555'
'mlugg/setup-zig@v2.2.1':
ref: 'v2.2.1'
commit: 'sha1-d1434d08867e3ee9daa34448df10607b98908d29'
owner_id: 7289241
repo_id: 812112570
'ossf/scorecard-action@2d1146689b8cda280b9bc96326124645441f03bc':
ref: 'v2.4.4'
commit: 'sha1-2d1146689b8cda280b9bc96326124645441f03bc'
'ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e':
ref: 'v2.5.0'
commit: 'sha1-fa7117db83c52d787ae5a89f350999701505d78e'
owner_id: 67707773
repo_id: 421101922
'oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6':
ref: 'v2.2.0'
commit: 'sha1-0c5077e51419868618aeaa5fe8019c62421857d6'
owner_id: 108928776
repo_id: 512644635
'peter-evans/repository-dispatch@v4.0.1':
ref: 'v4.0.1'
commit: 'sha1-28959ce8df70de7be546dd1250a005dd32156697'
owner_id: 18365890
repo_id: 220359305
'swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6':
ref: 'v2.9.2'
commit: 'sha1-6323deb102c322ba6fcbdcafc7e3dddab59af2b6'
owner_id: 580492
repo_id: 298565987
'swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0':
ref: 'v2.9.3'
commit: 'sha1-d1527c8f67ef9af357290475d4af4b0fab8f12e0'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/governance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ permissions:

jobs:
governance:
uses: hyperpolymath/standards/.github/workflows/governance-reusable.yml@571cc734cd69fb846032ec77a662aa8ee4fc32cd
uses: metadatastician/standards/.github/workflows/governance-reusable.yml@be39f900665fb7c042c05d1165da018adc1860f4
2 changes: 1 addition & 1 deletion .github/workflows/hypatia-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ permissions:

jobs:
hypatia:
uses: hyperpolymath/standards/.github/workflows/hypatia-scan-reusable.yml@571cc734cd69fb846032ec77a662aa8ee4fc32cd
uses: metadatastician/standards/.github/workflows/hypatia-scan-reusable.yml@be39f900665fb7c042c05d1165da018adc1860f4
15 changes: 13 additions & 2 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,16 @@ permissions:

jobs:
mirror:
uses: hyperpolymath/standards/.github/workflows/mirror-reusable.yml@571cc734cd69fb846032ec77a662aa8ee4fc32cd
secrets: inherit
uses: metadatastician/standards/.github/workflows/mirror-reusable.yml@be39f900665fb7c042c05d1165da018adc1860f4
# Named secrets only; `secrets: inherit` forwards every secret (standards#1108 §6b).
secrets:
GITLAB_SSH_KEY: ${{ secrets.GITLAB_SSH_KEY }}
BITBUCKET_SSH_KEY: ${{ secrets.BITBUCKET_SSH_KEY }}
CODEBERG_SSH_KEY: ${{ secrets.CODEBERG_SSH_KEY }}
SOURCEHUT_SSH_KEY: ${{ secrets.SOURCEHUT_SSH_KEY }}
DISROOT_SSH_KEY: ${{ secrets.DISROOT_SSH_KEY }}
GITEA_SSH_KEY: ${{ secrets.GITEA_SSH_KEY }}
RADICLE_KEY: ${{ secrets.RADICLE_KEY }}
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_AGE_RECIPIENT: ${{ secrets.R2_AGE_RECIPIENT }}
2 changes: 1 addition & 1 deletion .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ concurrency:

jobs:
rust-ci:
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@571cc734cd69fb846032ec77a662aa8ee4fc32cd
uses: metadatastician/standards/.github/workflows/rust-ci-reusable.yml@be39f900665fb7c042c05d1165da018adc1860f4

no-default-features:
name: Cargo build + test (ephapax-cli, --no-default-features)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ permissions:
jobs:
scorecard:
permissions:
actions: read
contents: read
security-events: write
id-token: write
uses: hyperpolymath/standards/.github/workflows/scorecard-reusable.yml@571cc734cd69fb846032ec77a662aa8ee4fc32cd
uses: metadatastician/standards/.github/workflows/scorecard-reusable.yml@be39f900665fb7c042c05d1165da018adc1860f4
3 changes: 1 addition & 2 deletions .github/workflows/secret-scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ jobs:
contents: read
pull-requests: write
actions: read
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@571cc734cd69fb846032ec77a662aa8ee4fc32cd
secrets: inherit
uses: metadatastician/standards/.github/workflows/secret-scanner-reusable.yml@be39f900665fb7c042c05d1165da018adc1860f4
4 changes: 2 additions & 2 deletions TEST-NEEDS.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ compliance, 16 tests)
performance, correctness, 13 tests)
* Benchmarks: `+src/ephapax-parser/benches/parse_bench.rs+`,
`+src/ephapax-vram-cache/benches/cache_bench.rs+`
* Total: *554 tests* (`+cargo test --workspace --all-targets+`);
* Total: *568 tests* (`+cargo test --workspace --all-targets+`);
pass/fail enforced by `+rust-ci.yml+`
* Documented all-target tests: 554
* Documented all-target tests: 568

=== CRG Testing Taxonomy — Status

Expand Down
21 changes: 17 additions & 4 deletions scripts/probe-battery.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,19 @@ done
die() { echo "probe-battery: $*" >&2; exit 3; }

[ -f "$EXPECT" ] || die "missing $EXPECT"
# GNU timeout reports expiry as 124. BusyBox reports it as 143, the same
# status as a genuine SIGTERM, so a timeout would read as `crash:143`.
timeout --version 2>/dev/null | grep -q GNU || die "GNU coreutils timeout is required"

# timed CMD...: run under PROBE_TIMEOUT. A command that ignores SIGTERM is
# killed 5 s later; that escalated kill (137 after the deadline) is still a
# timeout, so report it as 124.
timed() {
local start=$SECONDS rc
timeout -k 5 "$PROBE_TIMEOUT" "$@"; rc=$?
if [[ "$rc" -eq 137 && $((SECONDS - start)) -ge "$PROBE_TIMEOUT" ]]; then rc=124; fi
return "$rc"
}
[ -f "$ENV_WAT" ] || die "missing $ENV_WAT"

if [ -z "$bin" ]; then
Expand Down Expand Up @@ -171,19 +184,19 @@ run_row() { # PROBE COMMAND -> sets CODE TEXT VERDICT
mkdir -p "$stage/out"
case "$cmd" in
check|run)
TEXT="$(cd "$dir" && timeout "$PROBE_TIMEOUT" "$bin" "$cmd" "$base" 2>&1)"
TEXT="$(cd "$dir" && timed "$bin" "$cmd" "$base" 2>&1)"
CODE=$?
;;
compile)
TEXT="$(cd "$dir" && timeout "$PROBE_TIMEOUT" "$bin" compile "$base" -o "$wasm" 2>&1)"
TEXT="$(cd "$dir" && timed "$bin" compile "$base" -o "$wasm" 2>&1)"
CODE=$?
;;
wasm-run)
# Keep the compiler's exit status and output. An ordinary compile
# error means there is no module to run (`no-module`); a compile
# that times out or dies by a signal is reported as such (`timeout`,
# `crash:<exit>`), so it cannot pass as SAME against a no-module row.
TEXT="$(cd "$dir" && timeout "$PROBE_TIMEOUT" "$bin" compile "$base" -o "$wasm" 2>&1)"
TEXT="$(cd "$dir" && timed "$bin" compile "$base" -o "$wasm" 2>&1)"
CODE=$?
if [[ "$CODE" -ne 0 ]]; then
if [[ "$CODE" -eq 126 || "$CODE" -eq 127 ]]; then
Expand All @@ -200,7 +213,7 @@ run_row() { # PROBE COMMAND -> sets CODE TEXT VERDICT
if [[ -z "$wasmtime_bin" ]]; then
CODE=0; TEXT="wasmtime CLI not found"; VERDICT="unavailable:no-wasmtime"; return
fi
TEXT="$(timeout "$PROBE_TIMEOUT" "$wasmtime_bin" run --preload "env=$ENV_WAT" --invoke main "$wasm" 2>&1)"
TEXT="$(timed "$wasmtime_bin" run --preload "env=$ENV_WAT" --invoke main "$wasm" 2>&1)"
CODE=$?
;;
*) die "unknown command '$cmd' in $EXPECT" ;;
Expand Down
33 changes: 33 additions & 0 deletions src/ephapax-cli/tests/fail_loud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,39 @@ fn codegen_refuses_raw_ffi_in_unchecked_module() {
);
}

/// The scan must reach raw FFI below a supported node (here a `let`
/// value), not only at the top of a function body.
#[test]
fn codegen_refuses_raw_ffi_nested_in_a_let_value() {
let ffi = Expr::dummy(ExprKind::FFI {
symbol: "foo".into(),
args: vec![],
});
let module = Module {
name: "nested".into(),
imports: vec![],
decls: vec![Decl::Fn {
name: "t".into(),
visibility: Visibility::Private,
type_params: vec![],
params: vec![],
ret_ty: Ty::Base(ephapax_syntax::BaseTy::I32),
body: Expr::dummy(ExprKind::Let {
name: "x".into(),
ty: None,
value: Box::new(ffi),
body: Box::new(Expr::dummy(ExprKind::Lit(Literal::I32(0)))),
}),
}],
};
let err = compile_module(&module).expect_err("nested raw FFI must not lower");
assert!(
err.0.starts_with(UNSUPPORTED_PREFIX) && err.0.contains("__ffi"),
"{}",
err.0
);
}

#[test]
fn g5_extern_rewrite_has_contiguous_imports_and_validates() {
let dir = tempfile::tempdir().expect("tempdir");
Expand Down
60 changes: 55 additions & 5 deletions src/ephapax-cli/tests/linearity_holes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ fn main(): I32 =
}
";

/// Projection from a three-element tuple goes through `check_tuple_index`
/// (a two-element tuple is a pair): `.2` would lose the linear `s`.
const TUPLEIDX3: &str = "\
fn main(): I32 =
region r {
let s = String.new@r(\"a\") in
let t = (s, 1, 2) in
t.2
}
";

/// Pair destructuring whose body is an `I64` extern call: the lowered
/// core `match` must carry an `i64` result, not the default `i32`.
const DESTRUCT_I64: &str = "\
extern \"c\" {
fn clock_gettime(): I64
}
fn f(p: (I32, I32)): I64 =
let (a, b) = p in clock_gettime()
fn main(): I32 = 0
";

/// List index from a list of linear strings: the other elements would
/// be lost.
const LISTIDX: &str = "\
Expand Down Expand Up @@ -379,6 +401,15 @@ fn tuple_projection_from_linear_tuple_rejected() {
assert_cli_rejects("tupleidx", TUPLEIDX);
}

#[test]
fn three_element_tuple_projection_from_linear_tuple_rejected() {
assert!(matches!(
type_error(TUPLEIDX3),
TypeError::LinearProjectionDiscard(Ty::Tuple(_))
));
assert_cli_rejects("tupleidx3", TUPLEIDX3);
}

#[test]
fn list_index_from_linear_list_rejected() {
assert!(matches!(
Expand Down Expand Up @@ -466,12 +497,31 @@ fn pair_destructuring_lowering_computes_correct_value() {
}

#[test]
fn multi_field_constructor_destructuring_checks() {
// Type-level only. The wasm for a nested pair payload is wrong on
// the base commit too (`fst((1, (2, 3)))` evaluates to 521 with the
// pre-E0 compiler), a codegen defect outside E0, so this gate does
// not assert the runtime value of a three-field payload.
fn multi_field_constructor_destructuring_computes_correct_value() {
// A three-field payload is a nested pair. Before the bump pointer was
// initialised, the first heap cell overwrote it and this read back
// corrupted fields (`fst((1, (2, 3)))` gave 521).
pipeline(DESTRUCT3).expect("three-field constructor destructuring type-checks");
assert_eq!(compile_and_run("destruct3", DESTRUCT3), 321);
}

#[test]
fn pair_destructuring_keeps_an_i64_result_type() {
pipeline(DESTRUCT_I64).expect("type-checks");
let dir = tempfile::tempdir().expect("tempdir");
let path = write_probe(dir.path(), "destruct_i64", DESTRUCT_I64);
let out = Command::new(ephapax_bin())
.arg("compile")
.arg(&path)
.arg("-o")
.arg(dir.path().join("destruct_i64.wasm"))
.output()
.expect("run ephapax compile");
assert!(
out.status.success(),
"an I64 arm body must give valid wasm:\n{}",
String::from_utf8_lossy(&out.stderr)
);
}

// ---------------------------------------------------------------------
Expand Down
Loading
Loading