Skip to content

LibELF: Implement dlclose similar to how it is done in glibc #66682

LibELF: Implement dlclose similar to how it is done in glibc

LibELF: Implement dlclose similar to how it is done in glibc #66682

Workflow file for this run

name: Build, lint, and test
on: [push, pull_request]
env:
# Don't mix these up!
# runner.workspace = /home/runner/work/serenity
# github.workspace = /home/runner/work/serenity/serenity
SERENITY_SOURCE_DIR: ${{ github.workspace }}
SERENITY_CCACHE_DIR: ${{ github.workspace }}/.ccache
TOOLCHAIN_CCACHE_DIR: ${{ github.workspace }}/Toolchain/.ccache
concurrency:
group: ${{ github.head_ref || format('{0}-{1}', github.ref, github.run_number) }}
cancel-in-progress: true
jobs:
build_and_test_serenity:
runs-on: ${{ matrix.os }}
if: github.repository == 'SerenityOS/serenity'
strategy:
fail-fast: false
matrix:
debug-options: ['ALL_DEBUG', 'NORMAL_DEBUG']
os: [ubuntu-22.04]
arch: ['x86_64', 'aarch64']
# If ccache is broken and you would like to bust the ccache cache on Github Actions, increment this:
ccache-mark: [0]
exclude:
# We currently manually disable the ALL_DEBUG build on AArch64 for sake of saving CI time, as it's not our main target.
- debug-options: 'ALL_DEBUG'
arch: 'aarch64'
steps:
# Pull requests can trail behind `master` and can cause breakage if merging before running the CI checks on an updated branch.
# Luckily, GitHub creates and maintains a merge branch that is updated whenever the target or source branch is modified. By
# checking this branch out, we gain a stabler `master` at the cost of reproducibility.
- uses: actions/checkout@v4
if: ${{ github.event_name != 'pull_request' }}
- uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: 'Set up environment'
uses: ./.github/actions/setup
with:
os: 'Serenity'
arch: ${{ matrix.arch }}
# === PREPARE FOR BUILDING ===
- name: Lint
run: ${{ github.workspace }}/Meta/lint-ci.sh
- name: Restore Caches
uses: ./.github/actions/cache-restore
id: 'cache-restore'
with:
os: 'Serenity'
arch: ${{ matrix.arch }}
toolchain: 'GNU'
cache_key_extra: ${{ matrix.debug-options }}
serenity_ccache_path: ${{ env.SERENITY_CCACHE_DIR }}
toolchain_ccache_path: ${{ env.TOOLCHAIN_CCACHE_DIR }}
download_cache_path: ${{ github.workspace }}/Build/caches
- name: Build toolchain
if: ${{ !steps.cache-restore.outputs.toolchain_prebuilt_hit }}
run: ARCH="${{ matrix.arch }}" ${{ github.workspace }}/Toolchain/BuildGNU.sh
env:
CCACHE_DIR: ${{ env.TOOLCHAIN_CCACHE_DIR }}
- name: Build AArch64 Qemu
if: ${{ matrix.arch == 'aarch64' && !steps.cache-restore.outputs.qemu_cache_hit }}
run: ${{ github.workspace }}/Toolchain/BuildQemu.sh
env:
CCACHE_DIR: ${{ env.TOOLCHAIN_CCACHE_DIR }}
- name: Create build environment with extra debug options
# Build the entire project with all available debug options turned on, to prevent code rot.
# However, it is unwieldy and slow to run tests with them enabled, so we will build twice.
run: |
cmake -S Meta/CMake/Superbuild -B Build/superbuild -GNinja \
-DSERENITY_ARCH=${{ matrix.arch }} \
-DSERENITY_TOOLCHAIN=GNU \
-DBUILD_LAGOM=ON \
-DCMAKE_C_COMPILER=gcc-13 \
-DCMAKE_CXX_COMPILER=g++-13 \
-DENABLE_ALL_DEBUG_FACILITIES=ON \
-DENABLE_PCI_IDS_DOWNLOAD=OFF \
-DENABLE_USB_IDS_DOWNLOAD=OFF
if: ${{ matrix.debug-options == 'ALL_DEBUG' }}
env:
CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }}
- name: Create build environment
working-directory: ${{ github.workspace }}
# Note that we do not set BUILD_LAGOM for the normal debug build
# We build and run the Lagom tests in a separate job, and sanitizer builds take a good while longer than non-sanitized.
run: |
cmake -S Meta/CMake/Superbuild -B Build/superbuild -GNinja \
-DSERENITY_ARCH=${{ matrix.arch }} \
-DSERENITY_TOOLCHAIN=GNU \
-DCMAKE_C_COMPILER=gcc-13 \
-DCMAKE_CXX_COMPILER=g++-13 \
-DENABLE_UNDEFINED_SANITIZER=ON \
-DUNDEFINED_BEHAVIOR_IS_FATAL=ON \
-DDUMP_REGIONS_ON_CRASH=ON \
-DENABLE_PCI_IDS_DOWNLOAD=OFF \
-DENABLE_USB_IDS_DOWNLOAD=OFF
if: ${{ matrix.debug-options == 'NORMAL_DEBUG' }}
env:
CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }}
# === ACTUALLY BUILD ===
- name: Build Serenity and Tests
working-directory: ${{ github.workspace }}/Build/superbuild
run: cmake --build .
env:
CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }}
- name: Save Caches
uses: ./.github/actions/cache-save
with:
arch: ${{ matrix.arch }}
qemu_cache_primary_key: ${{ steps.cache-restore.outputs.qemu_cache_primary_key }}
qemu_cache_hit: ${{ steps.cache-restore.outputs.qemu_cache_hit }}
serenity_ccache_path: ${{ env.SERENITY_CCACHE_DIR }}
serenity_ccache_primary_key: ${{ steps.cache-restore.outputs.serenity_ccache_primary_key }}
toolchain_ccache_path: ${{ env.TOOLCHAIN_CCACHE_DIR }}
toolchain_ccache_primary_key: ${{ steps.cache-restore.outputs.toolchain_ccache_primary_key }}
toolchain_prebuilt_path: ${{ steps.cache-restore.outputs.toolchain_prebuilt_path }}
toolchain_prebuilt_primary_key: ${{ steps.cache-restore.outputs.toolchain_prebuilt_primary_key }}
toolchain_prebuilt_hit: ${{ steps.cache-restore.outputs.toolchain_prebuilt_hit }}
- name: Create Serenity Rootfs
if: ${{ matrix.debug-options == 'NORMAL_DEBUG' }}
working-directory: ${{ github.workspace }}/Build/${{ matrix.arch }}
run: ninja install && ninja qemu-image
- name: Run On-Target Tests
if: ${{ matrix.debug-options == 'NORMAL_DEBUG' && matrix.arch != 'aarch64' }}
working-directory: ${{ github.workspace }}/Build/${{ matrix.arch }}
env:
SERENITY_QEMU_CPU: "max,vmx=off"
SERENITY_KERNEL_CMDLINE: "graphics_subsystem_mode=off panic=shutdown system_mode=self-test"
SERENITY_RUN: "ci"
run: |
echo "::group::ninja run # Qemu output"
ninja run
echo "::endgroup::"
echo "::group::Verify Output File"
mkdir fsmount
sudo mount -t ext2 -o loop,rw _disk_image fsmount
echo "Results: "
sudo cat fsmount/home/anon/test-results.log
if ! sudo grep -q "Failed: 0" fsmount/home/anon/test-results.log
then
echo "::error:: :^( Tests failed, failing job"
exit 1
fi
echo "::endgroup::"
timeout-minutes: 60
- name: Print Target Logs
# Extremely useful if Serenity hangs trying to run one of the tests
if: ${{ !cancelled() && matrix.debug-options == 'NORMAL_DEBUG'}}
working-directory: ${{ github.workspace }}/Build/${{ matrix.arch }}
run: '[ ! -e debug.log ] || cat debug.log'