-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17841 from github/redsun82/rust-fix-qltest-macos
Rust: fix qltest on macOS, and add CI cross-platform testing of it
- Loading branch information
Showing
14 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
rust/ql/integration-tests/qltest/failing_cargo_check/does_not_compile.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
fn foo() { | ||
wat | ||
is | ||
this? | ||
} |
5 changes: 5 additions & 0 deletions
5
rust/ql/integration-tests/qltest/failing_cargo_check/functions.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import rust | ||
|
||
from Function f | ||
where exists(f.getLocation().getFile().getRelativePath()) | ||
select f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
qltest_cargo_check: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
| test.rs:1:1:1:11 | foo | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import rust | ||
|
||
from Function f | ||
where exists(f.getLocation().getFile().getRelativePath()) | ||
select f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
| main.rs:1:1:1:12 | main | | ||
| test.rs:1:1:1:11 | foo | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import rust | ||
|
||
from Function f | ||
where exists(f.getLocation().getFile().getRelativePath()) | ||
select f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fn foo() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dependencies: | ||
codeql/rust-queries: '*' | ||
codeql/rust-all: '*' | ||
extractor: rust | ||
warnOnImplicitThis: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import runs_on | ||
# these tests are meant to exercise QL test running on multiple platforms | ||
# therefore they don't rely on integration test built-in QL test running | ||
# (which skips `qltest.{sh,cmd}`) | ||
|
||
def test_lib(codeql, rust, cwd): | ||
codeql.test.run("lib", threads=1) | ||
|
||
def test_main(codeql, rust): | ||
codeql.test.run("main", threads=1) | ||
|
||
def test_failing_cargo_check(codeql, rust): | ||
out = codeql.test.run("failing_cargo_check", threads=1, show_extractor_output=True, | ||
_assert_failure=True, _capture="stderr") | ||
# TODO: QL test output redirection is currently broken on windows, leaving it up for follow-up work | ||
if not runs_on.windows: | ||
assert "requested cargo check failed" in out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters