mirror of
https://github.com/morluto/rea.git
synced 2026-10-22 22:02:27 -05:00
fix(verify): report final success only after resource cleanup
This commit is contained in:
1 parent
3eb7dbdc16
commit
ee043e2cbf
17 files changed
+277
-195
No files matched your search
@@ -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, {
|
||||
|
||||
Reference in new issue
Block a user