mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
We are no longer bound to the platform-specific directories, so simplify the test organization. If you don't want this change, just skip merging this PR. It's purely optional.
25 lines
810 B
Python
25 lines
810 B
Python
from hashlib import sha256
|
|
from pathlib import Path
|
|
import runs_on
|
|
import pytest
|
|
|
|
|
|
@runs_on.posix
|
|
@pytest.mark.ql_test("DB-CHECK", xfail=True)
|
|
def test(codeql, swift, expected_files):
|
|
codeql.database.create(command="./build.sh")
|
|
with open("hashes.expected", "w") as expected:
|
|
for f in sorted(Path().glob("*.swiftmodule")):
|
|
with open(f, "rb") as module:
|
|
print(f.name, sha256(module.read()).hexdigest(), file=expected)
|
|
|
|
with open("hashes.actual", "w") as actual:
|
|
hashes = [
|
|
(s.name, s.resolve().name)
|
|
for s in Path("test-db/working/swift-extraction-artifacts/store").iterdir()
|
|
]
|
|
hashes.sort()
|
|
for module, hash in hashes:
|
|
print(module, hash, file=actual)
|
|
expected_files.add("hashes.expected")
|