Skip to content

Commit

Permalink
make floppy test more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
copy committed Sep 30, 2024
1 parent 5cf6a65 commit d49cb4c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/api/floppy-insert-eject.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const TEST_RELEASE_BUILD = +process.env.TEST_RELEASE_BUILD;

const pause = require("timers/promises").setTimeout;
const fs = require("fs");
var V86 = require(`../../build/${TEST_RELEASE_BUILD ? "libv86" : "libv86-debug"}.js`).V86;

Expand All @@ -16,23 +17,34 @@ const emulator = new V86({
autostart: true,
memory_size: 32 * 1024 * 1024,
filesystem: {},
log_level: 0,
log_level: 3,
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 A:\n");
await emulator.wait_until_vga_screen_contains("Abort, Retry, Fail?");
console.log("Got Abort, Retry, Fail?");
await pause(1000);
emulator.keyboard_send_text("F");
emulator.set_fda({ url: __dirname + "/../../images/freedos722.img" });
emulator.keyboard_send_text("dir A:\n");
await emulator.wait_until_vga_screen_contains("FDOS <DIR>");
console.log("Got FDOS");
emulator.stop();
clearTimeout(timeout);
//clearInterval(interval);
}, 1000);

0 comments on commit d49cb4c

Please sign in to comment.