LibWeb: Run tests in lagom if ENABLE_LAGOM_LIBWEB is set

This commit is contained in:
Ben Wiederhake 2023-01-09 22:29:39 +01:00 committed by Andrew Kaster
parent 79b9dd6248
commit 0687a75eaa
Notes: sideshowbarker 2024-07-18 22:57:59 +09:00
2 changed files with 18 additions and 1 deletions

View File

@ -662,6 +662,16 @@ if (BUILD_LAGOM)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibVideo)
endforeach()
# Web
if (ENABLE_LAGOM_LIBWEB)
file(COPY "${SERENITY_PROJECT_ROOT}/Tests/LibWeb/tokenizer-test.html" DESTINATION "./")
file(GLOB LIBWEB_TEST_SOURCES CONFIGURE_DEPENDS "../../Tests/LibWeb/*.cpp")
foreach(source ${LIBWEB_TEST_SOURCES})
lagom_test(${source} LIBS LibWeb
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibWeb)
endforeach()
endif()
# JavaScriptTestRunner + LibTest tests
# test-js
add_executable(test-js

View File

@ -201,7 +201,14 @@ TEST_CASE(doctype)
// If that changes, or something is added to the test HTML, the hash needs to be adjusted.
TEST_CASE(regression)
{
auto file = MUST(Core::Stream::File::open("/usr/Tests/LibWeb/tokenizer-test.html"sv, Core::Stream::OpenMode::Read));
// This makes sure that the tests will run both on target and in Lagom.
#ifdef AK_OS_SERENITY
StringView path = "/usr/Tests/LibWeb/tokenizer-test.html"sv;
#else
StringView path = "tokenizer-test.html"sv;
#endif
auto file = MUST(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
auto file_size = MUST(file->size());
auto content = MUST(ByteBuffer::create_uninitialized(file_size));
MUST(file->read(content.bytes()));