You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The corpus tests skipped themselves when the `swift-syntax-parse` binary
could not be launched. That was meant to keep the suite usable without a
Swift toolchain, but it hid far more than it helped: a skip still
reports `test result: ok`, and the message explaining why only appears
under `cargo test -- --nocapture`. `scripts/update-corpus.sh` never set
the variable that locates the parser, so the documented way to
regenerate the corpus silently exercised nothing at all.
Drop the guard, so a missing parser fails loudly, and make the parser
easy to find so that failing is rare:
- Resolve the parser one directory above the running executable as well
as beside it. Test binaries live in `target/<profile>/deps/`, so the
existing sibling lookup could never find
`target/<profile>/swift-syntax-parse` and `cargo test` always fell
through to `PATH`.
- Report a missing binary with the command that builds it, rather than a
bare `No such file or directory`.
- Build the parser in `scripts/update-corpus.sh`, so regenerating the
corpus works from a clean checkout.
`cargo test` in `extractor` still needs the parser built first, since
the extractor deliberately does not depend on the crate that provides it
-- that is what keeps the Swift toolchain off the build path for the
other languages. `AGENTS.md` now says so.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: unified/AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ This is a CodeQL extractor based on tree-sitter.
17
17
18
18
- The mapping from the parse tree to the target AST is found in `extractor/src/languages/swift/swift.rs`
19
19
20
-
- To run tests for the parser and mapping, run `cargo test` in the `extractor` directory.
20
+
- To run tests for the parser and mapping, run `cargo test` in the `extractor` directory. The corpus tests shell out to the `swift-syntax-parse` binary, which lives in a separate crate that `cargo test` does not build, so build it first with `cargo build -p swift-syntax-rs --bin swift-syntax-parse` (this needs a Swift toolchain; `scripts/update-corpus.sh` does it for you).
21
21
22
22
- Extractor test cases are located at `extractor/tests/corpus/swift/*/*.swift`.
0 commit comments