Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c239e123b | ||
|
|
2d6acc1180 |
No files matched your search
@@ -193,6 +193,14 @@ Windows 版本判断以 Build 为准:`22000` 及以上归为 Win11,`10240–
|
|||||||
|
|
||||||
GUI 中状态为 `绿色 / Ready` 的条目不能勾选、也不会进入批量队列。
|
GUI 中状态为 `绿色 / Ready` 的条目不能勾选、也不会进入批量队列。
|
||||||
|
|
||||||
|
### PCB 读写确认
|
||||||
|
|
||||||
|
桌面普通校验默认在读写确认弹窗无人应答 3 秒后核验占用。可在高级设置取消勾选「无人应答时自动核验 PCB 读写占用」,本次启动的后续批次便会在无人应答时跳过该项。手动选择继续也会核验占用。
|
||||||
|
|
||||||
|
命令行使用 `--batch-lmc` 时,加 `--auto-confirm-pcb-open` 可对已识别的读写确认执行同样的核验。带此参数的无界面运行发现该弹窗后立即开始检查。版本选择和 ICDB 维护分别使用各自的入口。
|
||||||
|
|
||||||
|
程序核对当前工程、LMC、布局和共享数据库。出现身份不符、实际占用、无法绑定的地址记录、绝对或不唯一的 iCDBDir,以及需要维护的库时,报告会记录具体原因。双击表格备注可查看并复制全文。
|
||||||
|
|
||||||
### 批量状态桥(只读、默认启用)
|
### 批量状态桥(只读、默认启用)
|
||||||
|
|
||||||
`tools/status_bridge/bin/CbbStatusBridge32.exe` 是与 Mentor EE 7.9 x86/MFC ABI
|
`tools/status_bridge/bin/CbbStatusBridge32.exe` 是与 Mentor EE 7.9 x86/MFC ABI
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# 工单 #19 审查后续验证
|
||||||
|
|
||||||
|
## 合入与发布
|
||||||
|
|
||||||
|
PR #18 的目标为 main,PR #20 叠在 PR #18 的分支上。计划先合入 #18,再将 #20 的变更合入 main。发版前在 main 核对两轮改动和测试证据,从最终提交构建新测试版。现有 beta.5 标签对应提交 `3efeaed`。其中不含 PR #20 的目录扫描、读写确认和完整备注改动。
|
||||||
|
|
||||||
|
## 占用验证
|
||||||
|
|
||||||
|
- 在 Windows 上保留实际文件探测,分别验证共享数据库由独占句柄持有和释放后的选择。另用存在地址记录的工作目录覆盖原生只读检查的调度、正反回执解析和再次探测。该用例替换 Mentor 回执来源。
|
||||||
|
- 在隔离工程 1GPHY_RTL8211F 上,以之前捕获的项目地址记录调用实际 Mentor Project Backup。原生结果为 `NOT_IN_USE`、`repair_required=true`、`inspection_only=true`、`repair_requested=false`,退出码 0。程序拒绝自动继续。工程地址、工程数据库和共享符号数据库的哈希保持一致,原生检查进程已退出。原始回执 SHA-256 为 `22812c4423bc06fedce4eb9c89ee17e1fe10452fde76aff02ae0380a4505d1d6`。
|
||||||
|
- 批次回归核对前项保持 SKIPPED,释放复核成功后实际调度同库下一项。工单原先的 5 个工程、364 项生产库及 Win10/SMB 仍待现场复验。
|
||||||
|
|
||||||
|
最终全量 Python 测试 2,526 项通过,用时 366.39 秒,退出码 0。编译和差异检查通过。本轮未复现审查机的文件探测挂起。
|
||||||
@@ -143,6 +143,8 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|||||||
parser.add_argument('--collect-failure-logs', type=Path, help=argparse.SUPPRESS)
|
parser.add_argument('--collect-failure-logs', type=Path, help=argparse.SUPPRESS)
|
||||||
parser.add_argument('--batch-lmc', type=Path, help=argparse.SUPPRESS)
|
parser.add_argument('--batch-lmc', type=Path, help=argparse.SUPPRESS)
|
||||||
parser.add_argument('--block', action='append', default=[], help=argparse.SUPPRESS)
|
parser.add_argument('--block', action='append', default=[], help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument('--auto-confirm-pcb-open', action='store_true',
|
||||||
|
help='With --batch-lmc, continue through the known PCB prompt after checking resource access')
|
||||||
parser.add_argument('--limit', type=_positive_int, help='Maximum requested CBB names for --batch-lmc (default: all)')
|
parser.add_argument('--limit', type=_positive_int, help='Maximum requested CBB names for --batch-lmc (default: all)')
|
||||||
parser.add_argument('--libspec', default='', help=argparse.SUPPRESS)
|
parser.add_argument('--libspec', default='', help=argparse.SUPPRESS)
|
||||||
parser.add_argument('--dms-login-config', default='', help=argparse.SUPPRESS)
|
parser.add_argument('--dms-login-config', default='', help=argparse.SUPPRESS)
|
||||||
@@ -203,7 +205,8 @@ def main(argv: Sequence[str] | None = None) -> int:
|
|||||||
mentor_bin=args.mentor_bin, logging_context=context,
|
mentor_bin=args.mentor_bin, logging_context=context,
|
||||||
mapped_drive=lease.drive,
|
mapped_drive=lease.drive,
|
||||||
mapped_remote_root=lease.remote_root,
|
mapped_remote_root=lease.remote_root,
|
||||||
native_lm_verify=native_lm_verify_enabled())
|
native_lm_verify=native_lm_verify_enabled(),
|
||||||
|
auto_confirm_pcb_open=args.auto_confirm_pcb_open)
|
||||||
for name in names]
|
for name in names]
|
||||||
def retain_mapping(reason):
|
def retain_mapping(reason):
|
||||||
lease.retain_for_recovery()
|
lease.retain_for_recovery()
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ def _cancel_target(snapshot):
|
|||||||
from .post_repair_consent import exact_prompt
|
from .post_repair_consent import exact_prompt
|
||||||
from .dialog_rules import pcb_version_choice
|
from .dialog_rules import pcb_version_choice
|
||||||
if exact_prompt(snapshot):
|
if exact_prompt(snapshot):
|
||||||
return 'read_write_access', next(c for c in snapshot.controls if c.control_id == 7)
|
no = next((c for c in snapshot.controls if c.class_name == 'Button'
|
||||||
|
and c.control_id == 7 and c.enabled), None)
|
||||||
|
return ('read_write_access', no) if no is not None else None
|
||||||
text = ' '.join(' '.join(c.name for c in snapshot.controls
|
text = ' '.join(' '.join(c.name for c in snapshot.controls
|
||||||
if c.class_name == 'Static').split())
|
if c.class_name == 'Static').split())
|
||||||
buttons = [c for c in snapshot.controls if c.class_name == 'Button']
|
buttons = [c for c in snapshot.controls if c.class_name == 'Button']
|
||||||
|
|||||||
@@ -145,9 +145,10 @@ def resource_guard(job, allowed_pids, *, require_complete_proof=False):
|
|||||||
|
|
||||||
|
|
||||||
class OpenController:
|
class OpenController:
|
||||||
def __init__(self, job, *, auto_confirm=False):
|
def __init__(self, job, *, auto_confirm=False, require_complete_proof=False):
|
||||||
self.job = job
|
self.job = job
|
||||||
self.auto_confirm = auto_confirm
|
self.auto_confirm = auto_confirm
|
||||||
|
self.require_complete_proof = require_complete_proof or auto_confirm
|
||||||
self.choice = None
|
self.choice = None
|
||||||
self.original = self.owner = None
|
self.original = self.owner = None
|
||||||
self.sent = False
|
self.sent = False
|
||||||
@@ -165,7 +166,12 @@ class OpenController:
|
|||||||
self.owner, self.original = owner, snapshot
|
self.owner, self.original = owner, snapshot
|
||||||
self.choice = OpenChoice(self.job['block_name'], self.job['lmc_file'],
|
self.choice = OpenChoice(self.job['block_name'], self.job['lmc_file'],
|
||||||
auto_confirm=self.auto_confirm)
|
auto_confirm=self.auto_confirm)
|
||||||
|
if show is not None:
|
||||||
show(self.choice)
|
show(self.choice)
|
||||||
|
elif self.auto_confirm:
|
||||||
|
self.choice.choose('continue', origin='headless_opt_in')
|
||||||
|
else:
|
||||||
|
raise ValueError('PCB_OPEN_CONFIRMATION_REQUIRED')
|
||||||
if (owner != self.owner or snapshot.hwnd != self.original.hwnd
|
if (owner != self.owner or snapshot.hwnd != self.original.hwnd
|
||||||
or _prompt_identity(snapshot) != _prompt_identity(self.original)):
|
or _prompt_identity(snapshot) != _prompt_identity(self.original)):
|
||||||
raise ValueError('PCB_OPEN_IDENTITY_CHANGED')
|
raise ValueError('PCB_OPEN_IDENTITY_CHANGED')
|
||||||
@@ -181,7 +187,7 @@ class OpenController:
|
|||||||
if decision == 'continue':
|
if decision == 'continue':
|
||||||
allowed = {target_pid, launcher_pid, worker_pid, self.job.get('supervisor_pid')}
|
allowed = {target_pid, launcher_pid, worker_pid, self.job.get('supervisor_pid')}
|
||||||
try:
|
try:
|
||||||
guard = (resource_guard(self.job, allowed, require_complete_proof=True) if self.auto_confirm
|
guard = (resource_guard(self.job, allowed, require_complete_proof=True) if self.require_complete_proof
|
||||||
else resource_guard(self.job, allowed))
|
else resource_guard(self.job, allowed))
|
||||||
with guard:
|
with guard:
|
||||||
pass
|
pass
|
||||||
@@ -191,7 +197,7 @@ class OpenController:
|
|||||||
except QueueCancelled:
|
except QueueCancelled:
|
||||||
decision, skipped_detail = 'cancel', '校验已取消。'
|
decision, skipped_detail = 'cancel', '校验已取消。'
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
if not self.auto_confirm:
|
if not self.require_complete_proof:
|
||||||
raise
|
raise
|
||||||
decision, skipped_detail = 'skip', str(error)
|
decision, skipped_detail = 'skip', str(error)
|
||||||
if validate_owner(self.job, target_pid, launcher_pid, worker_pid) != owner:
|
if validate_owner(self.job, target_pid, launcher_pid, worker_pid) != owner:
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ import json
|
|||||||
from cbb_refresh_verify.operation_queue import BatchTaskContext, QueueCancelled, TaskHandoff
|
from cbb_refresh_verify.operation_queue import BatchTaskContext, QueueCancelled, TaskHandoff
|
||||||
|
|
||||||
from PySide6.QtCore import QObject, QThreadPool, Signal, Qt, QTimer
|
from PySide6.QtCore import QObject, QThreadPool, Signal, Qt, QTimer
|
||||||
from PySide6.QtGui import QColor, QIcon
|
from PySide6.QtGui import QColor, QIcon, QTextCursor
|
||||||
from PySide6.QtWidgets import (QWidget, QLineEdit, QPushButton, QFormLayout,
|
from PySide6.QtWidgets import (QWidget, QLineEdit, QPushButton, QFormLayout,
|
||||||
QTextEdit, QFileDialog, QHBoxLayout, QLabel, QSpinBox, QMessageBox, QToolButton,
|
QTextEdit, QFileDialog, QHBoxLayout, QLabel, QSpinBox, QMessageBox, QToolButton,
|
||||||
QTableWidget, QTableWidgetItem, QHeaderView, QCheckBox, QVBoxLayout, QProgressBar, QComboBox,
|
QTableWidget, QTableWidgetItem, QHeaderView, QCheckBox, QVBoxLayout, QProgressBar, QComboBox,
|
||||||
QTabBar, QStackedWidget, QSizePolicy)
|
QTabBar, QStackedWidget, QSizePolicy, QDialog, QDialogButtonBox, QPlainTextEdit)
|
||||||
from PySide6.QtWidgets import QStyle
|
from PySide6.QtWidgets import QStyle
|
||||||
|
|
||||||
|
|
||||||
@@ -176,6 +176,9 @@ class MainWindow(QWidget):
|
|||||||
self.native_lm_verify_check.setChecked(native_lm_verify_enabled())
|
self.native_lm_verify_check.setChecked(native_lm_verify_enabled())
|
||||||
self.native_lm_verify_check.setToolTip(
|
self.native_lm_verify_check.setToolTip(
|
||||||
'仅在 Win10 兼容测试时启用;默认仍使用已验证的 ReusableCircuit 直接流程。')
|
'仅在 Win10 兼容测试时启用;默认仍使用已验证的 ReusableCircuit 直接流程。')
|
||||||
|
self.auto_confirm_pcb_open_check = QCheckBox('无人应答时自动核验 PCB 读写占用')
|
||||||
|
self.auto_confirm_pcb_open_check.setChecked(True)
|
||||||
|
self.auto_confirm_pcb_open_check.setToolTip('普通校验中,3 秒后检查占用,确认可写后继续。关闭后默认跳过本项。')
|
||||||
self.advanced_toggle = QToolButton(); self.advanced_toggle.setText('高级设置')
|
self.advanced_toggle = QToolButton(); self.advanced_toggle.setText('高级设置')
|
||||||
self.advanced_toggle.setIcon(self.style().standardIcon(QStyle.StandardPixmap.SP_TitleBarUnshadeButton))
|
self.advanced_toggle.setIcon(self.style().standardIcon(QStyle.StandardPixmap.SP_TitleBarUnshadeButton))
|
||||||
self.advanced_toggle.setCheckable(True); self.advanced_toggle.setChecked(False)
|
self.advanced_toggle.setCheckable(True); self.advanced_toggle.setChecked(False)
|
||||||
@@ -185,10 +188,12 @@ class MainWindow(QWidget):
|
|||||||
advanced_layout.addRow('DMS 登录配置', self.dms_edit)
|
advanced_layout.addRow('DMS 登录配置', self.dms_edit)
|
||||||
advanced_layout.addRow('Mentor bin', self.mentor_bin_edit)
|
advanced_layout.addRow('Mentor bin', self.mentor_bin_edit)
|
||||||
advanced_layout.addRow('触发方式', self.native_lm_verify_check)
|
advanced_layout.addRow('触发方式', self.native_lm_verify_check)
|
||||||
|
advanced_layout.addRow('读写确认', self.auto_confirm_pcb_open_check)
|
||||||
self.advanced_panel.setVisible(False)
|
self.advanced_panel.setVisible(False)
|
||||||
self.advanced_toggle.toggled.connect(self.advanced_panel.setVisible)
|
self.advanced_toggle.toggled.connect(self.advanced_panel.setVisible)
|
||||||
self.cbb_table = QTableWidget(0, 4)
|
self.cbb_table = QTableWidget(0, 4)
|
||||||
self.cbb_table.setHorizontalHeaderLabels(['CBB 名称', '分区', '状态', '备注'])
|
self.cbb_table.setHorizontalHeaderLabels(['CBB 名称', '分区', '状态', '备注(双击查看)'])
|
||||||
|
self.cbb_table.cellDoubleClicked.connect(self._show_result_detail)
|
||||||
self.cbb_table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
|
self.cbb_table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
|
||||||
self.cbb_table.horizontalHeader().setSectionResizeMode(3, QHeaderView.Stretch)
|
self.cbb_table.horizontalHeader().setSectionResizeMode(3, QHeaderView.Stretch)
|
||||||
for column in (1, 2):
|
for column in (1, 2):
|
||||||
@@ -542,7 +547,7 @@ class MainWindow(QWidget):
|
|||||||
current_library = _path_key(self.mentor_lmc_path or self.lmc_edit.text()) if self.lmc_edit.text().strip() else None
|
current_library = _path_key(self.mentor_lmc_path or self.lmc_edit.text()) if self.lmc_edit.text().strip() else None
|
||||||
notice = ('上次操作结果待复查,执行前将重新检查占用。'
|
notice = ('上次操作结果待复查,执行前将重新检查占用。'
|
||||||
if self._management_library_unsafe(current_library) else '')
|
if self._management_library_unsafe(current_library) else '')
|
||||||
notice = '旧表已失效,请重新读取中心库。' if self._stale_table else notice
|
notice = '当前显示上次读取结果(已失效)· 请重新读取中心库。' if self._stale_table else notice
|
||||||
self.library_notice.setText(notice)
|
self.library_notice.setText(notice)
|
||||||
self.library_notice.setVisible(bool(notice))
|
self.library_notice.setVisible(bool(notice))
|
||||||
for widget in (self.lmc_edit, self.browse_button, self.load_button,
|
for widget in (self.lmc_edit, self.browse_button, self.load_button,
|
||||||
@@ -1812,6 +1817,8 @@ class MainWindow(QWidget):
|
|||||||
requests = ([request for request in request_snapshot if request.block_name in names] if request_snapshot is not None
|
requests = ([request for request in request_snapshot if request.block_name in names] if request_snapshot is not None
|
||||||
else [replace(self._request(name), maintenance=maintenance, auto_repair=False) for name in names])
|
else [replace(self._request(name), maintenance=maintenance, auto_repair=False) for name in names])
|
||||||
if not requests: return
|
if not requests: return
|
||||||
|
auto_confirm = self.auto_confirm_pcb_open_check.isChecked()
|
||||||
|
requests = [replace(request, auto_confirm_pcb_open=auto_confirm) for request in requests]
|
||||||
library = requests[0].lmc_file
|
library = requests[0].lmc_file
|
||||||
if any(job.active and job.kind == 'verify' and job.requests == tuple(requests)
|
if any(job.active and job.kind == 'verify' and job.requests == tuple(requests)
|
||||||
and _path_key(job.context.library) == _path_key(library) for job in self._jobs.values()): return
|
and _path_key(job.context.library) == _path_key(library) for job in self._jobs.values()): return
|
||||||
@@ -1838,7 +1845,7 @@ class MainWindow(QWidget):
|
|||||||
def action():
|
def action():
|
||||||
from cbb_refresh_verify.verify_runner import read_library_flag_if_available, run_verify
|
from cbb_refresh_verify.verify_runner import read_library_flag_if_available, run_verify
|
||||||
verify = self.verifier or (lambda req: run_verify(
|
verify = self.verifier or (lambda req: run_verify(
|
||||||
replace(req, auto_confirm_pcb_open=not maintenance),
|
req,
|
||||||
progress=lambda e: self._emit_job(job, 'event', e),
|
progress=lambda e: self._emit_job(job, 'event', e),
|
||||||
flag_reader=read_library_flag_if_available,
|
flag_reader=read_library_flag_if_available,
|
||||||
version_prompt=lambda choice: self._emit_job(job, 'version_choice', choice), stop=job.context.stop))
|
version_prompt=lambda choice: self._emit_job(job, 'version_choice', choice), stop=job.context.stop))
|
||||||
@@ -2037,6 +2044,36 @@ class MainWindow(QWidget):
|
|||||||
self.cbb_table.item(row, 3).setToolTip(detail)
|
self.cbb_table.item(row, 3).setToolTip(detail)
|
||||||
if self.logging_context: self.logging_context.logger.info('cbb_progress %s', line)
|
if self.logging_context: self.logging_context.logger.info('cbb_progress %s', line)
|
||||||
|
|
||||||
|
def _show_result_detail(self, row, column):
|
||||||
|
if column != 3:
|
||||||
|
return
|
||||||
|
item = self.cbb_table.item(row, column)
|
||||||
|
name = self.cbb_table.item(row, 0)
|
||||||
|
if item is None or name is None or not item.toolTip():
|
||||||
|
return
|
||||||
|
|
||||||
|
dialog = QDialog(self)
|
||||||
|
dialog.setAttribute(Qt.WA_DeleteOnClose)
|
||||||
|
dialog.setWindowTitle(f'{name.text()} 结果详情')
|
||||||
|
dialog.resize(660, 380)
|
||||||
|
layout = QVBoxLayout(dialog)
|
||||||
|
text = QPlainTextEdit(dialog)
|
||||||
|
text.setReadOnly(True)
|
||||||
|
text.setPlainText(item.toolTip())
|
||||||
|
text.moveCursor(QTextCursor.Start)
|
||||||
|
layout.addWidget(text)
|
||||||
|
buttons = QDialogButtonBox(QDialogButtonBox.Close, dialog)
|
||||||
|
copy = buttons.addButton('复制全文', QDialogButtonBox.ActionRole)
|
||||||
|
|
||||||
|
def copy_detail():
|
||||||
|
from PySide6.QtWidgets import QApplication
|
||||||
|
QApplication.clipboard().setText(text.toPlainText())
|
||||||
|
|
||||||
|
copy.clicked.connect(copy_detail)
|
||||||
|
buttons.rejected.connect(dialog.close)
|
||||||
|
layout.addWidget(buttons)
|
||||||
|
dialog.show()
|
||||||
|
|
||||||
def _mark_row_ready(self, row):
|
def _mark_row_ready(self, row):
|
||||||
"""Color authoritative READY rows while retaining management selection."""
|
"""Color authoritative READY rows while retaining management selection."""
|
||||||
name_item = self.cbb_table.item(row, 0)
|
name_item = self.cbb_table.item(row, 0)
|
||||||
|
|||||||
@@ -83,7 +83,9 @@ class VerifyRequest:
|
|||||||
maintenance: bool = False
|
maintenance: bool = False
|
||||||
post_repair_proof: object | None = field(default=None, repr=False, compare=False)
|
post_repair_proof: object | None = field(default=None, repr=False, compare=False)
|
||||||
diagnostic_only: bool = False
|
diagnostic_only: bool = False
|
||||||
auto_confirm_pcb_open: bool = False
|
# Explicit True/False selects ordinary Verify's complete access proof.
|
||||||
|
# None preserves the manual confirmation policy for other callers.
|
||||||
|
auto_confirm_pcb_open: bool | None = None
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
@@ -1206,15 +1208,18 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
|
|||||||
diagnostic_closing = True
|
diagnostic_closing = True
|
||||||
from .dialog_supervisor import DialogPollResult
|
from .dialog_supervisor import DialogPollResult
|
||||||
dialog_result = DialogPollResult(activity=False)
|
dialog_result = DialogPollResult(activity=False)
|
||||||
if (version_prompt is not None and consent is None and dialog_agent is not None
|
if ((version_prompt is not None or request.auto_confirm_pcb_open)
|
||||||
|
and consent is None and dialog_agent is not None
|
||||||
and not request.diagnostic_only and not request.native_lm_verify
|
and not request.diagnostic_only and not request.native_lm_verify
|
||||||
|
and not request.maintenance and not request.interactive_input
|
||||||
and dialog_result.error_code == 'DATABASE_RECOVERY_REQUIRED'
|
and dialog_result.error_code == 'DATABASE_RECOVERY_REQUIRED'
|
||||||
and dialog_result.snapshot is not None):
|
and dialog_result.snapshot is not None):
|
||||||
from .pcb_open_consent import OpenController, exact_prompt
|
from .pcb_open_consent import OpenController, exact_prompt
|
||||||
if exact_prompt(dialog_result.snapshot):
|
if exact_prompt(dialog_result.snapshot):
|
||||||
if open_controller is None:
|
if open_controller is None:
|
||||||
open_controller = OpenController(job, auto_confirm=(
|
open_controller = OpenController(
|
||||||
request.auto_confirm_pcb_open and not request.maintenance))
|
job, auto_confirm=request.auto_confirm_pcb_open is True,
|
||||||
|
require_complete_proof=request.auto_confirm_pcb_open is not None)
|
||||||
dialog_result = open_controller.handle(dialog_result.snapshot, dialog_result.observed_snapshots,
|
dialog_result = open_controller.handle(dialog_result.snapshot, dialog_result.observed_snapshots,
|
||||||
target_pid=target_pid, launcher_pid=launcher_pid, worker_pid=process.pid,
|
target_pid=target_pid, launcher_pid=launcher_pid, worker_pid=process.pid,
|
||||||
show=version_prompt, perform=dialog_supervisor.backend.perform)
|
show=version_prompt, perform=dialog_supervisor.backend.perform)
|
||||||
|
|||||||
@@ -60,11 +60,13 @@ def test_supervisor_acknowledged_failed_open_can_close_empty_shell_with_address(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('aliased', [False, True])
|
@pytest.mark.parametrize('aliased', [False, True])
|
||||||
def test_late_release_is_rechecked_before_later_same_library_item(tmp_path, monkeypatch, aliased):
|
@pytest.mark.parametrize('first_status', ['FAIL', 'SKIPPED'])
|
||||||
|
def test_late_release_is_rechecked_before_later_same_library_item(tmp_path, monkeypatch, aliased, first_status):
|
||||||
library = tmp_path/'lib.lmc'
|
library = tmp_path/'lib.lmc'
|
||||||
calls, checks = [], []
|
calls, checks = [], []
|
||||||
failed = verify_runner.VerifyResult('FAIL', stderr='bad database', safe_to_continue=False,
|
failed = verify_runner.VerifyResult(first_status, stderr='native operation declined', safe_to_continue=False,
|
||||||
evidence_path=tmp_path/'result.json', error_category='MENTOR_DATABASE_LOAD_FAILED')
|
evidence_path=tmp_path/'result.json',
|
||||||
|
error_category='PCB_OPEN_SKIPPED' if first_status == 'SKIPPED' else 'MENTOR_DATABASE_LOAD_FAILED')
|
||||||
def verify(request):
|
def verify(request):
|
||||||
calls.append(request.block_name)
|
calls.append(request.block_name)
|
||||||
return failed if request.block_name == 'Bad' else verify_runner.VerifyResult('PASS')
|
return failed if request.block_name == 'Bad' else verify_runner.VerifyResult('PASS')
|
||||||
@@ -78,7 +80,7 @@ def test_late_release_is_rechecked_before_later_same_library_item(tmp_path, monk
|
|||||||
results = verify_runner.run_batch([verify_runner.VerifyRequest(library, n, tmp_path)
|
results = verify_runner.run_batch([verify_runner.VerifyRequest(library, n, tmp_path)
|
||||||
for n in ('Bad','Good')], verifier=verify)
|
for n in ('Bad','Good')], verifier=verify)
|
||||||
assert calls == ['Bad','Good']
|
assert calls == ['Bad','Good']
|
||||||
assert [r.status for r in results] == ['FAIL','PASS']
|
assert [r.status for r in results] == [first_status,'PASS']
|
||||||
assert results[0].safe_to_continue
|
assert results[0].safe_to_continue
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -228,6 +228,37 @@ def test_unattended_readwrite_checks_actual_shared_database_handle(tmp_path, mon
|
|||||||
assert not resumed.error_code
|
assert not resumed.error_code
|
||||||
assert (evidence/'pcb-open-resource-proof.json').is_file()
|
assert (evidence/'pcb-open-resource-proof.json').is_file()
|
||||||
|
|
||||||
|
from cbb_refresh_verify import native_repair
|
||||||
|
address = work/'database/cdbsvr/sAddress.adr'
|
||||||
|
address.parent.mkdir()
|
||||||
|
address.write_text('recorded address')
|
||||||
|
verdict = 'NOT_IN_USE'
|
||||||
|
inspected = []
|
||||||
|
|
||||||
|
def inspect(target, root, **kwargs):
|
||||||
|
assert kwargs['inspection_only'] is True
|
||||||
|
assert target.project == project and target.database == address.parent.parent
|
||||||
|
inspected.append(target.database)
|
||||||
|
output = (f'Loading project file [{project}].\nChecking if project is in use.\n'
|
||||||
|
+ ("Project is not in use. Full iCDB Project Backup's functionality is available.\n"
|
||||||
|
"Backup information loaded correctly." if verdict == 'NOT_IN_USE' else 'Project is in use.'))
|
||||||
|
return dict(status=verdict, repair_required=False, inspection_only=True,
|
||||||
|
repair_requested=False, native_pid=100, native_exit_code=0,
|
||||||
|
native_identity=dict(pid=100, created_handle=1, image='iCDBProjectBackup.exe',
|
||||||
|
owner_sid='test', session_id=1),
|
||||||
|
release={'native_exited': True}, project=str(project),
|
||||||
|
database=str(target.database), output=output)
|
||||||
|
|
||||||
|
monkeypatch.setattr(native_repair, 'run_native_repair', inspect)
|
||||||
|
unoccupied, _ = run('address-checked-unoccupied', 6)
|
||||||
|
assert not unoccupied.error_code and inspected == [address.parent.parent]
|
||||||
|
verdict = 'IN_USE'
|
||||||
|
occupied, _ = run('address-checked-occupied', 7)
|
||||||
|
assert occupied.error_code == 'PCB_OPEN_SKIPPED' and 'PCB_OPEN_DATABASE_IN_USE' in occupied.detail
|
||||||
|
assert inspected == [address.parent.parent]*2
|
||||||
|
assert address.read_text() == 'recorded address'
|
||||||
|
address.unlink()
|
||||||
|
|
||||||
project.write_text('KEY PCBDesignPath "PCB/A.pcb"\nKEY iCDBDir "../../../outside"\n')
|
project.write_text('KEY PCBDesignPath "PCB/A.pcb"\nKEY iCDBDir "../../../outside"\n')
|
||||||
unbound, _ = run('wrong-project-database', 7)
|
unbound, _ = run('wrong-project-database', 7)
|
||||||
assert 'iCDBDir' in unbound.detail
|
assert 'iCDBDir' in unbound.detail
|
||||||
@@ -261,3 +292,31 @@ def test_stop_during_receipt_never_sends_native_yes(tmp_path, monkeypatch):
|
|||||||
controller.handle(snapshot(), (snapshot(),), **options)
|
controller.handle(snapshot(), (snapshot(),), **options)
|
||||||
shown[0].choose('continue')
|
shown[0].choose('continue')
|
||||||
assert controller.handle(snapshot(), (snapshot(),), **options).error_code == 'USER_CANCELLED'
|
assert controller.handle(snapshot(), (snapshot(),), **options).error_code == 'USER_CANCELLED'
|
||||||
|
|
||||||
|
|
||||||
|
def test_headless_opt_in_checks_resources_without_presenting_dialog(tmp_path, monkeypatch):
|
||||||
|
import json
|
||||||
|
from cbb_refresh_verify import pcb_open_consent as consent
|
||||||
|
|
||||||
|
monkeypatch.setattr(consent, 'validate_owner', lambda *_: {'target': 'bound'})
|
||||||
|
checked = []
|
||||||
|
|
||||||
|
def guard(_, __, *, require_complete_proof):
|
||||||
|
checked.append(require_complete_proof)
|
||||||
|
return nullcontext()
|
||||||
|
|
||||||
|
monkeypatch.setattr(consent, 'resource_guard', guard)
|
||||||
|
controller = consent.OpenController(dict(root=str(tmp_path), block_name='A', lmc_file='lib.lmc',
|
||||||
|
project='A.prj', pcb='A.pcb', desktop='CbbVerify_test'), auto_confirm=True)
|
||||||
|
actions = []
|
||||||
|
|
||||||
|
def perform(_, action, phase):
|
||||||
|
actions.append(action['target']['control_id'])
|
||||||
|
return SimpleNamespace(error_code='', accepted_controls=tuple(actions), detail='', channel='win32_button_click')
|
||||||
|
|
||||||
|
result = controller.handle(snapshot(), (snapshot(),), target_pid=20, launcher_pid=10, worker_pid=5,
|
||||||
|
show=None, perform=perform)
|
||||||
|
assert not result.error_code
|
||||||
|
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'
|
||||||
@@ -166,3 +166,17 @@ def test_retained_mapping_logs_context_and_confirmed_release_guidance(batch_cli,
|
|||||||
assert 'Z:' in notice and r'\\server\share' in notice
|
assert 'Z:' in notice and r'\\server\share' in notice
|
||||||
assert '释放残留会话' in notice and '确认' in notice
|
assert '释放残留会话' in notice and '确认' in notice
|
||||||
assert 'net use' not in notice.lower()
|
assert 'net use' not in notice.lower()
|
||||||
|
|
||||||
|
|
||||||
|
def test_batch_cli_can_enable_verified_pcb_open(batch_cli, monkeypatch):
|
||||||
|
app, runner, _, _, _ = batch_cli
|
||||||
|
received = []
|
||||||
|
|
||||||
|
def run(requests, **kwargs):
|
||||||
|
received.extend(request.auto_confirm_pcb_open for request in requests)
|
||||||
|
return [VerifyResult('PASS') for _ in requests]
|
||||||
|
|
||||||
|
monkeypatch.setattr(runner, 'run_batch', run)
|
||||||
|
assert app.main(['--batch-lmc', 'lib.lmc', '--block', 'One']) == 0
|
||||||
|
assert app.main(['--batch-lmc', 'lib.lmc', '--block', 'One', '--auto-confirm-pcb-open']) == 0
|
||||||
|
assert received == [False, True]
|
||||||
@@ -290,3 +290,50 @@ def test_large_catalog_local_filter_and_selection_remain_responsive(qtbot, tmp_p
|
|||||||
print(f'catalog rows={size} load={loaded:.3f}s local_actions={elapsed:.3f}s')
|
print(f'catalog rows={size} load={loaded:.3f}s local_actions={elapsed:.3f}s')
|
||||||
assert elapsed < 2.0
|
assert elapsed < 2.0
|
||||||
assert window.selected_records() == ()
|
assert window.selected_records() == ()
|
||||||
|
|
||||||
|
|
||||||
|
def test_double_click_shows_complete_skipped_reason(qtbot, tmp_path, monkeypatch):
|
||||||
|
from PySide6.QtWidgets import QApplication, QDialog, QPlainTextEdit, QPushButton
|
||||||
|
|
||||||
|
window = load_window(qtbot, tmp_path, monkeypatch)
|
||||||
|
window.show()
|
||||||
|
reason = ('PCB_OPEN_SKIPPED: 检查未通过\n' +
|
||||||
|
'\n'.join(f'共享数据库占用记录 {index}' for index in range(30)) +
|
||||||
|
'\n完整路径 <library>/SymbolLibs/icdb.dat')
|
||||||
|
window._progress({'block': 'Beta', 'stage': 'SKIPPED', 'detail': reason})
|
||||||
|
row = window._row_by_name['Beta']
|
||||||
|
item = window.cbb_table.item(row, 3)
|
||||||
|
window.cbb_table.scrollToItem(item)
|
||||||
|
position = window.cbb_table.visualItemRect(item).center()
|
||||||
|
viewport = window.cbb_table.viewport()
|
||||||
|
assert viewport.rect().contains(position)
|
||||||
|
qtbot.mouseClick(viewport, Qt.LeftButton, pos=position)
|
||||||
|
qtbot.mouseDClick(viewport, Qt.LeftButton, pos=position)
|
||||||
|
dialogs = [dialog for dialog in window.findChildren(QDialog)
|
||||||
|
if dialog.isVisible() and '结果详情' in dialog.windowTitle()]
|
||||||
|
assert len(dialogs) == 1
|
||||||
|
dialog = dialogs[0]
|
||||||
|
text = dialog.findChild(QPlainTextEdit)
|
||||||
|
assert text.isReadOnly()
|
||||||
|
assert text.toPlainText() == reason
|
||||||
|
copy, = [button for button in dialog.findChildren(QPushButton) if button.text() == '复制全文']
|
||||||
|
qtbot.mouseClick(copy, Qt.LeftButton)
|
||||||
|
assert QApplication.clipboard().text() == reason
|
||||||
|
dialog.close()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('enabled', [False, True])
|
||||||
|
def test_pcb_open_option_is_bound_only_to_ordinary_verify(qtbot, tmp_path, monkeypatch, enabled):
|
||||||
|
requests = []
|
||||||
|
|
||||||
|
def verify(request):
|
||||||
|
requests.append(request)
|
||||||
|
return VerifyResult('SKIPPED')
|
||||||
|
|
||||||
|
window = load_window(qtbot, tmp_path, monkeypatch, verifier=verify)
|
||||||
|
window.auto_confirm_pcb_open_check.setChecked(enabled)
|
||||||
|
assert window._request('Beta').auto_confirm_pcb_open is None
|
||||||
|
window._run(['Beta'])
|
||||||
|
qtbot.waitUntil(lambda: not window.busy)
|
||||||
|
assert len(requests) == 1
|
||||||
|
assert requests[0].auto_confirm_pcb_open is enabled
|
||||||
Reference in new issue
Block a user