mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Rust: add none compression integration test
This commit is contained in:
@@ -19,14 +19,25 @@ def test_do_not_print_env(codeql, rust, rust_edition, cargo, check_env_not_dumpe
|
||||
|
||||
@pytest.mark.ql_test("steps.ql", expected=".cargo.expected")
|
||||
@pytest.mark.parametrize(("rust_edition", "compression", "suffix"), [
|
||||
pytest.param(2024, "gzip", ".gz", id="gzip"),
|
||||
pytest.param(2024, "zstd", ".zst", id="zstd"),
|
||||
pytest.param(2024, "none", [], id="none"),
|
||||
pytest.param(2024, "gzip", [".gz"], id="gzip"),
|
||||
pytest.param(2024, "zstd", [".zst"], id="zstd"),
|
||||
])
|
||||
def test_compression(codeql, rust, rust_edition, compression, suffix, cargo, rust_check_diagnostics, cwd):
|
||||
codeql.database.create(cleanup=False, _env={
|
||||
"CODEQL_EXTRACTOR_RUST_TRAP_COMPRESSION": compression,
|
||||
})
|
||||
codeql.database.create(
|
||||
_env={
|
||||
"CODEQL_EXTRACTOR_RUST_OPTION_TRAP_COMPRESSION": compression,
|
||||
}
|
||||
)
|
||||
trap_files = [*(cwd / "test-db" / "trap").rglob("*.trap*")]
|
||||
assert trap_files
|
||||
files_with_wrong_format = [f for f in trap_files if f.suffix != suffix and f.name != "metadata.trap.gz"]
|
||||
assert not files_with_wrong_format, f"Found trap files with wrong format: {files_with_wrong_format}"
|
||||
assert trap_files, "No trap files found"
|
||||
expected_suffixes = [".trap"] + suffix
|
||||
|
||||
def is_of_expected_format(file):
|
||||
return file.name == "metadata.trap.gz" or \
|
||||
file.suffixes[-len(expected_suffixes):] == expected_suffixes
|
||||
|
||||
files_with_wrong_format = [
|
||||
f for f in trap_files if not is_of_expected_format(f)
|
||||
]
|
||||
assert not files_with_wrong_format, f"Found trap files with wrong format"
|
||||
|
||||
Reference in New Issue
Block a user