Skip to content

Commit 8248c50

Browse files
author
Paolo Tranquilli
committed
Rust: add none compression integration test
1 parent 923a285 commit 8248c50

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

rust/ql/integration-tests/hello-project/test_project.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,25 @@ def test_do_not_print_env(codeql, rust, rust_edition, cargo, check_env_not_dumpe
1919

2020
@pytest.mark.ql_test("steps.ql", expected=".cargo.expected")
2121
@pytest.mark.parametrize(("rust_edition", "compression", "suffix"), [
22-
pytest.param(2024, "gzip", ".gz", id="gzip"),
23-
pytest.param(2024, "zstd", ".zst", id="zstd"),
22+
pytest.param(2024, "none", [], id="none"),
23+
pytest.param(2024, "gzip", [".gz"], id="gzip"),
24+
pytest.param(2024, "zstd", [".zst"], id="zstd"),
2425
])
2526
def test_compression(codeql, rust, rust_edition, compression, suffix, cargo, rust_check_diagnostics, cwd):
26-
codeql.database.create(cleanup=False, _env={
27-
"CODEQL_EXTRACTOR_RUST_TRAP_COMPRESSION": compression,
28-
})
27+
codeql.database.create(
28+
_env={
29+
"CODEQL_EXTRACTOR_RUST_OPTION_TRAP_COMPRESSION": compression,
30+
}
31+
)
2932
trap_files = [*(cwd / "test-db" / "trap").rglob("*.trap*")]
30-
assert trap_files
31-
files_with_wrong_format = [f for f in trap_files if f.suffix != suffix and f.name != "metadata.trap.gz"]
32-
assert not files_with_wrong_format, f"Found trap files with wrong format: {files_with_wrong_format}"
33+
assert trap_files, "No trap files found"
34+
expected_suffixes = [".trap"] + suffix
35+
36+
def is_of_expected_format(file):
37+
return file.name == "metadata.trap.gz" or \
38+
file.suffixes[-len(expected_suffixes):] == expected_suffixes
39+
40+
files_with_wrong_format = [
41+
f for f in trap_files if not is_of_expected_format(f)
42+
]
43+
assert not files_with_wrong_format, f"Found trap files with wrong format"

0 commit comments

Comments
 (0)