From c4edf960ef4c982347aaa8266c5c86e2d2964c6b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 1 Jun 2021 22:16:24 -0700 Subject: [PATCH] chore(swingset): improve test-transcript Update test-transcript.js to wait for the combined run-queue and GC-actions queue to drain, now that c.run()/c.step() executes GC actions first. Also shutdown the controller properly after each call to buildTrace(). This test exhibits odd GC behavior when: * it lacks the wait for `gcActions.length` * and uses the default 'local' vat worker * liveslots calls `gcAndFinalize()` only once This suggests that our `gcAndFinalize()` is insufficient, at least on Node.js. See #3240 for more details. --- packages/SwingSet/test/test-transcript.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SwingSet/test/test-transcript.js b/packages/SwingSet/test/test-transcript.js index fe316a6136ce..71e20294b0c1 100644 --- a/packages/SwingSet/test/test-transcript.js +++ b/packages/SwingSet/test/test-transcript.js @@ -10,12 +10,13 @@ import { buildVatController, loadBasedir } from '../src/index'; async function buildTrace(c, storage) { const states = []; - while (c.dump().runQueue.length) { + while (c.dump().runQueue.length && c.dump().gcActions.length) { states.push(getAllState(storage)); // eslint-disable-next-line no-await-in-loop await c.step(); } states.push(getAllState(storage)); + await c.shutdown(); return states; }