debian-bytemark.js 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env node
  2. "use strict";
  3. var V86 = require("../../build/libv86.js").V86;
  4. var emulator = new V86({
  5. hda: { url: __dirname + "/../../images/debian-bench.img", async: true },
  6. initial_state: { url: __dirname + "/../../images/debian-state-bench.bin" },
  7. network_relay_url: "wss://127.0.0.1/",
  8. autostart: true,
  9. memory_size: 128 * 1024 * 1024,
  10. vga_memory_size: 8 * 1024 * 1024,
  11. });
  12. emulator.bus.register("emulator-started", function()
  13. {
  14. setTimeout(() => {
  15. emulator.serial0_send("cd bench && ./nbench\n");
  16. }, 1000);
  17. });
  18. var line = "";
  19. emulator.add_listener("serial0-output-char", function(chr)
  20. {
  21. if(chr < " " && chr !== "\n" && chr !== "\t" || chr > "~")
  22. {
  23. return;
  24. }
  25. if(chr === "\n")
  26. {
  27. console.log("%s", line);
  28. line = "";
  29. }
  30. else
  31. {
  32. line += chr;
  33. }
  34. if(line === "* Trademarks are property of their respective holder.")
  35. {
  36. emulator.stop();
  37. }
  38. });