Skip to content

Commit 3084eda

Browse files
committed
Swift: add swiftmodule hash map testing to frontend_invocations
1 parent e42ae09 commit 3084eda

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hashes.expected
2+
hashes.actual
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
from create_database_utils import *
2+
from subprocess import check_call
3+
from hashlib import sha256
4+
from pathlib import Path
25

36
run_codeql_database_create([
47
'./build.sh',
58
], lang='swift')
9+
10+
with open('hashes.expected', 'w') as expected:
11+
for f in sorted(Path().glob("*.swiftmodule")):
12+
with open(f, 'rb') as module:
13+
print(f.name, sha256(module.read()).hexdigest(), file=expected)
14+
15+
with open('hashes.actual', 'w') as actual:
16+
hashes = [(s.resolve().name, s.name) for s in Path("db/working/swift-extraction-artifacts/hashes").iterdir()]
17+
hashes.sort()
18+
for module, hash in hashes:
19+
print(module, hash, file=actual)
20+
21+
check_call(['diff', '-u', 'hashes.expected', 'hashes.actual'])

0 commit comments

Comments
 (0)