Skip to content

Commit 07c59f7

Browse files
author
Paolo Tranquilli
committed
Rust: fix integration tests
1 parent 0298743 commit 07c59f7

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

rust/ql/integration-tests/options/test_options.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,28 @@ def test_target_linux(codeql, rust):
2222
@pytest.mark.ql_test("cfg_functions.ql", expected=".override.expected")
2323
@pytest.mark.ql_test("arch_functions.ql", expected=f".{platform.system()}.expected")
2424
def test_cfg_override(codeql, rust):
25-
# currently codeql CLI has a limitation not allow to pass `=` in values via `--extractor-option`
26-
os.environ["CODEQL_EXTRACTOR_RUST_OPTION_CARGO_CFG_OVERRIDES"] = "cfg_flag,cfg_key=value,-target_pointer_width=64,target_pointer_width=32,test"
27-
codeql.database.create()
25+
overrides = ",".join((
26+
"cfg_flag",
27+
"cfg_key=value",
28+
"-target_pointer_width=64",
29+
"target_pointer_width=32",
30+
"test",
31+
))
32+
codeql.database.create(extractor_option=f"cargo_cfg_overrides={overrides}")
2833

2934
@pytest.mark.ql_test("arch_functions.ql", expected=f".{platform.system()}.expected")
3035
@pytest.mark.parametrize("features",
3136
[
3237
pytest.param(p,
3338
marks=pytest.mark.ql_test("feature_functions.ql", expected=f".{e}.expected"),
34-
id="all" if p == "*" else p) # CI does not like tests with *...
35-
for p, e in (("foo", "foo"), ("bar", "bar"), ("*", "all"), ("foo,bar", "all"))
39+
id=id)
40+
for p, e, id in (
41+
("foo", "foo", "foo"),
42+
("bar", "bar", "bar"),
43+
# as long as the integration test runner does not sanitize filenames we must
44+
# replace `*` and `,` in the parameter id
45+
("*", "all", "all"),
46+
("foo,bar", "all", "foo+bar"))
3647
])
3748
def test_features(codeql, rust, features):
3849
codeql.database.create(extractor_option=f"cargo_features={features}")

0 commit comments

Comments
 (0)