-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pre-bundle to speed up swingset unit tests #1644
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8c0cc8b
feat: allow pre-built kernelBundles for faster unit tests
warner 36496ab
fix: don't modify the original 'config' object
warner 2c9125f
test: speed up test-message-patterns.js with buildKernelBundles
warner 88d82b4
test: speed up test-promises.js with buildKernelBundles
warner 45d7299
test: speed up test-devices.js by using buildKernelBundles()
warner faa8be3
test: speed up test-terminate.js with buildKernelBundles
warner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import '@agoric/install-ses'; | |
import test from 'ava'; | ||
import { initSwingStore, getAllState } from '@agoric/swing-store-simple'; | ||
|
||
import { buildVatController } from '../src/index'; | ||
import { buildVatController, buildKernelBundles } from '../src/index'; | ||
import { buildMailboxStateMap, buildMailbox } from '../src/devices/mailbox'; | ||
import buildCommand from '../src/devices/command'; | ||
|
||
|
@@ -16,6 +16,11 @@ function capargs(args, slots = []) { | |
return capdata(JSON.stringify(args), slots); | ||
} | ||
|
||
test.before(async t => { | ||
const kernelBundles = await buildKernelBundles(); | ||
t.context.data = { kernelBundles }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}); | ||
|
||
test('d0', async t => { | ||
const config = { | ||
bootstrap: 'bootstrap', | ||
|
@@ -27,7 +32,7 @@ test('d0', async t => { | |
}, | ||
devices: [['d0', require.resolve('./files-devices/device-0'), {}]], | ||
}; | ||
const c = await buildVatController(config); | ||
const c = await buildVatController(config, [], t.context.data); | ||
await c.step(); | ||
// console.log(util.inspect(c.dump(), { depth: null })); | ||
t.deepEqual(JSON.parse(c.dump().log[0]), [ | ||
|
@@ -75,7 +80,7 @@ test('d1', async t => { | |
], | ||
], | ||
}; | ||
const c = await buildVatController(config); | ||
const c = await buildVatController(config, [], t.context.data); | ||
await c.step(); | ||
c.queueToVatExport('bootstrap', 'o+0', 'step1', capargs([])); | ||
await c.step(); | ||
|
@@ -100,7 +105,7 @@ async function test2(t, mode) { | |
}, | ||
devices: [['d2', require.resolve('./files-devices/device-2'), {}]], | ||
}; | ||
const c = await buildVatController(config, [mode]); | ||
const c = await buildVatController(config, [mode], t.context.data); | ||
await c.step(); | ||
if (mode === '1') { | ||
t.deepEqual(c.dump().log, ['calling d2.method1', 'method1 hello', 'done']); | ||
|
@@ -186,6 +191,7 @@ test('device state', async t => { | |
// from bootstrap, and read it back. | ||
const c1 = await buildVatController(config, ['write+read'], { | ||
hostStorage: storage, | ||
kernelBundles: t.context.data.kernelBundles, | ||
}); | ||
const d3 = c1.deviceNameToID('d3'); | ||
await c1.run(); | ||
|
@@ -208,7 +214,7 @@ test('mailbox outbound', async t => { | |
devices: [['mailbox', mb.srcPath, mb.endowments]], | ||
}; | ||
|
||
const c = await buildVatController(config, ['mailbox1']); | ||
const c = await buildVatController(config, ['mailbox1'], t.context.data); | ||
await c.run(); | ||
t.deepEqual(s.exportToData(), { | ||
peer1: { | ||
|
@@ -248,7 +254,7 @@ test('mailbox inbound', async t => { | |
|
||
let rc; | ||
|
||
const c = await buildVatController(config, ['mailbox2']); | ||
const c = await buildVatController(config, ['mailbox2'], t.context.data); | ||
await c.run(); | ||
rc = mb.deliverInbound( | ||
'peer1', | ||
|
@@ -361,7 +367,7 @@ test('command broadcast', async t => { | |
devices: [['command', cm.srcPath, cm.endowments]], | ||
}; | ||
|
||
const c = await buildVatController(config, ['command1']); | ||
const c = await buildVatController(config, ['command1'], t.context.data); | ||
await c.run(); | ||
t.deepEqual(broadcasts, [{ hello: 'everybody' }]); | ||
}); | ||
|
@@ -378,7 +384,7 @@ test('command deliver', async t => { | |
devices: [['command', cm.srcPath, cm.endowments]], | ||
}; | ||
|
||
const c = await buildVatController(config, ['command2']); | ||
const c = await buildVatController(config, ['command2'], t.context.data); | ||
await c.run(); | ||
|
||
t.deepEqual(c.dump().log.length, 0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not obviously a use case we have an immediate need to support, but it strikes me that we've got most of the building blocks here to allow kernels to be built without some of this stuff in cases where the swingset being launched doesn't need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, #1351 is an opportunity to set up devices a bit more coherently, in which case we could defer adding the timer vat until someone gives us a timer device to work with. OTOH #1346 might manage to make devices sufficiently vat-like that we don't need wrappers anymore and that one goes away.
I'm inclined to think that comms is a sufficiently core part of the swingset experience ("what's life without IO?") that it's probably always going to be there, but yeah, who knows.