fix: handle shared database proof and stale generated cell libraries
This commit is contained in:
1 parent
4fb978ee21
commit
8e0f78979a
8 files changed
+378
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from contextlib import nullcontext
|
||||
from types import SimpleNamespace
|
||||
from dataclasses import replace
|
||||
@@ -228,6 +229,28 @@ def test_unattended_readwrite_checks_actual_shared_database_handle(tmp_path, mon
|
||||
assert not resumed.error_code
|
||||
assert (evidence/'pcb-open-resource-proof.json').is_file()
|
||||
|
||||
shared_address = shared.parent/'cdbsvr/sAddress.adr'
|
||||
shared_address.parent.mkdir()
|
||||
address_bytes = b'shared-server\n127.0.0.1\n192.168.0.6\n10001\n'
|
||||
shared_address.write_bytes(address_bytes)
|
||||
held = win32file.CreateFile(str(shared), win32con.GENERIC_READ, 0, None,
|
||||
win32con.OPEN_EXISTING, 0, None)
|
||||
try:
|
||||
skipped, _ = run('shared-address-occupied', 7)
|
||||
assert skipped.error_code == 'PCB_OPEN_SKIPPED'
|
||||
assert str(shared) in skipped.detail
|
||||
finally:
|
||||
held.Close()
|
||||
unsupported, evidence = run('shared-address-verified-binding', 7)
|
||||
assert unsupported.error_code == 'PCB_OPEN_SKIPPED'
|
||||
assert 'SHARED_ICDB_INSPECTION_UNAVAILABLE' in unsupported.detail
|
||||
denial = json.loads((evidence/'pcb-open-resource-denied.json').read_text(encoding='utf-8'))
|
||||
assert denial['database'] == str(shared.parent)
|
||||
assert denial['address'] == str(shared_address)
|
||||
assert denial['exclusive_file_observed'] is True
|
||||
assert shared_address.read_bytes() == address_bytes
|
||||
shared_address.unlink()
|
||||
|
||||
from cbb_refresh_verify import native_repair
|
||||
address = work/'database/cdbsvr/sAddress.adr'
|
||||
address.parent.mkdir()
|
||||
@@ -320,3 +343,23 @@ def test_headless_opt_in_checks_resources_without_presenting_dialog(tmp_path, mo
|
||||
assert checked == [True] and actions == [6]
|
||||
receipt = json.loads((tmp_path/'pcb-open-user-choice.json').read_text(encoding='utf-8'))
|
||||
assert receipt['decision_origin'] == 'headless_opt_in'
|
||||
|
||||
def test_shared_address_is_bound_to_shared_database_without_a_project_prj(tmp_path):
|
||||
from cbb_refresh_verify.file_probe import _snapshot
|
||||
|
||||
library = tmp_path / 'lib.lmc'
|
||||
library.write_bytes(b'fixture')
|
||||
symbols = tmp_path / 'SymbolLibs'
|
||||
database = symbols / '__ReusableBlocksSymb'
|
||||
address = database / 'cdbsvr/sAddress.adr'
|
||||
address.parent.mkdir(parents=True)
|
||||
address.write_text('fixture address')
|
||||
(database / 'icdb.dat').write_bytes(b'fixture')
|
||||
|
||||
proof = _snapshot(library, (symbols,))
|
||||
|
||||
assert proof['inspection_targets'] == [{
|
||||
'scope': 'shared_symbols', 'database': str(database), 'address': str(address)
|
||||
}]
|
||||
assert str(address) in proof['binding_files']
|
||||
assert str(database / 'icdb.dat') in proof['exclusive_files']
|
||||
Reference in new issue
Block a user