Files
rust-discovery/deploy/windows/system_pipe_acceptance.py
2026-11-14 12:37:22 +01:00

369 lines
26 KiB
Python

#!/usr/bin/env python3
"""Source-bound Pipe-v2 pack and create-once native units, never deployment.
The access root only supplies the existing pinned SSH transport and immutable
native Core proofs. No credentials/devstate symlinks, copies, services or jobs.
"""
import argparse
import base64
import hashlib
import json
import os
from pathlib import Path
import re
import shutil
import stat
import subprocess
import sys
import uuid
CODE = Path(__file__).resolve().parents[2]
ACCESS = Path('/home/kevin/Schreibtisch/Coding/rust-discovery')
sys.path.insert(0, str(ACCESS / 'deploy/windows'))
sys.path.insert(0, str(ACCESS / 'deploy'))
import client_bootstrap as cb
import auto_transport_acceptance as auto
import runtime_upgrade as previous
require = cb.contract.require
BUILD = CODE / 'devstate/windows-pipe-drain-build'
NATIVE = CODE / 'devstate/windows-client/native-pipe-v2'
# These imported transports read their original protected access configuration.
# Their new local upload/error receipts belong to this isolated checkout.
cb.EVIDENCE = CODE / 'devstate/windows-client'
CORE = ACCESS / 'devstate/core-no-start/build-de37ee99-11bf-465b-9519-45ad8f6e5b87/manifest.json'
CORE_SHA = '1bc082031fcad20d5a519b0004f63d499dbba2ea9ce25d56230d48d2556d474b'
LOCAL = CODE / 'devstate/windows-pipe-drain/qualification-1e0f2b22-1e74-41af-b8ed-0a356be054ba/qualification.json'
LOCAL_SHA = 'a7e3c604d4ad19feed0323ac23aa7a0290b6fb93bc57649cafbadbe5f293b1d4'
TARGET = 'x86_64-pc-windows-gnu'
NAMES = {'agent': 'rmm-agent-windows.exe', 'helper': 'rmm-helper-windows.exe',
'probe': 'RuntimeStateProbe.exe', 'system_probe': 'SystemStateProbe.exe',
'lib': 'windows-tests-lib.exe', 'bin': 'windows-tests-bin.exe'}
# Expected V2 native lists: unchanged names, two existing codec cases extended.
TESTS = {
'lib': sorted([
'clock::tests::gate_requires_all_status_and_uncertainty_evidence',
'clock::tests::production_clock_stays_closed_until_native_adapter_qualification',
'clock::tests::suspend_closes_until_actual_post_resume_sync',
'clock::tests::timeout_worker_stays_closed_without_a_second_call',
'clock::tests::wall_step_and_overflow_fail_closed',
'helper_ipc::tests::pipe_client_rights_cannot_create_an_instance',
'helper_ipc::tests::protocol_does_not_accept_a_shell_operation',
'helper_ipc::tests::reconfigured_service_cannot_adopt_an_old_running_identity',
'helper_ipc::tests::serialization_refuses_oversized_frame',
'helper_ipc::tests::untrusted_lengths_are_rejected_before_body_allocation',
'helper_runtime::intent::tests::cancel_and_dispatch_cas_are_exclusive_and_history_cannot_be_rewritten',
'helper_runtime::tests::system_route_binds_original_request_shape_budget_and_reply_scope',
'helper_system::tests::completed_scm_state_cannot_override_elapsed_runtime',
'helper_system::tests::fixture_recovery_cannot_add_commands_reboots_or_restart_attempts',
'helper_system::tests::service_adapter_exposes_only_implemented_states',
'helper_system::tests::single_fixture_cannot_start_services_or_groups_as_dependencies',
'journal::tests::bounded_existing_journal_preserves_identity_sequence_and_unacked_bytes',
'journal::tests::durable_reopen_ack_identity_and_single_process',
'journal::tests::migrates_original_passive_schema_without_rewriting_pending_envelopes',
'journal::tests::unsupported_page_size_is_refused_without_mutating_existing_data',
'native::tests::boot_identity_survives_independent_native_queries',
'native::tests::native_inventory_has_real_windows_sources_and_no_fake_inodes',
'process::tests::arguments_never_become_shell_code_and_trailing_slashes_are_quoted']),
'bin': sorted([
'https_channel::endpoint_tests::configured_dns_identity_cannot_inject_a_url_or_disable_name_checks',
'runtime::tests::bound_helper_unknown_repairs_generic_crash_gap_without_ack_or_duplicate_result',
'runtime::tests::legacy_inventory_keeps_original_bytes_until_concrete_core_ack',
'runtime::tests::old_passive_configuration_cannot_enable_jobs_or_read_the_clock',
'runtime::tests::worker_fence_requires_same_generation_and_entire_clock_interval',
'wire_channel::tests::auto_fallback_classifies_upgrade_refusal_but_never_authentication',
'wire_channel::tests::explicit_transport_names_cannot_enable_verification_bypasses'])}
COUNTS = {'lib': 23, 'bin': 7}
def sha(path):
return hashlib.sha256(Path(path).read_bytes()).hexdigest()
def save(path, value):
path.parent.mkdir(mode=0o700, parents=True, exist_ok=True)
cb.contract.write_private(path, value)
def private_file(path):
path = Path(path)
require(not path.is_symlink() and not path.parent.is_symlink(), 'private regular path')
info = path.lstat()
require(stat.S_ISREG(info.st_mode) and info.st_uid == os.getuid()
and stat.S_IMODE(info.st_mode) == 0o600, 'private regular owner/mode')
return path
def sources():
require(ACCESS.is_dir() and not ACCESS.is_symlink() and cb.ROOT == ACCESS,
'original access checkout only; no copied configuration')
names = {'Cargo.toml', 'Cargo.lock', 'rust-toolchain.toml', 'proto/agent.proto',
'deploy/windows/system_pipe_acceptance.py', 'docs/windows-helper-pipe-drain.md'}
names.update(str(p.relative_to(CODE)) for p in (CODE / 'crates').glob('*/Cargo.toml'))
for crate in ('agent-windows', 'agent-core', 'domain', 'protocol'):
names.update(str(p.relative_to(CODE)) for p in (CODE / 'crates' / crate).rglob('*')
if p.is_file() and p.suffix in ('.rs', '.c', '.h', '.idl', '.toml'))
names.update('crates/agent/src/' + n + '.rs' for n in ('https_channel', 'transport', 'wire_channel'))
require(all((CODE / n).is_file() and not (CODE / n).is_symlink() for n in names), 'complete fixed build sources')
transport = {}
for module in tuple(sys.modules.values()):
raw = getattr(module, '__file__', None)
if raw:
path = Path(raw).resolve()
if path.is_relative_to(ACCESS / 'deploy') and path.suffix == '.py':
transport[str(path.relative_to(ACCESS))] = sha(path)
require('deploy/windows/client_bootstrap.py' in transport, 'actual transport source binding')
return {'code': {n: sha(CODE / n) for n in sorted(names)}, 'access_transport': dict(sorted(transport.items()))}
def core_proof():
require(sha(CORE) == CORE_SHA, 'exact original Linux-first Core manifest')
manifest = cb.contract.protected_json(CORE)
result = {'manifest_sha256': CORE_SHA}
for platform, count in (('linux', 80), ('windows', 58)):
path = CORE.parent / (platform + '-passed.json')
proof = cb.contract.protected_json(path)
require(proof['verified'] is True and proof['platform'] == platform
and proof['manifest_sha256'] == CORE_SHA, 'actual same-manifest native Core proof')
actual = proof['native']['reports']
require(set(actual) == set(manifest['test_counts'][platform])
and sum(len(v['names']) for v in actual.values()) == count, 'all native Core reports')
for kind, item in actual.items():
n = manifest['test_counts'][platform][kind]
output = base64.b64decode(item['stdout_b64'], validate=True)
require(item['exit_code'] == 0 and item['timed_out'] is False
and item['names'] == manifest['test_names'][platform][kind]
and item['sha256'] == manifest['artifacts'][platform][kind]['sha256']
and re.search(rb'test result: ok\. ' + str(n).encode()
+ rb' passed; 0 failed; 0 ignored; 0 measured; 0 filtered out;', output),
'complete actual native Core result')
result[platform] = {'proof_sha256': sha(path), 'case_id': proof['case_id']}
for name, digest in manifest['source_files'].items():
if name.startswith(('crates/agent-core/', 'crates/domain/', 'crates/protocol/', 'proto/')):
require(sha(CODE / name) == digest, 'isolated common source equals actual native Core proof')
return result
def reused_qualification():
require(sha(LOCAL) == LOCAL_SHA, 'exact retained local qualification')
value = cb.contract.protected_json(LOCAL)
require(value['type'] == 'rmm.windows.pipe-drain-local-qualification'
and value['source_before_after_equal'] is True and value['native_executed'] is False
and value['clock_qualified'] is False and value['native_counts_expected'] == COUNTS
and len(value['commands']) == 4 and all(c['exit_code'] == 0 for c in value['commands']),
'actual previous cross-Clippy/release/unit-link qualification')
for name, digest in value['source_files'].items():
require(sha(CODE / name) == digest, 'all original qualified inputs remain unchanged')
for item in list(value['artifacts'].values()) + list(value['unit_links'].values()):
path = Path(item['path'])
target = LOCAL.parent / 'target'
require(path.is_relative_to(target), 'qualified link under private target')
current = target
for part in ('',) + path.relative_to(target).parts:
if part:
current = current / part
info = current.lstat()
require(not stat.S_ISLNK(info.st_mode) and info.st_uid in (0, os.getuid())
and info.st_mode & 0o022 == 0, 'protected original compiler output')
require(stat.S_ISREG(path.lstat().st_mode) and sha(path) == item['sha256']
and path.stat().st_size == item['bytes'], 'retained exact qualified links')
require(re.search(r'^pub const ADAPTER_QUALIFIED: bool = false;$',
(CODE / 'crates/agent-windows/src/clock.rs').read_text(), re.M), 'production clock remains closed')
return value
def command(args, folder, name):
with (folder / (name + '.stdout')).open('xb') as out, (folder / (name + '.stderr')).open('xb') as err:
result = subprocess.run(args, stdout=out, stderr=err)
save(folder / (name + '.json'), {'exit_code': result.returncode, 'local_only': True, 'arguments': args})
require(result.returncode == 0, 'local build failed; original stdout/stderr retained')
def build():
before, common, prior = sources(), core_proof(), reused_qualification()
folder = BUILD / ('build-' + str(uuid.uuid4()))
folder.mkdir(mode=0o700, parents=True)
save(folder / 'source-before.json', before)
save(folder / 'reused-qualification.json', {'path': str(LOCAL), 'sha256': LOCAL_SHA, 'value': prior})
image = prior['build_image']
require(re.fullmatch(r'sha256:[a-f0-9]{64}', image), 'immutable compiler image')
target = LOCAL.parent / 'target'
# Only these two RELEASE examples were missing. Original Clippy, EXEs and
# unit links are hash-bound above and are deliberately not rerun/rebuilt.
command(['docker', 'run', '--rm', '--network', 'none', '--read-only', '--tmpfs', '/tmp:rw,size=512m',
'-v', str(CODE) + ':/src:ro', '-v', str(target) + ':/target', '-e', 'CARGO_TARGET_DIR=/target',
'--entrypoint', 'cargo', image, 'build', '--manifest-path', '/src/Cargo.toml', '--locked', '--offline',
'--target', TARGET, '-p', 'rmm-agent-windows', '--features', 'system-helper', '--release',
'--example', 'runtime_state', '--example', 'system_state'], folder, 'release-examples')
selected = {'agent': Path(prior['artifacts']['agent']['path']), 'helper': Path(prior['artifacts']['helper']['path']),
'lib': Path(prior['unit_links']['lib']['path']), 'bin': Path(prior['unit_links']['bin']['path']),
'probe': target / TARGET / 'release/examples/runtime_state.exe',
'system_probe': target / TARGET / 'release/examples/system_state.exe'}
artifacts = {}
for kind, original in selected.items():
output, retained = folder / NAMES[kind], folder / (NAMES[kind] + '.linked')
original_sha = sha(original)
for destination in (retained, output):
shutil.copyfile(original, destination)
destination.chmod(0o600)
if kind in COUNTS:
command(['docker', 'run', '--rm', '--network', 'none', '--read-only', '-v', str(folder) + ':/artifacts',
'--entrypoint', 'x86_64-w64-mingw32-strip', image, '--strip-debug', '/artifacts/' + NAMES[kind]],
folder, 'strip-' + kind)
require(sha(original) == sha(retained) == original_sha, 'original links retained unchanged')
data = output.read_bytes()
offset = int.from_bytes(data[60:64], 'little')
require(data[:2] == b'MZ' and data[offset:offset + 6] == b'PE\0\0\x64\x86', 'Windows AMD64 PE')
artifacts[kind] = {'path': str(output), 'name': NAMES[kind], 'sha256': sha(output), 'bytes': len(data),
'original_link_path': str(retained), 'original_link_sha256': original_sha,
'release_build': kind not in COUNTS, 'debug_stripped': kind in COUNTS}
require(sources() == before and core_proof() == common and reused_qualification() == prior,
'compiler inputs, original links and native Core proof unchanged before/after')
manifest = {'schema_version': 1, 'type': 'rmm.windows.pipe-v2-build', 'source_files': before,
'source_before_after_equal': True, 'code_root': str(CODE), 'access_root': str(ACCESS),
'artifacts': artifacts, 'test_names_expected': TESTS, 'native_counts_expected': COUNTS,
'core_native_proofs': common, 'reused_local_qualification': {'path': str(LOCAL), 'sha256': LOCAL_SHA},
'build_image_id': image, 'transport_version': 2, 'raw_v1_controls_qualified': False,
'production_clock_qualified': False, 'native_executed': False}
save(folder / 'manifest.json', manifest)
print(json.dumps({'manifest': str(folder / 'manifest.json'), 'native_executed': False}))
SCRIPT = r'''
$ErrorActionPreference='Stop';$p=([Console]::In.ReadLine()|ConvertFrom-Json)
if([string]([guid]$p.id)-cne$p.id-or$p.action-notin@('run','read')-or$p.manifest_sha256-notmatch'^[a-f0-9]{64}$'){throw 'Fixed Pipe V2 unit case'}
$root='C:\ProgramData\RustDiscoveryBootstrap';$case=Join-Path $root ('native-pipe-v2-'+$p.id)
function Safe($path,$dir){$i=Get-Item -LiteralPath $path -Force;if($i.PSIsContainer-ne$dir-or($i.Attributes-band[IO.FileAttributes]::ReparsePoint)){throw 'Private unit type'};$a=Get-Acl -LiteralPath $path;if($a.GetOwner([Security.Principal.SecurityIdentifier]).Value-notin@('S-1-5-18','S-1-5-32-544')){throw 'Unit owner'};$rules=@($a.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier]));if(!$rules.Count){throw 'Empty unit ACL'};foreach($r in $rules){if($r.AccessControlType-ne'Allow'-or$r.IdentityReference.Value-notin@('S-1-5-18','S-1-5-32-544')){throw 'Unit ACL'}}}
function WriteNew($path,$value){$b=[Text.Encoding]::UTF8.GetBytes(($value|ConvertTo-Json -Depth 16 -Compress));$f=[IO.File]::Open($path,'CreateNew','Write','Read');try{$f.Write($b,0,$b.Length);$f.Flush($true)}finally{$f.Dispose()}}
function ReadPrivate($path){Safe $path $false;if((Get-Item -LiteralPath $path).Length-gt196608){throw 'Unit report bound'};return (Get-Content -LiteralPath $path -Raw|ConvertFrom-Json)}
Safe $root $true
if($p.action-eq'read'){
if(!(Test-Path -LiteralPath $case)){@{case_exists=$false;completed=$false;readback_only=$true}|ConvertTo-Json -Compress;exit 0}
Safe $case $true;$i=ReadPrivate (Join-Path $case 'intent.json');if($i.manifest_sha256-cne$p.manifest_sha256){throw 'Original unit intent'}
$result=Join-Path $case 'result.json';if(Test-Path -LiteralPath $result){ReadPrivate $result|ConvertTo-Json -Depth 16 -Compress;exit 0}
$lists=@{};$reports=@{};foreach($kind in @('lib','bin')){$file=Join-Path $case ('list-'+$kind+'.json');if(Test-Path -LiteralPath $file){$lists[$kind]=ReadPrivate $file};$file=Join-Path $case ('report-'+$kind+'.json');if(Test-Path -LiteralPath $file){$reports[$kind]=ReadPrivate $file}}
@{case_exists=$true;completed=$false;readback_only=$true;started=(Test-Path -LiteralPath (Join-Path $case 'started.json'));lists=$lists;reports=$reports}|ConvertTo-Json -Depth 16 -Compress;exit 0
}
if(Test-Path -LiteralPath $case){throw 'Existing unit case: readback only'};New-Item -ItemType Directory -Path $case|Out-Null;Safe $case $true;WriteNew (Join-Path $case 'intent.json') $p
function Run($exe,$arguments){$s=New-Object Diagnostics.ProcessStartInfo;$s.FileName=$exe;$s.Arguments=$arguments;$s.UseShellExecute=$false;$s.CreateNoWindow=$true;$s.RedirectStandardOutput=$true;$s.RedirectStandardError=$true;$c=New-Object Diagnostics.Process;$c.StartInfo=$s;if(!$c.Start()){throw 'Unit process start'};try{$o=$c.StandardOutput.ReadToEndAsync();$e=$c.StandardError.ReadToEndAsync();$timed=$false;if(!$c.WaitForExit(30000)){$timed=$true;$c.Kill();if(!$c.WaitForExit(2000)){throw 'Own unit process did not exit'}};if(!$o.Wait(2000)-or!$e.Wait(2000)-or$o.Result.Length-gt65536-or$e.Result.Length-gt65536){throw 'Bounded unit output collection'};return @{exit_code=$c.ExitCode;timed_out=$timed;stdout=$o.Result;stderr=$e.Result}}finally{$c.Dispose()}}
$lists=@{};$paths=@{}
foreach($kind in @('lib','bin')){
$a=$p.artifacts.$kind;if($a.sha256-notmatch'^[a-f0-9]{64}$'-or$a.name-cne('windows-tests-'+$kind+'.exe')){throw 'Fixed test artifact'};$folder=Join-Path $root $a.sha256;Safe $folder $true;$exe=Join-Path $folder $a.name;Safe $exe $false;if((Get-FileHash -LiteralPath $exe -Algorithm SHA256).Hash.ToLowerInvariant()-cne$a.sha256-or(Get-Item -LiteralPath $exe).Length-ne$a.bytes){throw 'Exact unit artifact'}
$listed=Run $exe '--list --format terse';[string[]]$names=@($listed.stdout-split'\r?\n'|Where-Object{$_-match': test$'}|ForEach-Object{$_-replace': test$',''});[Array]::Sort($names,[StringComparer]::Ordinal)
$value=@{sha256=$a.sha256;names=$names;listed=$listed};WriteNew (Join-Path $case ('list-'+$kind+'.json')) $value
if($listed.exit_code-ne0-or$listed.timed_out-or$names.Count-ne$p.counts.$kind-or(($names-join"`n")-cne(@($p.test_names.$kind)-join"`n"))){throw 'Exact complete native list before ANY tests'};$lists[$kind]=$value;$paths[$kind]=$exe
}
WriteNew (Join-Path $case 'both-lists-verified.json') @{manifest_sha256=$p.manifest_sha256;both_lists_verified_before_any_test=$true}
WriteNew (Join-Path $case 'started.json') @{start_once=$true};$reports=@{}
foreach($kind in @('lib','bin')){$run=Run $paths[$kind] '--test-threads=1';$value=@{sha256=$lists[$kind].sha256;names=$lists[$kind].names;listed=$lists[$kind].listed;result=$run};WriteNew (Join-Path $case ('report-'+$kind+'.json')) $value;$reports[$kind]=$value;if($run.exit_code-ne0-or$run.timed_out){throw 'Native unit execution failed; readback only'}}
$value=@{completed=$true;manifest_sha256=$p.manifest_sha256;reports=$reports;both_lists_verified_before_any_test=$true;bootstrap_administrator_units=$true;local_service_proof=$false;native_pipe_proof=$false;rmm_jobs=$false;product_state_writes=$false};WriteNew (Join-Path $case 'result.json') $value;$value|ConvertTo-Json -Depth 16 -Compress
'''
def verified(path, current=True):
path = private_file(path)
require(path.parent.parent == BUILD and path.parent.name.startswith('build-')
and str(uuid.UUID(path.parent.name[6:])) == path.parent.name[6:], 'fixed private build namespace')
value = cb.contract.protected_json(path)
require(value['type'] == 'rmm.windows.pipe-v2-build' and value['schema_version'] == 1
and value['source_before_after_equal'] is True and value['production_clock_qualified'] is False
and value['transport_version'] == 2 and value['raw_v1_controls_qualified'] is False
and value['native_executed'] is False
and value['reused_local_qualification'] == {'path': str(LOCAL), 'sha256': LOCAL_SHA}
and value['native_counts_expected'] == COUNTS and value['test_names_expected'] == TESTS
and value['code_root'] == str(CODE) and value['access_root'] == str(ACCESS), 'exact V2 build profile')
if current:
require(value['source_files'] == sources() and value['core_native_proofs'] == core_proof(), 'current source/Core proof binding')
require(set(value['artifacts']) == set(NAMES), 'six exact artifacts')
for kind, item in value['artifacts'].items():
output, original = private_file(item['path']), private_file(item['original_link_path'])
require(output == path.parent / NAMES[kind] and original == path.parent / (NAMES[kind] + '.linked')
and sha(output) == item['sha256'] and output.stat().st_size == item['bytes']
and sha(original) == item['original_link_sha256']
and item['release_build'] is (kind not in COUNTS)
and item['debug_stripped'] is (kind in COUNTS), 'exact retained delivery and original link')
return value
def native(path, ident=None):
path = path.resolve()
manifest = verified(path, current=ident is None)
if ident is None:
ident = str(uuid.uuid4());folder = NATIVE / ident;folder.mkdir(mode=0o700, parents=True)
save(folder / 'intent.json', {'id': ident, 'manifest_path': str(path), 'manifest_sha256': sha(path),
'runner_sha256': sha(__file__), 'script_sha256': hashlib.sha256(SCRIPT.encode()).hexdigest()})
before = {'counts': auto.scopes(), 'flags': auto.status()}
require(auto.flags_disabled(before['flags']), 'closed fault flags before native units')
save(folder / 'server-before.json', before)
for kind in COUNTS:
previous.upload(manifest['artifacts'][kind])
save(folder / 'started-local.json', {'start_once': True})
action = 'run'
else:
require(str(uuid.UUID(ident)) == ident, 'canonical original native case')
folder = NATIVE / ident;intent = cb.contract.protected_json(folder / 'intent.json')
require(intent['manifest_sha256'] == sha(path) and intent['manifest_path'] == str(path)
and intent['runner_sha256'] == sha(__file__)
and intent['script_sha256'] == hashlib.sha256(SCRIPT.encode()).hexdigest(), 'same original case; readback only')
action = 'read'
result = cb.powershell(SCRIPT, {'id': ident, 'action': action, 'manifest_sha256': sha(path),
'artifacts': {k: manifest['artifacts'][k] for k in COUNTS},
'counts': COUNTS, 'test_names': TESTS}, timeout=150)
save(folder / ('readback-' + str(uuid.uuid4()) + '.json'), result)
if result.get('completed') is not True:
print(json.dumps({'verified': False, 'case_id': ident, 'readback_only': True, 'completed': False,
'case_exists': result.get('case_exists'), 'tests_repeated': False}))
return
require(result['manifest_sha256'] == sha(path) and set(result['reports']) == set(COUNTS)
and result['both_lists_verified_before_any_test'] is True
and result['rmm_jobs'] is False and result['product_state_writes'] is False
and result['local_service_proof'] is False and result['native_pipe_proof'] is False,
'actual narrow unit result, no runtime proof')
for kind, actual in result['reports'].items():
run, listed = actual['result'], actual['listed']
names = re.findall(r'^(.+): test\r?$', listed['stdout'], re.M)
require(actual['sha256'] == manifest['artifacts'][kind]['sha256']
and names == actual['names'] == TESTS[kind] and len(set(names)) == COUNTS[kind]
and listed['exit_code'] == run['exit_code'] == 0 and not listed['timed_out'] and not run['timed_out']
and re.search(r'test result: ok\. ' + str(COUNTS[kind])
+ r' passed; 0 failed; 0 ignored; 0 measured; 0 filtered out;', run['stdout']),
'every exact named native unit passed, none skipped/filtered')
before = cb.contract.protected_json(folder / 'server-before.json')
require(auto.scopes() == before['counts'] and auto.status() == before['flags'], 'both central counts and closed flags unchanged')
if action == 'run':
verified(path) # Full before/after source and retained-artifact check.
proof = {'verified': True, 'case_id': ident, 'manifest_path': str(path), 'manifest_sha256': sha(path),
'native': result, 'no_jobs': True, 'clock_adapter_qualified': False,
'local_service_proof': False, 'native_pipe_proof': False}
destination = folder / 'passed.json'
if destination.exists():
require(cb.contract.protected_json(destination) == proof, 'retain exact original proof')
else:
save(destination, proof)
print(json.dumps({'verified': True, 'case_id': ident, 'tests': COUNTS, 'proof': str(destination)}))
def main():
os.umask(0o077)
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('phase', choices=('build-local', 'native-units', 'readback'))
parser.add_argument('--access-root', required=True, type=Path)
parser.add_argument('--manifest', type=Path)
parser.add_argument('--case')
args = parser.parse_args()
require(args.access_root == ACCESS and not args.access_root.is_symlink(), 'exact existing access root')
if args.phase == 'build-local':
require(args.manifest is None and args.case is None, 'build only')
build()
else:
require(args.manifest is not None and ((args.phase == 'readback') == bool(args.case)), 'explicit manifest and original readback case')
native(args.manifest, args.case)
if __name__ == '__main__':
try:
main()
except Exception as error:
print('WINDOWS_PIPE_V2_QUALIFICATION_INCOMPLETE:' + type(error).__name__)
raise SystemExit(2) from None