From ed07da43275311da54269cc30e8a09899f21cf6b Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Tue, 14 Jan 2025 14:35:34 +0100 Subject: [PATCH 1/2] Rust: Include nested `.rs` files in `codeql test run` --- rust/extractor/src/qltest.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/extractor/src/qltest.rs b/rust/extractor/src/qltest.rs index f047271140a2..d6db767a5dc4 100644 --- a/rust/extractor/src/qltest.rs +++ b/rust/extractor/src/qltest.rs @@ -51,7 +51,7 @@ path = "main.rs" } fn set_sources(config: &mut Config) -> anyhow::Result<()> { - let path_iterator = glob("*.rs").context("globbing test sources")?; + let path_iterator = glob("**/*.rs").context("globbing test sources")?; config.inputs = path_iterator .collect::, _>>() .context("fetching test sources")?; From e60468e2c774e0b187440cb291720709f89bb5d0 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Tue, 14 Jan 2025 16:45:34 +0100 Subject: [PATCH 2/2] Rust: add nested test file example --- rust/ql/test/extractor-tests/File/File.expected | 2 ++ rust/ql/test/extractor-tests/File/nested.rs | 1 + rust/ql/test/extractor-tests/File/nested/file.rs | 0 3 files changed, 3 insertions(+) create mode 100644 rust/ql/test/extractor-tests/File/nested.rs create mode 100644 rust/ql/test/extractor-tests/File/nested/file.rs diff --git a/rust/ql/test/extractor-tests/File/File.expected b/rust/ql/test/extractor-tests/File/File.expected index 77fee3c3c428..ad701669ab2a 100644 --- a/rust/ql/test/extractor-tests/File/File.expected +++ b/rust/ql/test/extractor-tests/File/File.expected @@ -2,3 +2,5 @@ | a_file.rs:0:0:0:0 | a_file.rs | fromSource: yes | | another_file.rs:0:0:0:0 | another_file.rs | fromSource: yes | | lib.rs:0:0:0:0 | lib.rs | fromSource: yes | +| nested.rs:0:0:0:0 | nested.rs | fromSource: yes | +| nested/file.rs:0:0:0:0 | nested/file.rs | fromSource: yes | diff --git a/rust/ql/test/extractor-tests/File/nested.rs b/rust/ql/test/extractor-tests/File/nested.rs new file mode 100644 index 000000000000..9399b146a6d5 --- /dev/null +++ b/rust/ql/test/extractor-tests/File/nested.rs @@ -0,0 +1 @@ +mod file; diff --git a/rust/ql/test/extractor-tests/File/nested/file.rs b/rust/ql/test/extractor-tests/File/nested/file.rs new file mode 100644 index 000000000000..e69de29bb2d1