Add test for clean shutdown
This commit is contained in:
parent
e7c16e6d96
commit
92346f51ed
1
Makefile
1
Makefile
|
@ -275,6 +275,7 @@ rust-test-intensive:
|
|||
QUICKCHECK_TESTS=100000000 make rust-test
|
||||
|
||||
api-tests: all-debug
|
||||
./tests/api/clean-shutdown.js
|
||||
./tests/api/state.js
|
||||
|
||||
covreport:
|
||||
|
|
31
tests/api/clean-shutdown.js
Executable file
31
tests/api/clean-shutdown.js
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
// This test checks that calling emulator.stop() will remove all event
|
||||
// listeners, so that the nodejs process cleanly and automatically exits.
|
||||
|
||||
const fs = require("fs");
|
||||
const V86 = require("../../build/libv86-debug.js").V86;
|
||||
|
||||
process.on("unhandledRejection", exn => { throw exn; });
|
||||
|
||||
const config = {
|
||||
bios: { url: __dirname + "/../../bios/seabios.bin" },
|
||||
vga_bios: { url: __dirname + "/../../bios/vgabios.bin" },
|
||||
cdrom: { url: __dirname + "/../../images/linux3.iso", async: true },
|
||||
network_relay_url: "<UNUSED>",
|
||||
autostart: true,
|
||||
memory_size: 32 * 1024 * 1024,
|
||||
filesystem: {},
|
||||
log_level: 0,
|
||||
screen_dummy: true,
|
||||
};
|
||||
|
||||
const emulator = new V86(config);
|
||||
|
||||
setTimeout(function()
|
||||
{
|
||||
console.error("Calling stop()");
|
||||
emulator.stop();
|
||||
console.error("Called stop()");
|
||||
}, 3000);
|
Loading…
Reference in a new issue