Skip to content

Commit

Permalink
Sanitizers (#101)
Browse files Browse the repository at this point in the history
- Sanitizer builds
Add a configuration for sanitizers
Run TSan config, UBsan + ASan config
Ensure unit tests run with aligned configurations (and remove the CMake files)

- Various TSan fixes
Minor adjustments in memory orders

- Elf parser fixes
Fix to ignore some out of bound elf symbols
Addition of a test for the elf parser

- CI: Daily report of sanitizer issues
  • Loading branch information
r1viollet authored Jun 18, 2024
1 parent b282057 commit 7627ee1
Show file tree
Hide file tree
Showing 56 changed files with 1,362 additions and 1,009 deletions.
304 changes: 5 additions & 299 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,311 +37,17 @@ jobs:
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
fi
test-linux-glibc:
test-matrix:
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
strategy:
matrix:
java_version: [8u362+9, 11.0.18+10, 17.0.6+10, 21.0.1+12]
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Prepare build JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: "11"
- name: Prepare JDK ${{ matrix.java_version }}
run: |
wget -nv https://download.bell-sw.com/java/${{ matrix.java_version }}/bellsoft-jdk${{ matrix.java_version }}-linux-amd64.tar.gz -O jdk.tar.gz
tar xzf *.tar.gz
find . -type d -name 'jdk*' -maxdepth 1| xargs -I {} mv {} test_jdk
- name: Test
run: |
export TEST_COMMIT=${{ github.sha }}
export TEST_CONFIGURATION=glibc/${{ matrix.java_version }}
export LIBC=glibc
export JAVA_TEST_HOME=$(pwd)/test_jdk
export BUILD_TYPE=SanitizedDebug
chmod a+x ddprof-lib/test.sh
./gradlew :ddprof-test:test --info
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: reports-linux-glibc-${{ matrix.java_version }}.zip
path: |
ddprof-test/hs_err_*
ddprof-test/build/reports/tests
ddprof-lib/src/test/build/Testing/Temporary/LastTest.log
ddprof-lib/build/tmp/compileReleaseLinuxCpp/output.txt
- uses: actions/upload-artifact@v3
if: success()
with:
name: x64-glibc
path: build/

test-ubuntu-jdk:
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
strategy:
matrix:
java_version: [11, 17, 21]
runs-on: ubuntu-22.04
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Prepare build JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: "11"
- name: Prepare JDK ${{ matrix.java_version }}
run: |
sudo apt-get update
sudo apt-get install openjdk-${{ matrix.java_version }}-jdk
uname -r
- name: Test
run: |
export TEST_COMMIT=${{ github.sha }}
export TEST_CONFIGURATION=glibc/${{ matrix.java_version }}
export LIBC=glibc
export JAVA_TEST_HOME=/usr/lib/jvm/java-${{ matrix.java_version }}-openjdk-amd64
export JAVA_HOME=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
export BUILD_TYPE=SanitizedDebug
./gradlew :ddprof-test:test --info
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: reports-linux-ubuntu-jdk-${{ matrix.java_version }}.zip
path: |
ddprof-test/hs_err_*
ddprof-test/build/reports/tests
ddprof-lib/src/test/build/Testing/Temporary/LastTest.log
ddprof-lib/build/tmp/compileReleaseLinuxCpp/output.txt
- uses: actions/upload-artifact@v3
if: success()
with:
name: x64-ubuntu-jdk
path: build/

test-linux-glibc-j9:
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
strategy:
matrix:
java_version: [8, 11, 17]
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Prepare test JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt-openj9'
java-version: "${{ matrix.java_version }}"
- name: Store JAVA_TEST_HOME
run: JAVA_PATH=$(which java) && echo "JAVA_TEST_HOME=${JAVA_PATH/\/bin\/java/\/}" >> $GITHUB_ENV
- name: Prepare build JDK
uses: actions/setup-java@v3
with:
distribution: 'adopt-openj9'
java-version: "11"
- name: Test
run: |
export TEST_COMMIT=${{ github.sha }}
export TEST_CONFIGURATION=glibc/${{ matrix.java_version }}
export LIBC=glibc
export BUILD_TYPE=SanitizedDebug
chmod a+x gradlew
chmod a+x ddprof-lib/test.sh
./gradlew :ddprof-test:test --info
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: reports-linux-glibc-j9-${{ matrix.java_version }}.zip
path: |
ddprof-test/javacore*
ddprof-test/build/reports/tests
ddprof-lib/src/test/build/Testing/Temporary/LastTest.log
ddprof-lib/build/tmp/compileReleaseLinuxCpp/output.txt
- uses: actions/upload-artifact@v3
if: success()
with:
name: x64-glibc-j9
path: build/

test-linux-glibc-oracle8:
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
runs-on: ubuntu-22.04
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Prepare build JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: "11"
- name: Prepare JDK ${{ matrix.java_version }}
run: |
sudo apt-get -y update && sudo apt-get -y install curl
set -eux;
sudo mkdir -p /usr/lib/jvm/oracle8;
# https://gist.github.com/wavezhang/ba8425f24a968ec9b2a8619d7c2d86a6?permalink_comment_id=4444663#gistcomment-4444663
# jdk1.8.0_361
curl -L --fail "https://javadl.oracle.com/webapps/download/AutoDL?BundleId=247926_0ae14417abb444ebb02b9815e2103550" | sudo tar -xvzf - -C /usr/lib/jvm/oracle8 --strip-components 1
uname -r
- name: Test
run: |
export TEST_COMMIT=${{ github.sha }}
export TEST_CONFIGURATION=glibc/8
export LIBC=glibc
export JAVA_TEST_HOME=/usr/lib/jvm/oracle8
export JAVA_HOME=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
export BUILD_TYPE=SanitizedDebug
./gradlew :ddprof-test:test --info
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: reports-linux-oracle-jdk-8.zip
path: |
ddprof-test/hs_err_*
ddprof-test/build/reports/tests
ddprof-lib/src/test/build/Testing/Temporary/LastTest.log
ddprof-lib/build/tmp/compileReleaseLinuxCpp/output.txt
- uses: actions/upload-artifact@v3
if: success()
with:
name: x64-oracle-jdk8
path: build/

test-linux-musl:
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
strategy:
matrix:
java_version: [8u362+9, 11.0.18+10, 17.0.6+10, 21.0.1+12]
runs-on: ubuntu-latest
timeout-minutes: 10
container:
image: "bellsoft/liberica-openjdk-alpine-musl:11.0.17"
options: --cpus 2
steps:
- uses: actions/checkout@v3
- name: Setup system
run: apk update && apk add curl moreutils wget hexdump linux-headers bash make g++ clang git cppcheck jq cmake >/dev/null
- name: Prepare build JDK
run: |
wget -nv https://download.bell-sw.com/java/11.0.18+10/bellsoft-jdk11.0.18+10-linux-x64-musl.tar.gz -O jdk.tar.gz
tar xzf *.tar.gz
find . -type d -name 'jdk*' -maxdepth 1 | xargs -I {} mv {} build_jdk
- name: Prepare JDK ${{ matrix.java_version }}
run: |
wget -nv https://download.bell-sw.com/java/${{ matrix.java_version }}/bellsoft-jdk${{ matrix.java_version }}-linux-x64-musl.tar.gz -O jdk.tar.gz
tar xzf *.tar.gz
find . -type d -name 'jdk*' -maxdepth 1 | xargs -I {} mv {} test_jdk
- name: Test
run: |
set -x
export JAVA_HOME=$(pwd)/build_jdk
export PATH=$JAVA_HOME/bin:$PATH
export TEST_COMMIT=${{ github.sha }}
export TEST_CONFIGURATION=musl/${{ matrix.java_version }}
export LIBC=musl
export JAVA_TEST_HOME=$(pwd)/test_jdk
chmod a+x ddprof-lib/test.sh
./gradlew :ddprof-test:test --info
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: reports-linux-musl-${{ matrix.java_version }}.zip
path: |
ddprof-test/hs_err_*
ddprof-test/build/reports/tests
ddprof-lib/src/test/build/Testing/Temporary/LastTest.log
ddprof-lib/build/tmp/compileReleaseLinuxCpp/output.txt
- uses: actions/upload-artifact@v3
if: success()
with:
name: x64-musl
path: build/

test-linux-glibc-zing:
needs: check-for-pr
if: needs.check-for-pr.outputs.skip != 'true'
strategy:
matrix:
java_version: [ 8, 11, 17, 21 ]
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- uses: actions/checkout@v3
- name: Prepare build JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: "11"
- name: Prepare JDK ${{ matrix.java_version }}
run: |
sudo apt-get -y update && sudo apt-get -y install curl g++-9 gcc-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --set gcc /usr/bin/gcc-9
set -eux
sudo mkdir -p /usr/lib/jvm/zing
if [ "${{ matrix.java_version }}" = "8" ]; then
# jdk1.8.0_372
curl -L --fail "https://cdn.azul.com/zing-zvm/ZVM23.05.0.0/zing23.05.0.0-2-jdk8.0.372-linux_x64.tar.gz" | sudo tar -xvzf - -C /usr/lib/jvm/zing --strip-components 1
elif [ "${{ matrix.java_version }}" = "11" ]; then
# jdk 11.0.19
curl -L --fail "https://cdn.azul.com/zing-zvm/ZVM23.05.0.0/zing23.05.0.0-2-jdk11.0.19-linux_x64.tar.gz" | sudo tar -xvzf - -C /usr/lib/jvm/zing --strip-components 1
elif [ "${{ matrix.java_version }}" = "17" ]; then
# jdk 17.0.7
curl -L --fail "https://cdn.azul.com/zing-zvm/ZVM23.05.0.0/zing23.05.0.0-2-jdk17.0.7-linux_x64.tar.gz" | sudo tar -xvzf - -C /usr/lib/jvm/zing --strip-components 1
elif [ "${{ matrix.java_version }}" = "21" ]; then
# jdk 21.0.2
curl -L --fail "https://cdn.azul.com/zing-zvm/ZVM23.10.0.0/zing23.10.0.0-3-jdk21.0.1-linux_x64.tar.gz" | sudo tar -xvzf - -C /usr/lib/jvm/zing --strip-components 1
fi
# rename the bundled libstdc++.so to avoid conflicts with the system one
sudo mv /usr/lib/jvm/zing/etc/libc++/libstdc++.so.6 /usr/lib/jvm/zing/etc/libc++/libstdc++.so.6.bak
- name: Test
run: |
export TEST_COMMIT=${{ github.sha }}
export TEST_CONFIGURATION=glibc/${{ matrix.java_version }}
export LIBC=glibc
export JAVA_TEST_HOME=/usr/lib/jvm/zing
export JAVA_HOME=$JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
export BUILD_TYPE=SanitizedDebug
./gradlew :ddprof-test:test --info
- name: Upload logs
uses: actions/upload-artifact@v3
if: always()
with:
name: reports-linux-zing-jdk-${{ matrix.java_version }}.zip
path: |
ddprof-test/hs_err_*
ddprof-test/build/reports/tests/test
ddprof-lib/src/test/build/Testing/Temporary/LastTest.log
ddprof-lib/build/tmp/compileReleaseLinuxCpp/output.txt
- uses: actions/upload-artifact@v3
if: success()
with:
name: x64-glibc-zing-${{ matrix.java_version }}
path: build/
uses: ./.github/workflows/test_workflow.yml
with:
configuration: '["debug"]'

gh-release:
if: startsWith(github.event.ref, 'refs/heads/release/')
runs-on: ubuntu-latest
needs: [test-linux-musl, test-linux-glibc, test-linux-glibc-j9]
needs: [test-matrix]
steps:
- name: Create Github Release
uses: ./.github/workflows/gh_release.yml@gh-release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,6 @@ jobs:
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- run: ./gradlew -x test assembleJar
- run: ./gradlew -x test assembleReleaseJar
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
6 changes: 3 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
scenarios=$(cat ./artifacts/failures.txt | tr '\n' ',')
echo "Failed scenarios: $scenarios"
curl -X POST "${{ secrets.SLACK_WEBHOOK }}" \
-H 'Content-Type: application/json' \
-d "{'scenarios': '${scenarios}', 'failed_run_url': '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'}"
# curl -X POST "${{ secrets.SLACK_WEBHOOK }}" \
# -H 'Content-Type: application/json' \
# -d "{'scenarios': '${scenarios}', 'failed_run_url': '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'}"

Loading

0 comments on commit 7627ee1

Please sign in to comment.