From 9f9b8e7273d11f0d1046c2d4cd3428f3c2e96954 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 30 Jan 2023 15:07:07 -0500 Subject: [PATCH] CI: Move running LibWeb layout tests to Azure The current config on GitHub Actions does not use ccache, so it takes quite a while to build. Instead, let's just run these tests on Azure where we already build Ladybird and have ccache enabled. This also lets us sanitize LibWeb on both Linux and macOS. The script changes here are to A) handle differences between Azure and GitHub Actions and B) to support running on macOS. --- .github/workflows/libweb-layout.yml | 57 ----------------------------- Meta/Azure/Lagom.yml | 10 +++++ Tests/LibWeb/Layout/layout_test.sh | 35 ++++++++++++------ 3 files changed, 33 insertions(+), 69 deletions(-) delete mode 100644 .github/workflows/libweb-layout.yml diff --git a/.github/workflows/libweb-layout.yml b/.github/workflows/libweb-layout.yml deleted file mode 100644 index 0c7ebd383b..0000000000 --- a/.github/workflows/libweb-layout.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Test LibWeb layout -on: [ push, pull_request ] - -env: - SERENITY_SOURCE_DIR: ${{ github.workspace }} - -concurrency: libweb-layout - -jobs: - build: - runs-on: ubuntu-22.04 - if: github.repository == 'SerenityOS/serenity' - strategy: - fail-fast: true - steps: - - uses: actions/checkout@v3 - - name: "Install Ubuntu dependencies" - run: | - sudo apt-get update - sudo apt-get install -y ninja-build gcc-12 g++-12 libstdc++-12-dev \ - libgl1-mesa-dev qt6-base-dev qt6-tools-dev-tools \ - - name: "Create build directories" - run: | - mkdir -p ${{ github.workspace }}/Build/caches/TZDB - mkdir -p ${{ github.workspace }}/Build/caches/UCD - mkdir -p ${{ github.workspace }}/Build/caches/CLDR - - name: "TimeZoneData cache" - uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b - with: - path: ${{ github.workspace }}/Build/caches/TZDB - key: TimeZoneData-${{ hashFiles('Meta/CMake/time_zone_data.cmake') }} - - name: "UnicodeData cache" - uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b - with: - path: ${{ github.workspace }}/Build/caches/UCD - key: UnicodeData-${{ hashFiles('Meta/CMake/unicode_data.cmake') }} - - name: "UnicodeLocale cache" - uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b - with: - path: ${{ github.workspace }}/Build/caches/CLDR - key: UnicodeLocale-${{ hashFiles('Meta/CMake/locale_data.cmake') }} - - name: "Create Ladybird build environment" - run: | - cmake -GNinja \ - -B ${{ github.workspace }}/Build/ladybird \ - -S ${{ github.workspace }}/Ladybird \ - -DCMAKE_C_COMPILER=gcc-12 \ - -DCMAKE_CXX_COMPILER=g++-12 \ - -DSERENITY_CACHE_DIR=${{ github.workspace }}/Build/cachess - - name: "Build Ladybird" - run: | - ninja -C ${{ github.workspace }}/Build/ladybird - - name: "Run layout tests" - run: | - ${{ github.workspace }}/Tests/LibWeb/Layout/layout_test.sh - env: - QT_QPA_PLATFORM: "offscreen" diff --git a/Meta/Azure/Lagom.yml b/Meta/Azure/Lagom.yml index 5384e03ec8..700908e360 100644 --- a/Meta/Azure/Lagom.yml +++ b/Meta/Azure/Lagom.yml @@ -146,6 +146,16 @@ jobs: ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1' UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1' + - script: | + $(Build.SourcesDirectory)/Tests/LibWeb/Layout/layout_test.sh "$(Build.SourcesDirectory)/Meta/Lagom/Build/Ladybird" + displayName: 'LibWeb Layout Tests' + env: + SERENITY_SOURCE_DIR: '$(Build.SourcesDirectory)' + QT_QPA_PLATFORM: 'offscreen' + # FIXME: enable detect_stack_use_after_return=1 #7420 + ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1' + UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1' + - ${{ if eq(parameters.lagom_lints, true) }}: - script: | set -e diff --git a/Tests/LibWeb/Layout/layout_test.sh b/Tests/LibWeb/Layout/layout_test.sh index 1632423aa6..e40e11e774 100755 --- a/Tests/LibWeb/Layout/layout_test.sh +++ b/Tests/LibWeb/Layout/layout_test.sh @@ -2,19 +2,30 @@ set -eo pipefail -SCRIPT_DIR="$(dirname "${0}")" -SERENITY_ROOT="$(realpath "${SCRIPT_DIR}"/../../..)" -LADYBIRD_BUILD_DIR="${SERENITY_ROOT}/Build/ladybird" +SCRIPT_DIR="$(cd -P -- "$(dirname -- "${0}")" && pwd -P)" +LADYBIRD_BUILD_DIR="${1}" -for filename in "$SCRIPT_DIR"/input/*; do - name=$(basename "$filename" .html) - input_html_path=$(realpath "$SCRIPT_DIR")/input/"$name".html - output_layout_dump=$(cd "$LADYBIRD_BUILD_DIR"; ./ladybird -d "$input_html_path") - expected_layout_dump_path="$(realpath "$SCRIPT_DIR")/expected/$name.txt" - if cmp <(echo "$output_layout_dump") "$expected_layout_dump_path"; then - echo "$name PASSED" +if [[ -z "${LADYBIRD_BUILD_DIR}" ]] ; then + echo "Provide path to the Ladybird build directory" + exit 1 +fi + +if [[ "$(uname -s)" = "Darwin" ]] ; then + LADYBIRD_BINARY="./ladybird.app/Contents/MacOS/ladybird" +else + LADYBIRD_BINARY="./ladybird" +fi + +for input_html_path in "${SCRIPT_DIR}"/input/*; do + input_html_file="$(basename "${input_html_path}" .html)" + + output_layout_dump=$(cd "${LADYBIRD_BUILD_DIR}"; "${LADYBIRD_BINARY}" -d "${input_html_path}") + expected_layout_dump_path="${SCRIPT_DIR}/expected/${input_html_file}.txt" + + if cmp <(echo "${output_layout_dump}") "${expected_layout_dump_path}"; then + echo "${input_html_file} PASSED" else - echo "$name FAILED" - diff "$expected_layout_dump_path" <(echo "$output_layout_dump") + echo "${input_html_file} FAILED" + diff "${expected_layout_dump_path}" <(echo "${output_layout_dump}") fi done