-
Notifications
You must be signed in to change notification settings - Fork 35
Add script for running valgrind tests and Nightly CI job #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bratpiorka
merged 1 commit into
oneapi-src:main
from
ldorau:Add_script_for_running_valgrind_tests
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Nightly | ||
|
||
# This job is run at 00:00 UTC every day or on demand. | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
Valgrind: | ||
name: Valgrind | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tool: ['memcheck'] # TODO: enable 'drd' and 'helgrind' when all issues are fixed | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install apt packages | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y cmake libjemalloc-dev libnuma-dev libtbb-dev valgrind | ||
|
||
- name: Configure CMake | ||
run: > | ||
cmake | ||
-B ${{github.workspace}}/build | ||
-DCMAKE_BUILD_TYPE=Debug | ||
-DUMF_FORMAT_CODE_STYLE=OFF | ||
-DUMF_DEVELOPER_MODE=ON | ||
-DUMF_ENABLE_POOL_TRACKING=ON | ||
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON | ||
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON | ||
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON | ||
|
||
- name: Build | ||
run: > | ||
cmake --build ${{github.workspace}}/build --config Debug -j$(nproc) | ||
|
||
- name: Run tests under valgrind | ||
working-directory: ${{github.workspace}}/build | ||
run: ../test/test_valgrind.sh ${{matrix.tool}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#!/bin/bash | ||
# Copyright (C) 2024 Intel Corporation | ||
# Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
set -e | ||
|
||
TOOL=$1 | ||
|
||
function print_usage() { | ||
echo "$(basename $0) - run UMF tests under valgrind tools (memcheck, drd or helgrind)" | ||
echo "This script must be run in the UMF build directory. It looks for './test/umf_test-*' test executables." | ||
echo "Usage: $(basename $0) <memcheck|drd|helgrind>" | ||
} | ||
|
||
if ! valgrind --version > /dev/null; then | ||
echo "error: valgrind not found" | ||
exit 1 | ||
fi | ||
|
||
if [ $(ls -1 ./test/umf_test-* 2>/dev/null | wc -l) -eq 0 ]; then | ||
echo "error: UMF tests ./test/umf_test-* not found (perhaps wrong directory)" | ||
print_usage | ||
exit 1 | ||
fi | ||
|
||
if [ "$TOOL" == "" ]; then | ||
echo "error: valgrind tool is missing" | ||
print_usage | ||
exit 1 | ||
fi | ||
|
||
case $TOOL in | ||
memcheck) | ||
OPTION="--leak-check=full" | ||
;; | ||
drd) | ||
OPTION="--tool=drd" | ||
;; | ||
helgrind) | ||
OPTION="--tool=helgrind" | ||
;; | ||
*) | ||
echo "error: unknown tool: $TOOL" | ||
print_usage | ||
exit 1 | ||
;; | ||
esac | ||
|
||
FAIL=0 | ||
|
||
echo "Running: \"valgrind $OPTION\" for the following tests:" | ||
|
||
for tf in $(ls -1 ./test/umf_test-*); do | ||
lukaszstolarczuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[ ! -x $tf ] && continue | ||
echo -n "$tf " | ||
LOG=${tf}.log | ||
valgrind $OPTION $tf >$LOG 2>&1 || echo -n "(valgrind failed) " | ||
if grep -q -e "ERROR SUMMARY: 0 errors from 0 contexts" $LOG; then | ||
echo "- OK" | ||
rm $LOG | ||
else | ||
echo "- FAILED! : $(grep -e "ERROR SUMMARY:" $LOG | cut -d' ' -f2-)" | ||
FAIL=1 | ||
fi || true | ||
done | ||
|
||
[ $FAIL -eq 0 ] && echo PASSED && exit 0 | ||
|
||
echo | ||
echo "======================================================================" | ||
echo | ||
|
||
for log in $(ls -1 ./test/umf_test-*.log); do | ||
echo ">>>>>>> LOG $log" | ||
cat $log | ||
echo | ||
echo | ||
done | ||
|
||
exit 1 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.