diff --git a/CHANGELOG.md b/CHANGELOG.md index 185e31fb..abd5b54b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 workflow-level `env:`, which merges into every job and cannot be unset by one, so the job whose whole point is io_uring ran with io_uring force-disabled. `monoio_yield_overhead_is_microscopic` caught it at 1.45ms/yield (the `sleep(ZERO)` timer-park signature). That variable is now per-job, - and `ci_covers_monoio.rs` asserts **both** scopes. + and `ci_covers_monoio.rs` asserts **both** scopes. The guard suite itself then failed on + Windows — it matched `"\n :\n"` against a CRLF checkout — so it now normalizes line + endings and carries a platform-independent CRLF regression test (Windows is skipped on every + PR, so that class is invisible until a main push). - **Client-compat harness: raw-RESP diff against a real `redis-server` (`scripts/test-client-compat.sh`).** Moon's existing Redis comparison diff --git a/tests/ci_covers_monoio.rs b/tests/ci_covers_monoio.rs index 38427494..203cf176 100644 --- a/tests/ci_covers_monoio.rs +++ b/tests/ci_covers_monoio.rs @@ -19,7 +19,49 @@ use std::path::PathBuf; fn workflow() -> String { let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".github/workflows/ci.yml"); - std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display())) + let raw = std::fs::read_to_string(&path) + .unwrap_or_else(|e| panic!("cannot read {}: {e}", path.display())); + // Normalize CRLF. `job_block` and `workflow_env_block` scan for `\n :\n` + // and for indentation immediately after a newline; on a Windows checkout + // (`core.autocrlf=true`) every line ends `\r\n`, so those needles never match + // and each caller's `.expect()` fires — all 5 tests failed that way on the + // first main push, invisible to PR CI because Windows is skipped there. + normalize_newlines(&raw) +} + +fn normalize_newlines(s: &str) -> String { + s.replace("\r\n", "\n") +} + +/// The regression guard for the above, runnable on ANY platform — Windows is +/// skipped on every PR, so a CRLF bug here is otherwise invisible until main. +#[test] +fn the_parsers_survive_a_windows_crlf_checkout() { + let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(".github/workflows/ci.yml"); + let raw = std::fs::read_to_string(&path).expect("read ci.yml"); + // Normalize FIRST. On a Windows checkout the bytes on disk are already CRLF, + // so converting the raw text would produce `\r\r\n` — a fixture that no + // amount of correct normalizing can rescue, which is how this very test + // failed on its own first Windows run. Assuming the file is LF is exactly + // the bug under test. + let lf = normalize_newlines(&raw); + let crlf = lf.replace('\n', "\r\n"); + assert!( + crlf.contains("\r\n") && !crlf.contains("\r\r"), + "synthetic CRLF fixture is malformed — the test would prove nothing" + ); + + let yaml = normalize_newlines(&crlf); + assert!( + job_block(&yaml, "check-monoio").is_some(), + "job_block cannot find `check-monoio` in a CRLF checkout. Its needle is \ + \"\\n :\\n\", which a \\r\\n line ending breaks — read the workflow \ + through `workflow()`, never `read_to_string` directly." + ); + assert!( + workflow_env_block(&yaml).contains("CARGO_TERM_COLOR"), + "workflow_env_block returned nothing usable on a CRLF checkout" + ); } /// Return the body of a top-level job block, from ` :` to the next