refactor(test): hoist duplicated test helpers into ailang-test-support
closes #60 The fixture-corpus filter (NON_PARSEABLE_FIXTURES + list_ail_fixtures) was copy-pasted across three test crates and drifted out of sync as new reject fixtures landed; the examples_dir / workspace_root path walk was reimplemented ~30 more times across the suite, under two spellings (workspace_root / ws_root). Introduce crates/ailang-test-support — a zero-dependency, dev-only leaf crate — as the single home for these helpers: - NON_PARSEABLE_FIXTURES, list_ail_fixtures - workspace_root, examples_dir - canonical_workspace_root (symlink-resolved variant, for the tsan/ race tests that feed the root into native build steps) All integration-test copies across ailang-core, ailang-surface, ailang-prose, ailang-check, and ail now import from the shared crate; the local definitions and their now-orphaned path imports are removed. Path helpers resolve via the support crate's own CARGO_MANIFEST_DIR, so they return the correct absolute paths from any caller. ail_bin helpers are intentionally left in place: they depend on env!("CARGO_BIN_EXE_ail"), which Cargo only defines when compiling the ail crate's own integration tests, so they cannot move to a shared crate. Behaviour-identical: same paths, same fixture lists; full workspace test suite green. Net -177 LOC.
This commit is contained in:
@@ -23,14 +23,12 @@
|
||||
//! `e2e.rs::build_and_run_with_rc_stats` (the runtime's fixed
|
||||
//! `ailang_rc_stats: allocs=N frees=M live=K` shape).
|
||||
|
||||
use ailang_test_support::workspace_root;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn ail_bin() -> &'static str { env!("CARGO_BIN_EXE_ail") }
|
||||
fn manifest() -> PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")) }
|
||||
fn ws_root() -> PathBuf {
|
||||
manifest().parent().unwrap().parent().unwrap().to_path_buf()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct RcStats {
|
||||
@@ -44,7 +42,7 @@ struct RcStats {
|
||||
/// `AILANG_RC_STATS=1`, and return the `ailang_ctx_free` readback.
|
||||
fn build_link_run_embed(fixture: &str, host_rel: &str, extra_cc: &[&str]) -> RcStats {
|
||||
let module = fixture.strip_suffix(".ail").expect("fixture is a .ail file");
|
||||
let fixture_path = ws_root().join("examples").join(fixture);
|
||||
let fixture_path = workspace_root().join("examples").join(fixture);
|
||||
let host_c = manifest().join("tests").join(host_rel);
|
||||
let outdir = std::env::temp_dir().join(format!(
|
||||
"ail-embed-record-e2e-{}-{}",
|
||||
|
||||
Reference in New Issue
Block a user