Migrate more tests to libretro.py

This commit is contained in:
Jesse Talavera 2024-03-21 15:32:59 -04:00
parent 61da6697aa
commit 173d0d0366
3 changed files with 83 additions and 64 deletions

View File

@ -1,74 +1,56 @@
# See https://github.com/JesseTG/melonds-ds/issues/62
add_emutest_test(
NAME "Core resets when using built-in system files and direct boot (NDS)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
CORE_OPTION melonds_boot_mode="direct"
CORE_OPTION melonds_show_cursor="disabled"
CORE_OPTION melonds_sysfile_mode="builtin"
CORE_OPTION melonds_console_mode="ds"
add_python_test(
NAME "Core resets when using built-in system files and direct boot (NDS)"
TEST_MODULE reset.no_hang_on_reboot
CONTENT "${NDS_ROM}"
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_show_cursor=disabled"
CORE_OPTION "melonds_sysfile_mode=builtin"
)
add_emutest_test(
NAME "Core resets when using native system files and direct boot (NDS)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
ARM7_BIOS
ARM9_BIOS
NDS_FIRMWARE
CORE_OPTION melonds_firmware_nds_path='melonDS DS/${NDS_FIRMWARE_NAME}'
CORE_OPTION melonds_boot_mode="direct"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
CORE_OPTION melonds_console_mode="ds"
add_python_test(
NAME "Core resets when using native system files and direct boot (NDS)"
TEST_MODULE reset.no_hang_on_reboot
CONTENT "${NDS_ROM}"
NDS_SYSFILES
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
CORE_OPTION "melonds_sysfile_mode=native"
)
add_emutest_test(
NAME "Core resets when using native system files and native boot (NDS)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
ARM7_BIOS
ARM9_BIOS
NDS_FIRMWARE
CORE_OPTION melonds_firmware_nds_path="melonDS DS/${NDS_FIRMWARE_NAME}"
CORE_OPTION melonds_boot_mode="native"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
add_python_test(
NAME "Core resets when using native system files and native boot (NDS)"
TEST_MODULE reset.no_hang_on_reboot
CONTENT "${NDS_ROM}"
NDS_SYSFILES
CORE_OPTION "melonds_boot_mode=native"
CORE_OPTION "melonds_console_mode=ds"
CORE_OPTION "melonds_firmware_nds_path=melonDS DS/${NDS_FIRMWARE_NAME}"
CORE_OPTION "melonds_sysfile_mode=native"
)
add_emutest_test(
NAME "Core resets when using native system files and direct boot (DSi)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_FIRMWARE
DSI_NAND
CORE_OPTION melonds_firmware_dsi_path="melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_boot_mode="direct"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
add_python_test(
NAME "Core resets when using native system files and direct boot (DSi)"
TEST_MODULE reset.no_hang_on_reboot
CONTENT "${NDS_ROM}"
DSI_SYSFILES
CORE_OPTION "melonds_boot_mode=direct"
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION "melonds_firmware_dsi_path=melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION "melonds_sysfile_mode=native"
)
add_emutest_test(
NAME "Core resets when using native system files and native boot (DSi)"
CONTENT "${NDS_ROM}"
TEST_SCRIPT "no-hang-on-reboot.lua"
ARM7_BIOS
ARM9_BIOS
ARM7_DSI_BIOS
ARM9_DSI_BIOS
DSI_FIRMWARE
DSI_NAND
CORE_OPTION melonds_firmware_dsi_path="melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION melonds_console_mode="dsi"
CORE_OPTION melonds_dsi_nand_path="melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION melonds_boot_mode="native"
CORE_OPTION melonds_sysfile_mode="native"
CORE_OPTION melonds_show_cursor="disabled"
add_python_test(
NAME "Core resets when using native system files and native boot (DSi)"
TEST_MODULE reset.no_hang_on_reboot
CONTENT "${NDS_ROM}"
DSI_SYSFILES
CORE_OPTION "melonds_boot_mode=native"
CORE_OPTION "melonds_console_mode=dsi"
CORE_OPTION "melonds_dsi_nand_path=melonDS DS/${DSI_NAND_NAME}"
CORE_OPTION "melonds_firmware_dsi_path=melonDS DS/${DSI_FIRMWARE_NAME}"
CORE_OPTION "melonds_sysfile_mode=native"
)

View File

View File

@ -0,0 +1,37 @@
from array import array
from typing import cast
from libretro import Session
from libretro.api.video import SoftwareVideoState
import prelude
options = {
b"melonds_show_cursor": b"disabled"
}
WHITE = (0xFF, 0xFF, 0xFF, 0xFF)
session: Session
with prelude.session(options=options) as session:
session.core.run()
video = cast(SoftwareVideoState, session.video)
# Very first frame should be all white
blank_frame = array(video.frame.typecode, video.frame)
assert all(byte == 0xFF for byte in blank_frame), "Screen is not blank"
for i in range(300):
session.core.run()
after_frame = array(video.frame.typecode, video.frame)
assert blank_frame != after_frame, "Screen is still blank after 300 frames"
session.core.reset()
for i in range(300):
session.core.run()
after_reset_frame = array(video.frame.typecode, video.frame)
assert blank_frame != after_reset_frame, "Screen is still blank after resetting and running for 300 frames"