Skip to content

Commit

Permalink
chore(swingset): change several tests to use c.run instead of c.step
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
warner committed Jun 2, 2021
1 parent e5bd26b commit 1701efa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 19 deletions.
5 changes: 4 additions & 1 deletion packages/SwingSet/test/test-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, []);
});
2 changes: 1 addition & 1 deletion packages/SwingSet/test/test-devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
34 changes: 17 additions & 17 deletions packages/SwingSet/test/timer-device/test-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()']);
});

Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 1701efa

Please sign in to comment.