diff --git a/.gitignore b/.gitignore index 881633e..a86549d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ target /deployment /.idea +# Cursor NAL traces (local-only; do not commit) +.cursor/nal-trace/ + # Snapcraft files stage prime diff --git a/Cargo.toml b/Cargo.toml index 1a5b85b..1c78ad3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,6 +48,8 @@ members = [ "crates/searcher", "crates/ignore", ] +# Standalone crate for CI fixture testing (`cargo check --manifest-path ci/fixtures/...`). +exclude = ["ci/fixtures/intentionally_buggy"] [dependencies] anyhow = "1.0.75" diff --git a/ci/fixtures/intentionally_buggy/Cargo.lock b/ci/fixtures/intentionally_buggy/Cargo.lock new file mode 100644 index 0000000..7a04c3b --- /dev/null +++ b/ci/fixtures/intentionally_buggy/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "intentionally_buggy" +version = "0.0.0" diff --git a/ci/fixtures/intentionally_buggy/Cargo.toml b/ci/fixtures/intentionally_buggy/Cargo.toml new file mode 100644 index 0000000..25486e5 --- /dev/null +++ b/ci/fixtures/intentionally_buggy/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "intentionally_buggy" +version = "0.0.0" +edition = "2024" +publish = false + +[features] +# Enable to exercise compile-failure paths in CI (e.g. `cargo check -F force_compile_error`). +force_compile_error = [] diff --git a/ci/fixtures/intentionally_buggy/src/lib.rs b/ci/fixtures/intentionally_buggy/src/lib.rs new file mode 100644 index 0000000..84e7b7d --- /dev/null +++ b/ci/fixtures/intentionally_buggy/src/lib.rs @@ -0,0 +1,37 @@ +//! Deliberately defective code for testing CI (lint gates, failure reporting, etc.). +//! This crate is **not** a workspace member; build it explicitly: +//! `cargo check --manifest-path ci/fixtures/intentionally_buggy/Cargo.toml` +//! `cargo test --manifest-path ...` is expected to fail (see `tests::deliberate_failure`). + +#![warn(unused)] +#![warn(clippy::all)] + +#[cfg(feature = "force_compile_error")] +compile_error!("intentional compile_error for CI fixture testing"); + +/// Returns `a / b`. Panics when `b == 0` — intentional logic defect. +pub fn sloppy_div(a: i32, b: i32) -> i32 { + a / b +} + +// Dead code: should trigger `dead_code` under `-D warnings` / strict CI. +fn never_called() -> u32 { + 42 +} + +pub fn unused_binding() -> i32 { + let x = 1; + let noise = 99; // unused variable: should warn + x + 2 +} + +#[cfg(test)] +mod tests { + use super::*; + + /// CI fixture: fails on purpose so `cargo test --manifest-path ...` exits non-zero. + #[test] + fn deliberate_failure() { + assert_eq!(sloppy_div(10, 2), 42); + } +} diff --git a/tests/ci_spotcheck.rs b/tests/ci_spotcheck.rs new file mode 100644 index 0000000..40464dd --- /dev/null +++ b/tests/ci_spotcheck.rs @@ -0,0 +1,13 @@ +//! Spot checks that only run (and fail) on selected cross targets. + +#[cfg(target_arch = "riscv64")] +#[test] +fn ci_spot_fail_riscv64() { + assert!(false, "intentional failure on riscv64 CI only"); +} + +#[cfg(target_arch = "s390x")] +#[test] +fn ci_spot_fail_s390x() { + assert!(false, "intentional failure on s390x CI only"); +} diff --git a/tests/tests.rs b/tests/tests.rs index 81e40f8..a07d6e8 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -20,3 +20,5 @@ mod misc; mod multiline; // Regression tests. mod regression; +// Fails only on riscv64 / s390x cross-test jobs (see ci_spotcheck.rs). +mod ci_spotcheck;