fix(verify): report final success only after resource cleanup
This commit is contained in:
@@ -21,6 +21,7 @@ await exec("/usr/bin/xcrun", ["--find", "actool"]);
|
||||
await exec("/usr/bin/xcrun", ["--find", "clang"]);
|
||||
await exec("/usr/bin/assetutil", ["--version"]);
|
||||
const root = await mkdtemp(join(tmpdir(), "rea-asset-e2e-"));
|
||||
let report;
|
||||
try {
|
||||
const app = join(root, "Fixture.app");
|
||||
const resources = join(app, "Contents", "Resources");
|
||||
@@ -98,9 +99,16 @@ try {
|
||||
});
|
||||
assert.equal(invalid.isError, true);
|
||||
});
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({ ok: true, mocked: false, cli: true, stdio_mcp: true, records: raw.length, pagination: true, malformed_input_rejected: true })}\n`,
|
||||
);
|
||||
report = {
|
||||
ok: true,
|
||||
mocked: false,
|
||||
cli: true,
|
||||
stdio_mcp: true,
|
||||
records: raw.length,
|
||||
pagination: true,
|
||||
malformed_input_rejected: true,
|
||||
};
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
|
||||
@@ -142,6 +142,7 @@ const checkSwift = (metadata, mode) => {
|
||||
};
|
||||
|
||||
const root = await mkdtemp(join(tmpdir(), "rea-dispatch-"));
|
||||
let report;
|
||||
try {
|
||||
const results = [];
|
||||
for (const mode of LINK_MODES) {
|
||||
@@ -197,9 +198,8 @@ try {
|
||||
});
|
||||
}
|
||||
}
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({ ok: true, target_executed: false, fixtures: results })}\n`,
|
||||
);
|
||||
report = { ok: true, target_executed: false, fixtures: results };
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
|
||||
@@ -21,6 +21,7 @@ const sourceRoot = fileURLToPath(
|
||||
new URL("../../../tests/conformance/interface-builder/", import.meta.url),
|
||||
);
|
||||
|
||||
let report;
|
||||
try {
|
||||
await mkdir(join(appPath, "Contents", "MacOS"), { recursive: true });
|
||||
await mkdir(resourcesPath, { recursive: true });
|
||||
@@ -83,21 +84,20 @@ try {
|
||||
);
|
||||
assert.equal(decoded.graph.truncated, false);
|
||||
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
ok: true,
|
||||
fixture: "compiled-appkit-nib",
|
||||
provider: execution.value.provider,
|
||||
target_sha256: decoded.target_sha256,
|
||||
archive_sha256: decoded.documents[0].archive_sha256,
|
||||
objects: decoded.documents[0].object_count,
|
||||
connections: decoded.documents[0].connection_count,
|
||||
recovered_control: button.name,
|
||||
recovered_action: action.name,
|
||||
hierarchy_complete: decoded.documents[0].hierarchy_complete,
|
||||
truncated: decoded.graph.truncated,
|
||||
})}\n`,
|
||||
);
|
||||
report = {
|
||||
ok: true,
|
||||
fixture: "compiled-appkit-nib",
|
||||
provider: execution.value.provider,
|
||||
target_sha256: decoded.target_sha256,
|
||||
archive_sha256: decoded.documents[0].archive_sha256,
|
||||
objects: decoded.documents[0].object_count,
|
||||
connections: decoded.documents[0].connection_count,
|
||||
recovered_control: button.name,
|
||||
recovered_action: action.name,
|
||||
hierarchy_complete: decoded.documents[0].hierarchy_complete,
|
||||
truncated: decoded.graph.truncated,
|
||||
};
|
||||
} finally {
|
||||
await rm(fixtureRoot, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
|
||||
@@ -17,6 +17,7 @@ if (process.platform !== "darwin")
|
||||
"Real Foundation keyed archive verification requires macOS and Xcode Swift tools",
|
||||
);
|
||||
const root = await mkdtemp(join(tmpdir(), "rea-keyed-fixture-"));
|
||||
let report;
|
||||
try {
|
||||
const archive = join(root, "model.plist");
|
||||
await promisify(execFile)("/usr/bin/xcrun", [
|
||||
@@ -150,9 +151,21 @@ try {
|
||||
[{ source: null, path: ["UID"], target: 1, status: "resolved" }],
|
||||
);
|
||||
}
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({ ok: true, mocked: false, cli: true, stdio_mcp: true, xml_golden: true, uid_named_root: true, format: graph.archive_format, objects: graph.total_objects, references: graph.total_references, shared_identity: true, cyclic_identity: true, target_classes_instantiated_by_reader: false })}\n`,
|
||||
);
|
||||
report = {
|
||||
ok: true,
|
||||
mocked: false,
|
||||
cli: true,
|
||||
stdio_mcp: true,
|
||||
xml_golden: true,
|
||||
uid_named_root: true,
|
||||
format: graph.archive_format,
|
||||
objects: graph.total_objects,
|
||||
references: graph.total_references,
|
||||
shared_identity: true,
|
||||
cyclic_identity: true,
|
||||
target_classes_instantiated_by_reader: false,
|
||||
};
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
|
||||
@@ -65,6 +65,7 @@ const EXPECTED_BUNDLES = [
|
||||
["Contents/XPCServices/Svc.xpc", "xpc-service", "macos-deep", "."],
|
||||
];
|
||||
|
||||
let report;
|
||||
try {
|
||||
const { app } = await buildMacosBundleFixture(root);
|
||||
const zip = join(root, "MacFixture.zip");
|
||||
@@ -155,19 +156,18 @@ try {
|
||||
const dylibs = await verifyDylibResolution(app);
|
||||
const dyldEnvironment = await verifyDyldEnvironment(root);
|
||||
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
ok: true,
|
||||
mocked: false,
|
||||
cli: true,
|
||||
stdio_mcp: true,
|
||||
containers: containers.map(({ format }) => format),
|
||||
bundles: EXPECTED_BUNDLES.length,
|
||||
dmg_detached: true,
|
||||
dylib_resolution: dylibs,
|
||||
dyld_environment: dyldEnvironment,
|
||||
})}\n`,
|
||||
);
|
||||
report = {
|
||||
ok: true,
|
||||
mocked: false,
|
||||
cli: true,
|
||||
stdio_mcp: true,
|
||||
containers: containers.map(({ format }) => format),
|
||||
bundles: EXPECTED_BUNDLES.length,
|
||||
dmg_detached: true,
|
||||
dylib_resolution: dylibs,
|
||||
dyld_environment: dyldEnvironment,
|
||||
};
|
||||
} finally {
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(report)}\n`);
|
||||
|
||||
@@ -34,6 +34,7 @@ const sampleRss = () => {
|
||||
};
|
||||
const sampler = setInterval(sampleRss, 25);
|
||||
sampler.unref();
|
||||
let finalReport;
|
||||
|
||||
try {
|
||||
const evidence = createEvidence(
|
||||
@@ -112,17 +113,15 @@ try {
|
||||
assert.equal(digest, expectedHash.digest("hex"));
|
||||
assert.equal((await stat(path)).size, expectedBytes);
|
||||
sampleRss();
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
json_output_verified: true,
|
||||
format,
|
||||
output_bytes: expectedBytes,
|
||||
engine_string_limit: constants.MAX_STRING_LENGTH,
|
||||
output_sha256: digest,
|
||||
evidence_id: evidence.evidence_id,
|
||||
rss: { method: "node-memoryUsage-rss-sampled", peak_bytes: peakRss },
|
||||
})}\n`,
|
||||
);
|
||||
finalReport = {
|
||||
json_output_verified: true,
|
||||
format,
|
||||
output_bytes: expectedBytes,
|
||||
engine_string_limit: constants.MAX_STRING_LENGTH,
|
||||
output_sha256: digest,
|
||||
evidence_id: evidence.evidence_id,
|
||||
rss: { method: "node-memoryUsage-rss-sampled", peak_bytes: peakRss },
|
||||
};
|
||||
} finally {
|
||||
clearInterval(sampler);
|
||||
if (destination !== undefined && !destination.closed) {
|
||||
@@ -132,3 +131,4 @@ try {
|
||||
}
|
||||
await rm(workspace, { recursive: true, force: true });
|
||||
}
|
||||
process.stdout.write(`${JSON.stringify(finalReport)}\n`);
|
||||
|
||||
@@ -49,6 +49,7 @@ const call = async (name, args) => {
|
||||
};
|
||||
const fingerprint = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
||||
const counts = [];
|
||||
let finalReport;
|
||||
try {
|
||||
const fixtures = await buildRecoveryFixtures(
|
||||
root,
|
||||
@@ -128,19 +129,18 @@ try {
|
||||
});
|
||||
}
|
||||
}
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
engine: "wakaru 1.13.0",
|
||||
toolchains: fixtures.toolchains,
|
||||
results: counts,
|
||||
verified: true,
|
||||
}),
|
||||
);
|
||||
finalReport = {
|
||||
engine: "wakaru 1.13.0",
|
||||
toolchains: fixtures.toolchains,
|
||||
results: counts,
|
||||
verified: true,
|
||||
};
|
||||
} finally {
|
||||
await client.close();
|
||||
await transport.close();
|
||||
await rm(root, { recursive: true, force: true });
|
||||
}
|
||||
console.log(JSON.stringify(finalReport));
|
||||
|
||||
async function assertRecoveredArtifacts(evidence, result, fixture) {
|
||||
assert.deepEqual(result.options, {
|
||||
|
||||
@@ -34,6 +34,8 @@ import {
|
||||
|
||||
const verifierRun = createVerifierRun();
|
||||
const workspace = await mkdtemp(join(tmpdir(), "rea-managed-conformance-"));
|
||||
let completionReportInput;
|
||||
let finalReport;
|
||||
const {
|
||||
fixture,
|
||||
fixtureBytes,
|
||||
@@ -378,65 +380,61 @@ try {
|
||||
const manifestSelfTest = await runManagedAppManifestSelfTest();
|
||||
const operatorManifest = await runOptionalManagedAppManifest();
|
||||
const ilspyOracle = await runOptionalIlspyOracle();
|
||||
const completionReport = createManagedCompletionReport(
|
||||
{
|
||||
modern,
|
||||
framework,
|
||||
nativeFunctionTarget,
|
||||
readyToRun,
|
||||
obfuscated,
|
||||
left,
|
||||
right,
|
||||
nativeOnly,
|
||||
malformed,
|
||||
manifestSelfTest,
|
||||
operatorManifest,
|
||||
ilspyOracle,
|
||||
completionReportInput = {
|
||||
modern,
|
||||
framework,
|
||||
nativeFunctionTarget,
|
||||
readyToRun,
|
||||
obfuscated,
|
||||
left,
|
||||
right,
|
||||
nativeOnly,
|
||||
malformed,
|
||||
manifestSelfTest,
|
||||
operatorManifest,
|
||||
ilspyOracle,
|
||||
};
|
||||
finalReport = {
|
||||
verified:
|
||||
11 + (operatorManifest === null ? 0 : 1) + (ilspyOracle === null ? 0 : 1),
|
||||
managedSurfaces: [
|
||||
"inspect_managed_artifact",
|
||||
"inspect_managed_members",
|
||||
"inspect_managed_native_boundaries",
|
||||
"compare_managed_members",
|
||||
"verify_managed_native_boundaries",
|
||||
"import_managed_reconstruction",
|
||||
"project_managed_application_graph",
|
||||
],
|
||||
coverage: [
|
||||
"modern-dotnet-anycpu",
|
||||
"dotnet-framework-x86-pinvoke",
|
||||
"x64-ready-to-run-native-body",
|
||||
"managed-native-verification",
|
||||
"managed-application-graph-projection",
|
||||
"unicode-obfuscated-identifiers",
|
||||
"decompiler-reconstruction-import",
|
||||
"mvid-and-token-drift",
|
||||
"not-managed",
|
||||
"malformed-metadata",
|
||||
"operator-local-managed-manifest",
|
||||
...(ilspyOracle === null ? [] : ["ilspy-reconstruction-oracle"]),
|
||||
],
|
||||
managedAppManifest: {
|
||||
env: "REA_MANAGED_APP_MANIFEST_PATH",
|
||||
selfTest: manifestSelfTest,
|
||||
operator: operatorManifest ?? { configured: false },
|
||||
},
|
||||
await completeVerifierRun(verifierRun),
|
||||
);
|
||||
|
||||
process.stdout.write(
|
||||
`${JSON.stringify({
|
||||
verified:
|
||||
11 +
|
||||
(operatorManifest === null ? 0 : 1) +
|
||||
(ilspyOracle === null ? 0 : 1),
|
||||
managedSurfaces: [
|
||||
"inspect_managed_artifact",
|
||||
"inspect_managed_members",
|
||||
"inspect_managed_native_boundaries",
|
||||
"compare_managed_members",
|
||||
"verify_managed_native_boundaries",
|
||||
"import_managed_reconstruction",
|
||||
"project_managed_application_graph",
|
||||
],
|
||||
coverage: [
|
||||
"modern-dotnet-anycpu",
|
||||
"dotnet-framework-x86-pinvoke",
|
||||
"x64-ready-to-run-native-body",
|
||||
"managed-native-verification",
|
||||
"managed-application-graph-projection",
|
||||
"unicode-obfuscated-identifiers",
|
||||
"decompiler-reconstruction-import",
|
||||
"mvid-and-token-drift",
|
||||
"not-managed",
|
||||
"malformed-metadata",
|
||||
"operator-local-managed-manifest",
|
||||
...(ilspyOracle === null ? [] : ["ilspy-reconstruction-oracle"]),
|
||||
],
|
||||
managedAppManifest: {
|
||||
env: "REA_MANAGED_APP_MANIFEST_PATH",
|
||||
selfTest: manifestSelfTest,
|
||||
operator: operatorManifest ?? { configured: false },
|
||||
},
|
||||
ilspyOracle: ilspyOracle ?? {
|
||||
env: "REA_ILSPY_CMD_PATH",
|
||||
configured: false,
|
||||
},
|
||||
completionReport,
|
||||
})}\n`,
|
||||
);
|
||||
ilspyOracle: ilspyOracle ?? {
|
||||
env: "REA_ILSPY_CMD_PATH",
|
||||
configured: false,
|
||||
},
|
||||
};
|
||||
} finally {
|
||||
await rm(workspace, { recursive: true, force: true });
|
||||
}
|
||||
finalReport.completionReport = createManagedCompletionReport(
|
||||
completionReportInput,
|
||||
await completeVerifierRun(verifierRun),
|
||||
);
|
||||
process.stdout.write(`${JSON.stringify(finalReport)}\n`);
|
||||
|
||||
Reference in New Issue
Block a user