mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
Swift: add swiftmodule hash map testing to frontend_invocations
This commit is contained in:
2
swift/integration-tests/posix-only/frontend-invocations/.gitignore
vendored
Normal file
2
swift/integration-tests/posix-only/frontend-invocations/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
hashes.expected
|
||||
hashes.actual
|
||||
@@ -1,5 +1,21 @@
|
||||
from create_database_utils import *
|
||||
from subprocess import check_call
|
||||
from hashlib import sha256
|
||||
from pathlib import Path
|
||||
|
||||
run_codeql_database_create([
|
||||
'./build.sh',
|
||||
], lang='swift')
|
||||
|
||||
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.resolve().name, s.name) for s in Path("db/working/swift-extraction-artifacts/hashes").iterdir()]
|
||||
hashes.sort()
|
||||
for module, hash in hashes:
|
||||
print(module, hash, file=actual)
|
||||
|
||||
check_call(['diff', '-u', 'hashes.expected', 'hashes.actual'])
|
||||
|
||||
Reference in New Issue
Block a user