mirror of
https://github.com/copy/v86.git
synced 2025-12-31 04:23:15 +00:00
add cdrom insert/eject test
This commit is contained in:
parent
a4e4967683
commit
05acfb12eb
2 changed files with 53 additions and 0 deletions
1
Makefile
1
Makefile
|
|
@ -361,6 +361,7 @@ api-tests: build/v86-debug.wasm
|
|||
./tests/api/state.js
|
||||
./tests/api/reset.js
|
||||
#./tests/api/floppy-insert-eject.js # disabled for now, sometimes hangs
|
||||
./tests/api/cdrom-insert-eject.js
|
||||
./tests/api/serial.js
|
||||
./tests/api/reboot.js
|
||||
./tests/api/pic.js
|
||||
|
|
|
|||
52
tests/api/cdrom-insert-eject.js
Executable file
52
tests/api/cdrom-insert-eject.js
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { setTimeout as pause } from "timers/promises";
|
||||
import url from "node:url";
|
||||
|
||||
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
|
||||
|
||||
const TEST_RELEASE_BUILD = +process.env.TEST_RELEASE_BUILD;
|
||||
const { V86 } = await import(TEST_RELEASE_BUILD ? "../../build/libv86.mjs" : "../../src/main.js");
|
||||
|
||||
process.on("unhandledRejection", exn => { throw exn; });
|
||||
|
||||
const emulator = new V86({
|
||||
bios: { url: __dirname + "/../../bios/seabios.bin" },
|
||||
vga_bios: { url: __dirname + "/../../bios/vgabios.bin" },
|
||||
hda: { url: __dirname + "/../../images/msdos622.img" },
|
||||
network_relay_url: "<UNUSED>",
|
||||
autostart: true,
|
||||
memory_size: 32 * 1024 * 1024,
|
||||
filesystem: {},
|
||||
log_level: 0,
|
||||
disable_jit: +process.env.DISABLE_JIT,
|
||||
});
|
||||
|
||||
//const interval = setInterval(() => {
|
||||
// console.warn(emulator.screen_adapter.get_text_screen());
|
||||
//}, 1000);
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
console.warn(emulator.screen_adapter.get_text_screen());
|
||||
throw new Error("Timeout");
|
||||
}, 60 * 1000);
|
||||
|
||||
setTimeout(async () =>
|
||||
{
|
||||
await emulator.wait_until_vga_screen_contains("C:\\> ");
|
||||
console.log("Got C:\\>");
|
||||
await pause(1000);
|
||||
emulator.keyboard_send_text("dir D:\n");
|
||||
await emulator.wait_until_vga_screen_contains("Abort, Retry, Fail?");
|
||||
console.log("Got Abort, Retry, Fail?");
|
||||
await pause(1000);
|
||||
emulator.keyboard_send_text("a");
|
||||
emulator.set_cdrom({ url: __dirname + "/../../images/linux4.iso" });
|
||||
await pause(1000);
|
||||
emulator.keyboard_send_text("dir D:\n");
|
||||
await emulator.wait_until_vga_screen_contains("BOOT <DIR>");
|
||||
console.log("Got BOOT");
|
||||
emulator.destroy();
|
||||
clearTimeout(timeout);
|
||||
//clearInterval(interval);
|
||||
}, 1000);
|
||||
Loading…
Add table
Add a link
Reference in a new issue