From 7004d5b5956399ef6a270cc1f5b7b1f2160a73f0 Mon Sep 17 00:00:00 2001 From: Yury Gribov Date: Sun, 26 Jan 2025 15:14:52 +0300 Subject: [PATCH] Add tests with musl libc. --- .github/workflows/ci.yml | 11 +++++++++++ scripts/travis.sh | 12 ++++++++---- tests/common.sh | 8 ++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c19bd18..85e361c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,6 +104,17 @@ jobs: # - uses: actions/checkout@v3 # - name: Run tests # run: scripts/travis.sh + musl: + runs-on: ubuntu-latest + env: + CC: musl-gcc + steps: + - uses: actions/checkout@v3 + - name: Install deps + run: sudo apt-get update && sudo apt-get install musl-tools + - name: Run tests + run: scripts/travis.sh + # TODO: test on llvm-libc when it supports dlfcn x86: runs-on: ubuntu-latest env: diff --git a/scripts/travis.sh b/scripts/travis.sh index 708c635..39e9cfc 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -23,7 +23,7 @@ tests/basic/run.sh $ARCH tests/exceptions/run.sh $ARCH tests/data-warnings/run.sh $ARCH tests/vtables/run.sh $ARCH -if test -z "$ARCH"; then +if test -z "$ARCH" && ! echo "${CC:-}" | grep -q musl-gcc; then # TODO: enable for other targets tests/ld/run.sh fi @@ -34,9 +34,11 @@ fi tests/hidden/run.sh $ARCH tests/verbose/run.sh $ARCH tests/no_dlopen/run.sh $ARCH -tests/multiple-dlopens/run.sh $ARCH -tests/multiple-dlopens-2/run.sh $ARCH -tests/multiple-dlopens-3/run.sh $ARCH +if ! echo "${CC:-}" | grep -q musl-gcc; then # Musl does not implement dlclose + tests/multiple-dlopens/run.sh $ARCH + tests/multiple-dlopens-2/run.sh $ARCH + tests/multiple-dlopens-3/run.sh $ARCH +fi if ! echo "$ARCH" | grep -q powerpc; then tests/many-functions/run.sh $ARCH fi @@ -47,3 +49,5 @@ if ! echo "$ARCH" | grep -q 'powerpc\|mips\|riscv'; then fi tests/thread/run.sh $ARCH tests/thread-2/run.sh $ARCH + +echo 'All tests passed' diff --git a/tests/common.sh b/tests/common.sh index f7fd547..e2daaa4 100644 --- a/tests/common.sh +++ b/tests/common.sh @@ -1,3 +1,10 @@ +# Copyright 2019-2025 Yury Gribov +# +# The MIT License (MIT) +# +# Use of this source code is governed by MIT license that can be +# found in the LICENSE.txt file. + if test -n "${TRAVIS:-}"; then set -x fi @@ -94,6 +101,7 @@ fi # Do not bother with non-native targets if test -z "$INTERP" \ + && ! echo "$CC" | grep -q musl-gcc \ && uname | grep -q Linux \ && echo 'int main() {}' | $CC $CFLAGS -fsanitize=thread -x c - -o /dev/null 2> /dev/null; then TSAN_AVAILABLE=1