818177d835
Tasks 1-3 of docs/plans/embedding-abi-m1.1.md, a verified known-good subset (cargo build --workspace exit 0; full workspace green; the roundtrip_cli all-examples gate green): - Task 1: CLI build-path MissingEntryMain baseline pin (examples/embed_noentry_baseline.ail + embed_missing_main_baseline.rs; triple-assertion, layered on the green codegen-unit pin lib.rs:3314). - Task 2: additive FnDef.export: Option<String> (serde default + skip_serializing_if, modelled on FnDef.doc); compile-driven thread of export: None across ~85 FnDef/AstFnDef literals / 18 files incl. all in-source #[cfg(test)] mod tests + drift/hash/spec-drift literals + the codegen lib.rs:3320 in-source pin; hash-stability golden pin; DESIGN.md fn-JSON "export" line. DONE_WITH_CONCERNS (plan symbol content_hash_fn -> def_hash per hash_pin.rs, plan- pseudo-vs-reality class, plan corrected). - Task 3: Form-A (export "<sym>") modifier — parse_export + parse_fn thread + write_fn_def emission + form_a.md grammar; byte-identical round-trip. Task 4 BLOCKED (Boss plan-defect: fixtures declared module != file stem; AILang's loader hard-enforces module==stem at workspace.rs:438, so ail check panicked on load before the gate). Boss resolution (Option 2, overriding the orchestrator's Option 1, rationale in the journal + plan Design-decision 6): keep descriptive embed_* filenames, rename fixture MODULES to their stems — the C symbol backtest_step stays via (export ...), demonstrating spec Decision 2's mangling- decoupling rather than violating it; archive becomes libembed_backtest_step.a, internal symbol @ail_embed_backtest_step_step, host.c unchanged. Plan fixed (Design-decision 6 + Task-4 module==stem + Task-5/6/7 dependent strings + the no-*. Float-head + content_hash_fn concerns folded). Headline fixture corrected; blocked-Task-4 WIP discarded (recreated by the [4,7] re-dispatch from the fixed plan). PARTIAL commit (not the iter's final commit): the implement Repair path mandates committing the known-good subset so the [4,7] re-dispatch starts from a clean tree that includes Tasks 1-3 (Tasks 4-7 structurally depend on the schema field + surface). INDEX line added when the full iter lands post-re-dispatch.
62 lines
2.0 KiB
Rust
62 lines
2.0 KiB
Rust
//! Baseline pin (Embedding-ABI M1, spec Testing-strategy item 0):
|
|
//! `ail build` (default executable mode) on a `main`-free module
|
|
//! surfaces `CodegenError::MissingEntryMain` at the CLI build-path
|
|
//! layer. The staticlib emit-mode (Task 5/6) is *defined* as
|
|
//! suppressing exactly this rejection; this pin guards the baseline
|
|
//! at the layer the suppression branches on. The codegen-unit layer
|
|
//! is independently pinned by
|
|
//! `crates/ailang-codegen/src/lib.rs` `missing_entry_main_is_error`.
|
|
//!
|
|
//! Pure reader: writes nothing to the repo.
|
|
|
|
use std::path::{Path, PathBuf};
|
|
use std::process::Command;
|
|
|
|
fn ail_bin() -> &'static str {
|
|
env!("CARGO_BIN_EXE_ail")
|
|
}
|
|
|
|
fn workspace_root() -> PathBuf {
|
|
let manifest_dir = env!("CARGO_MANIFEST_DIR");
|
|
Path::new(manifest_dir).parent().unwrap().parent().unwrap().to_path_buf()
|
|
}
|
|
|
|
#[test]
|
|
fn ail_build_on_main_free_module_is_rejected_at_cli() {
|
|
let fixture = workspace_root()
|
|
.join("examples")
|
|
.join("embed_noentry_baseline.ail");
|
|
assert!(fixture.exists(), "missing fixture {fixture:?}");
|
|
|
|
let out_bin = std::env::temp_dir().join(format!(
|
|
"ailang-embed-baseline-{}", std::process::id()
|
|
));
|
|
let output = Command::new(ail_bin())
|
|
.args([
|
|
"build",
|
|
fixture.to_str().unwrap(),
|
|
"-o",
|
|
out_bin.to_str().unwrap(),
|
|
])
|
|
.output()
|
|
.expect("run `ail build`");
|
|
|
|
assert!(
|
|
!output.status.success(),
|
|
"ail build of a main-free module unexpectedly succeeded; \
|
|
stdout={} stderr={}",
|
|
String::from_utf8_lossy(&output.stdout),
|
|
String::from_utf8_lossy(&output.stderr),
|
|
);
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(
|
|
stderr.contains("has no `main` def"),
|
|
"expected the MissingEntryMain message \
|
|
(`entry module ... has no `main` def`); got stderr: {stderr}",
|
|
);
|
|
assert!(
|
|
!out_bin.exists(),
|
|
"no binary should be produced for a main-free module",
|
|
);
|
|
}
|