diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index d910b53..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(libjs-test262 CXX) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -# See slide 100 of the following ppt :^) -# https://crascit.com/wp-content/uploads/2019/09/Deep-CMake-For-Library-Authors-Craig-Scott-CppCon-2019.pdf -if (NOT APPLE) - set(CMAKE_INSTALL_RPATH $ORIGIN) -endif() -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - -option(ENABLE_ADDRESS_SANITIZER "Enable address sanitizer testing in gcc/clang" OFF) -option(ENABLE_UNDEFINED_SANITIZER "Enable undefined behavior sanitizer testing in gcc/clang" OFF) - -if (ENABLE_ADDRESS_SANITIZER) - add_compile_options(-fsanitize=address -fno-omit-frame-pointer) - add_link_options(-fsanitize=address) -endif() - -if (ENABLE_UNDEFINED_SANITIZER) - add_compile_options(-fsanitize=undefined -fno-omit-frame-pointer) - add_link_options(-fsanitize=undefined) -endif() - -include (FetchContent) -include (cmake/FetchLagom.cmake) - -include(${Lagom_SOURCE_DIR}/../CMake/lagom_compile_options.cmake) diff --git a/README.md b/README.md index ccf954a..248e5fb 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,22 @@ # LibJS test262 -> Run the [Official ECMAScript Conformance Test Suite](https://github.com/tc39/test262) with [Ladybird](https://github.com/LadybirdWebBrowser/ladybird)'s [`LibJS`](https://github.com/LadybirdWebBrowser/ladybird/tree/master/Userland/Libraries/LibJS) +Run the [Official ECMAScript Conformance Test Suite](https://github.com/tc39/test262) with [Ladybird](https://github.com/LadybirdWebBrowser/ladybird)'s [`LibJS`](https://github.com/LadybirdWebBrowser/ladybird/tree/master/Userland/Libraries/LibJS) ## Installation -Install `git`, `cmake`, `ninja`, `gcc`/`clang` and `python3` (3.9+). +First, clone and build [the Ladybird project](https://github.com/LadybirdBrowser/ladybird/blob/master/Documentation/BuildInstructionsLadybird.md). +To run test262, only the `test262-runner` Ladybird target needs to be built. From the Ladybird checkout, run: -To install the script's dependencies, run: +```bash +./Meta/ladybird.sh build test262-runner +``` + +Then, in the libjs-test262 project, set up a virtual environment (optional) and install the script's dependencies: + +```bash +virtualenv .venv +source .venv/bin/activate -```console pip3 install -r requirements.txt ``` @@ -16,21 +24,19 @@ Dependencies are: - `tqdm` for displaying a progress bar -## Usage - -To clone test262, clone ladybird and build Lagom run: +Finally, clone or sync test262 itself: -```console -./setup.sh +```bash +./sync-test262.sh ``` -The repositories will only be cloned if they don't exist yet locally. -If `LADYBIRD_SOURCE_DIR` is set, it will be used to compile the runner instead of cloning ladybird. +## Usage -Once that's done, run: +In the below command, `LADYBIRD_SOURCE_DIR` should point to the Ladybird checkout. The exact path to `test262-runner` +may vary depending on any extra options that were provided to `ladybird.sh` above. -```console -python3 main.py --libjs-test262-runner ./Build/bin/test262-runner --test262-root ./test262/ +```bash +./main.py --libjs-test262-runner "${LADYBIRD_SOURCE_DIR}/Build/ladybird/bin/test262-runner" --test262-root ./test262 ``` ## Options @@ -65,9 +71,7 @@ options: --debug enable debug logging of the runner ``` -## Current status +## Results -Most of the tests run to completion and yield correct results. Few of the test -harness files do not parse yet or generate runtime errors, those are listed in -the results under a separate category, as are tests that fail to parse their -metadata, time out, or crash the engine (todo assertion failures, mostly). +Test results are updated for every commit to the Ladybird repository. They may be viewed here: +https://ladybirdbrowser.github.io/libjs-website/test262/ diff --git a/cmake/FetchLagom.cmake b/cmake/FetchLagom.cmake deleted file mode 100644 index 54a93dd..0000000 --- a/cmake/FetchLagom.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2021, Andrew Kaster -# -# SPDX-License-Identifier: MIT - -# Fetch ladybird, so that we can build Lagom from it -FetchContent_Declare(lagom - GIT_REPOSITORY https://github.com/LadybirdWebBrowser/ladybird.git - GIT_TAG origin/master - GIT_SHALLOW TRUE - SOURCE_DIR serenity -) - -# Allow developers to skip download/update steps with local checkout -if (LADYBIRD_SOURCE_DIR) - set(FETCHCONTENT_SOURCE_DIR_LAGOM ${LADYBIRD_SOURCE_DIR} CACHE PATH "Developer's pre-existing serenity source directory" FORCE) - message(STATUS "Using pre-existing LADYBIRD_SOURCE_DIR: ${LADYBIRD_SOURCE_DIR}") -endif() - -# Can't use FetchContent_MakeAvailable b/c we want to use the Lagom build, not the main build -# Populate source directory for lagom -FetchContent_GetProperties(lagom) -if (NOT lagom_POPULATED) - FetchContent_Populate(lagom) - set(BUILD_LAGOM ON CACHE INTERNAL "Build all Lagom targets") - - # FIXME: Setting target_include_directories on Lagom libraries might make this unecessary? - include_directories(${lagom_SOURCE_DIR}/Userland/Libraries) - include_directories(${lagom_SOURCE_DIR}) - include_directories(${lagom_BINARY_DIR}) - - # We set EXCLUDE_FROM_ALL to make sure that only required Lagom libraries are built - add_subdirectory(${lagom_SOURCE_DIR}/Meta/Lagom ${lagom_BINARY_DIR} EXCLUDE_FROM_ALL) -endif() diff --git a/setup.sh b/setup.sh deleted file mode 100755 index 58797ea..0000000 --- a/setup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -TEST262_SOURCE_DIR="${TEST262_SOURCE_DIR:-test262}" -LIBJS_TEST262_BUILD_DIR="Build" - -log() { - echo -e "\033[0;34m[${1}]\033[0m ${2}" -} - -if [[ ! -d "${TEST262_SOURCE_DIR}" ]]; then - log test262 "Source directory not found, cloning repository" - git clone --depth 1 https://github.com/tc39/test262.git -fi - -mkdir -p "${LIBJS_TEST262_BUILD_DIR}" -pushd "${LIBJS_TEST262_BUILD_DIR}" - log libjs-test262-runner "Running CMake..." - cmake -GNinja .. -DLADYBIRD_SOURCE_DIR="${LADYBIRD_SOURCE_DIR}" - - log libjs-test262-runner "Building..." - cmake --build . --target test262-runner test-js -popd diff --git a/sync-test262.sh b/sync-test262.sh new file mode 100755 index 0000000..ebcb3de --- /dev/null +++ b/sync-test262.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +TEST262_SOURCE_DIR="${TEST262_SOURCE_DIR:-test262}" + +log() { + echo -e "\033[0;34m[${1}]\033[0m ${2}" +} + +if [[ -d "${TEST262_SOURCE_DIR}" ]]; then + log test262 "Updating test262 directory" + + pushd "${TEST262_SOURCE_DIR}" + git pull + popd +else + log test262 "test262 directory not found, cloning repository" + git clone --depth 1 https://github.com/tc39/test262.git +fi