A headless libretro frontend to test libretro cores
GPL-3.0 License
Emutest is a simple test framework for libretro cores. It embeds a small Lua VM so tests can be written in Lua. It is a Lua scriptable headless libretro frontend.
Emutest is not a unit test framework. It is more like an end to end test utility that you can use in combination with test ROMs like the z80 Master System test ROM, or the Genesis VDP test ROM. It does a good job at testing the integration of your emulator with a libretro frontend.
Features:
Not yet implemented:
Known limitations:
go install github.com/kivutar/emutest@latest
Example:
emutest -t path/to/random_test.lua
You can also pass the core and rom like this:
emutest -L path/to/core_libretro.so -r path/to/rom.bin -t path/to/test.lua
This is an example test file:
set_options_string("mesen-s_hle_coprocessor = \"enabled\"")
load_core("../mesens/Libretro/mesens_libretro.so")
load_game("../roms/Nintendo - Super Nintendo Entertainment System/Super Mario Kart (Europe).zip")
local logs = get_logs()
if not string.find(logs, "Coprocessor: DSP1B") then
error("missing dsp log")
end
for i=1,20 do run() end
local _, _, _, frame1 = get_video()
for i=1,500 do run() end
local _, _, _, frame2 = get_video()
if frame1 == frame2 then
error("hle coproc not working")
end
local state = get_state()
if string.len(state) ~= 542720 then
error("wrong savestate size")
end
screenshot("../mkart.png")
set_inputs(0, "0001000000000000") -- press start for player 1
for i=1,60 do run() end
screenshot("../mkart2.png")
local crc = get_fb_crc()
print(crc)
You can find more test examples in the examples
folder.
To run the same test on a full set of ROMs in parallel:
find "./nesroms" -type f -name '*.zip' | \
parallel -j 8 ./emutest -L ~/mesen/Libretro/mesen_libretro.dylib -r {} -t boot200.lua