the test will repeated boot the operating system and use the serial log to determine if the boot was successful. if a problem is detected, a debugger is automatically started and attached.
36 lines
1.1 KiB
CMake
36 lines
1.1 KiB
CMake
find_package(Python COMPONENTS Interpreter)
|
|
if (NOT Python_EXECUTABLE)
|
|
message(STATUS "QEMU: Cannot find python. Direct-kernel boot testing unavailable")
|
|
return()
|
|
endif ()
|
|
|
|
find_program(QEMU qemu-system-${TARGET_ARCH} REQUIRED)
|
|
if (NOT QEMU)
|
|
message(STATUS "QEMU: Cannot find qemu-system-${TARGET_ARCH}. Direct-kernel boot testing unavailable")
|
|
return()
|
|
endif ()
|
|
|
|
set(patched_kernel ${CMAKE_CURRENT_BINARY_DIR}/kernel/${kernel_name}.elf32)
|
|
set(generic_flags -m 1G -cpu qemu64,+rdrand)
|
|
set(this_dir ${CMAKE_SOURCE_DIR}/arch/${CMAKE_SYSTEM_PROCESSOR})
|
|
set(no_debug_flags)
|
|
|
|
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
|
message(STATUS "QEMU: Enabling KVM acceleration")
|
|
set(no_debug_flags ${no_debug_flags} -enable-kvm)
|
|
else ()
|
|
message(STATUS "QEMU: Host system is not Linux. KVM acceleration unavailable")
|
|
endif ()
|
|
|
|
message(STATUS "Test: Enable direct-kernel boot testing with QEMU")
|
|
add_custom_target(test-successful-boot
|
|
COMMAND
|
|
${this_dir}/test/successful-boot
|
|
${Python_EXECUTABLE}
|
|
${this_dir}/test/check-results
|
|
${QEMU}
|
|
${patched_kernel}
|
|
${sys_dir}/${bsp_name}
|
|
USES_TERMINAL
|
|
DEPENDS ${patched_kernel} bsp)
|