From 1701efa299edf26fd05f73aa88811e6d85a144c6 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 31 May 2021 21:39:47 -0700 Subject: [PATCH] chore(swingset): change several tests to use c.run instead of c.step Many operations that previously finished in a single crank will start to need additional cranks soon, when we begin processing GC actions before servicing the run-queue. This patch anticipates these new GC actions by changing several tests to use `c.run()` (which drains both queues) instead of `c.step()` which does just a single crank). --- packages/SwingSet/test/test-controller.js | 5 ++- packages/SwingSet/test/test-devices.js | 2 +- .../SwingSet/test/timer-device/test-device.js | 34 +++++++++---------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/SwingSet/test/test-controller.js b/packages/SwingSet/test/test-controller.js index fd975761c53c..a9eaa0bf84b6 100644 --- a/packages/SwingSet/test/test-controller.js +++ b/packages/SwingSet/test/test-controller.js @@ -314,7 +314,10 @@ test('bootstrap export', async t => { 'right.obj0.bar 2 true', ]); + // that pushes several higher-priority GC dropExports onto the queue as + // everything gets dropped + await c.run(); + removeTriple(kt, barP, leftVatID, 'p+5'); // pruned promise checkKT(t, c, kt); - t.deepEqual(c.dump().runQueue, []); }); diff --git a/packages/SwingSet/test/test-devices.js b/packages/SwingSet/test/test-devices.js index 0a67c93af579..d7b8cca4eb42 100644 --- a/packages/SwingSet/test/test-devices.js +++ b/packages/SwingSet/test/test-devices.js @@ -162,7 +162,7 @@ async function test2(t, mode) { 'method4', 'ret method4 done', ]); - await c.step(); + await c.run(); t.deepEqual(c.dump().log, [ 'calling d2.method4', 'method4', diff --git a/packages/SwingSet/test/timer-device/test-device.js b/packages/SwingSet/test/timer-device/test-device.js index 47119a60da71..ba9c34169cbf 100644 --- a/packages/SwingSet/test/timer-device/test-device.js +++ b/packages/SwingSet/test/timer-device/test-device.js @@ -33,9 +33,9 @@ test('wake', async t => { await initializeSwingset(timerConfig, ['timer'], hostStorage); const c = await makeSwingsetController(hostStorage, deviceEndowments); timer.poll(1); - await c.step(); + await c.run(); timer.poll(5); - await c.step(); + await c.run(); t.deepEqual(c.dump().log, ['starting wake test', 'handler.wake()']); }); @@ -49,9 +49,9 @@ test('repeater', async t => { await initializeSwingset(timerConfig, ['repeater', 3, 2], hostStorage); const c = await makeSwingsetController(hostStorage, deviceEndowments); timer.poll(1); - await c.step(); + await c.run(); timer.poll(5); - await c.step(); + await c.run(); t.deepEqual(c.dump().log, [ 'starting repeater test', 'next scheduled time: 3', @@ -69,11 +69,11 @@ test('repeater2', async t => { await initializeSwingset(timerConfig, ['repeater', 3, 2], hostStorage); const c = await makeSwingsetController(hostStorage, deviceEndowments); timer.poll(1n); - await c.step(); + await c.run(); timer.poll(5n); - await c.step(); + await c.run(); timer.poll(8n); - await c.step(); + await c.run(); t.deepEqual(c.dump().log, [ 'starting repeater test', 'next scheduled time: 3', @@ -92,25 +92,25 @@ test('repeaterZero', async t => { await initializeSwingset(timerConfig, ['repeater', 0, 3], hostStorage); const c = await makeSwingsetController(hostStorage, deviceEndowments); timer.poll(1); - await c.step(); + await c.run(); timer.poll(2); - await c.step(); + await c.run(); timer.poll(3); - await c.step(); + await c.run(); timer.poll(4); - await c.step(); + await c.run(); timer.poll(5); - await c.step(); + await c.run(); timer.poll(6); - await c.step(); + await c.run(); timer.poll(7); - await c.step(); + await c.run(); timer.poll(8); - await c.step(); + await c.run(); timer.poll(9); - await c.step(); + await c.run(); timer.poll(10); - await c.step(); + await c.run(); t.deepEqual(c.dump().log, [ 'starting repeater test', 'next scheduled time: 3',