1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 06:44:58 +00:00
serenity/Meta/Azure/Lagom.yml
Timothy Flynn 5713c2ffdd CI: Work around a libasan bug seen on Ubuntu with the Linux 6.5 kernel
We are recently seeing SEGV crashes during the build (while running code
generators) from within libasan itself. Turns out this is libasan bug
seen with the Linux 6.5 kernel on Ubuntu.
2024-03-12 21:45:25 -04:00

226 lines
8.6 KiB
YAML

parameters:
os: 'Linux'
fuzzer: 'NoFuzz'
lagom_lints: false
jobs:
- job: 'Lagom_${{ parameters.os }}_${{ parameters.fuzzer }}'
timeoutInMinutes: 0 # Setting to 0 means the maximum allowed timeout is used.
variables:
- name: SERENITY_CCACHE_DIR
value: $(Build.SourcesDirectory)/.ccache
- name: job_pool
${{ if eq(parameters.os, 'Linux') }}:
value: ubuntu-22.04
${{ if or(eq(parameters.os, 'macOS'), eq(parameters.os, 'Android')) }}:
value: macos-12
- name: toolchain
${{ if eq(parameters.fuzzer, 'Fuzz') }}:
value: clang
${{ if eq(parameters.fuzzer, 'NoFuzz') }}:
value: gcc
- name: host-cc
${{ if eq(parameters.os, 'macOS') }}:
value: $(brew --prefix llvm@15)/bin/clang
${{ if not(eq(parameters.os, 'macOS')) }}:
value: gcc-12
- name: host-cxx
${{ if eq(parameters.os, 'macOS') }}:
value: $(brew --prefix llvm@15)/bin/clang++
${{ if not(eq(parameters.os, 'macOS')) }}:
value: g++-12
- name: ndk_version # only relevant for Android
value: '25.2.9519653'
pool:
vmImage: $(job_pool)
steps:
- template: Setup.yml
parameters:
os: '${{ parameters.os }}'
- template: Caches.yml
parameters:
os: '${{ parameters.os }}'
arch: 'Lagom'
toolchain: '$(toolchain)'
download_cache_path: 'Meta/Lagom/caches'
serenity_ccache_path: '$(SERENITY_CCACHE_DIR)'
with_remote_data_caches: true
${{ if eq(parameters.os, 'macOS') }}:
ccache_version: 2
serenity_ccache_size: '2G'
# On Ubuntu, with Linux kernel 6.5, ARCH_MMAP_RND_BITS was changed from ARCH_MMAP_RND_BITS_MIN (28 on x64) to
# ARCH_MMAP_RND_BITS_MAX (32 on x64). This breaks assumptions made by libasan's allocators, and we see a flaky
# crash from within libasan itself. Here, we restore the previous value until we have a version of GCC which fixes
# the issue in libasan (reportedly 13.2.1): https://stackoverflow.com/questions/77894856/possible-bug-in-gcc-sanitizers
- ${{ if eq(parameters.os, 'Linux') }}:
- script: |
sudo sysctl vm.mmap_rnd_bits=28
displayName: 'Work around libasan ASLR bug'
- ${{ if eq(parameters.os, 'Android') }}:
- script: |
yes | $ANDROID_SDK_ROOT/tools/bin/sdkmanager "ndk;$(ndk_version)"
displayName: "Install NDK $(ndk_version)"
- script: |
# Install AVD files
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install 'system-images;android-30;google_apis;x86_64'
# Create emulator
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-30;google_apis;x86_64' --force
$ANDROID_HOME/emulator/emulator -list-avds
echo "Starting emulator"
# Start emulator in background
nohup $ANDROID_HOME/emulator/emulator -avd xamarin_android_emulator -no-snapshot > /dev/null 2>&1 &
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
$ANDROID_HOME/platform-tools/adb devices
echo "Emulator started"
displayName: "Start Android Emulator"
- task: Gradle@2
inputs:
workingDirectory: 'Ladybird/Android'
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
jdkVersionOption: '17'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'connectedAndroidTest'
env:
CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
SERENITY_CACHE_DIR: "$(Build.SourcesDirectory)/Meta/Lagom/caches"
displayName: "Build and Test in Android Emulator"
- ${{ elseif eq(parameters.fuzzer, 'Fuzz') }}:
- script: |
set -e
cmake -GNinja -B tools-build \
-DBUILD_LAGOM=OFF \
-DENABLE_LAGOM_CCACHE=ON \
-DCMAKE_INSTALL_PREFIX=tool-install \
-Dpackage=LagomTools
ninja -C tools-build install
cmake -GNinja -B Build \
-DBUILD_LAGOM=ON \
-DENABLE_LAGOM_CCACHE=ON \
-DENABLE_FUZZERS_LIBFUZZER=ON \
-DENABLE_ADDRESS_SANITIZER=ON \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_PREFIX_PATH=tool-install
displayName: 'Create Build Environment'
workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom
env:
CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
- ${{ elseif eq(parameters.fuzzer, 'NoFuzz') }}:
- script: |
set -e
cmake -GNinja -B Build \
-DBUILD_LAGOM=ON \
-DENABLE_LAGOM_CCACHE=ON \
-DENABLE_LAGOM_LADYBIRD=ON \
-DINCLUDE_WASM_SPEC_TESTS=ON \
-DWASM_SPEC_TEST_SKIP_FORMATTING=ON \
-DENABLE_UNDEFINED_SANITIZER=ON \
-DENABLE_ADDRESS_SANITIZER=ON \
-DCMAKE_C_COMPILER=$(host-cc) \
-DCMAKE_CXX_COMPILER=$(host-cxx)
displayName: 'Create Build Environment'
workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom
env:
PATH: '$(PATH):$(Build.SourcesDirectory)/wabt-1.0.23/bin'
CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
- ${{ if not(eq(parameters.os, 'Android')) }}:
- script: |
set -e
cmake --build .
cmake --install . --strip --prefix $(Build.SourcesDirectory)/Meta/Lagom/Install
displayName: 'Build'
workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom/Build
env:
CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
- ${{ if and(eq(parameters.fuzzer, 'NoFuzz'), not(eq(parameters.os, 'Android')) ) }}:
- script: |
set -e
ninja test
displayName: 'Test'
workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom/Build
timeoutInMinutes: 60
env:
SERENITY_SOURCE_DIR: '$(Build.SourcesDirectory)'
CTEST_OUTPUT_ON_FAILURE: 1
ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=1'
UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1'
TESTS_ONLY: 1
# Detect if any test dumps exist, which enables the next step to publish them as an artifact.
- bash: |
if [[ -d $(Build.SourcesDirectory)/Meta/Lagom/Build/Ladybird/test-dumps ]]; then
echo "##vso[task.setvariable variable=TestDumpsExist]true"
fi
condition: always()
- publish: $(Build.SourcesDirectory)/Meta/Lagom/Build/Ladybird/test-dumps
artifact: 'test-dumps-${{ parameters.os }}-${{ parameters.fuzzer }}'
condition: eq(variables.TestDumpsExist, 'true')
- ${{ if and(eq(parameters.fuzzer, 'NoFuzz'), eq(parameters.os, 'Linux') ) }}:
- script: |
./run.sh --remove-wpt-repository
displayName: 'WPT'
workingDirectory: $(Build.SourcesDirectory)/Tests/LibWeb/WPT/
env:
SERENITY_SOURCE_DIR: '$(Build.SourcesDirectory)'
QT_QPA_PLATFORM: 'offscreen'
- ${{ if and(eq(parameters.fuzzer, 'NoFuzz'), eq(parameters.os, 'macOS') ) }}:
- script: |
set -e
cmake -B Build -DENABLE_QT=ON
displayName: 'Enable the Ladybird Qt chrome'
workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom
env:
CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
- script: |
set -e
cmake --build .
displayName: 'Build Ladybird Qt chrome'
workingDirectory: $(Build.SourcesDirectory)/Meta/Lagom/Build
env:
CCACHE_DIR: '$(SERENITY_CCACHE_DIR)'
- ${{ if eq(parameters.lagom_lints, true) }}:
- script: |
set -e
./Meta/check-markdown.sh
./Meta/lint-gml-format.sh
git ls-files '*.ipc' | xargs ./Meta/Lagom/Build/bin/IPCMagicLinter
displayName: 'Run lints that require Lagom'
workingDirectory: $(Build.SourcesDirectory)/
env:
MARKDOWN_CHECK_BINARY: ./Meta/Lagom/Build/bin/markdown-check
GML_FORMAT: ./Meta/Lagom/Build/bin/gml-format
# FIXME: enable detect_stack_use_after_return=1 #7420
ASAN_OPTIONS: 'strict_string_checks=1:check_initialization_order=1:strict_init_order=1:detect_stack_use_after_return=0'
UBSAN_OPTIONS: 'print_stacktrace=1:print_summary=1:halt_on_error=1'
- script: |
CCACHE_DIR='$(SERENITY_CCACHE_DIR)' ccache -s
displayName: 'Cache Stats'