mirror of https://github.com/rust-bpf/rust-bcc
Run tests under Valgrind to detect memory issues (#133)
Adds Valgrind to CI runs to help detect memory issues and prevent bugs.
This commit is contained in:
parent
230c75cdb8
commit
0a4e3a0aec
|
@ -1,3 +1,4 @@
|
||||||
target/
|
target/
|
||||||
bcc-sys/src/bccapi.rs
|
bcc-sys/src/bccapi.rs
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
|
*.swp
|
||||||
|
|
28
build/ci.sh
28
build/ci.sh
|
@ -4,12 +4,14 @@ set -e
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
function test {
|
function test {
|
||||||
sudo target/release/examples/smoketest
|
runner="$1"
|
||||||
sudo target/release/examples/runqlat --interval 1 --windows 5
|
|
||||||
sudo target/release/examples/opensnoop --duration 5
|
sudo $runner target/release/examples/smoketest
|
||||||
sudo target/release/examples/biosnoop --duration 5
|
sudo $runner target/release/examples/runqlat --interval 1 --windows 5
|
||||||
sudo target/release/examples/tcpretrans --duration 5
|
sudo $runner target/release/examples/opensnoop --duration 5
|
||||||
sudo target/release/examples/contextswitch --duration 5
|
sudo $runner target/release/examples/biosnoop --duration 5
|
||||||
|
sudo $runner target/release/examples/tcpretrans --duration 5
|
||||||
|
sudo $runner target/release/examples/contextswitch --duration 5
|
||||||
}
|
}
|
||||||
|
|
||||||
## Update apt
|
## Update apt
|
||||||
|
@ -29,6 +31,17 @@ sudo apt-get --yes install clang-"${LLVM_PACKAGE}" \
|
||||||
libclang-"${LLVM_PACKAGE}"-dev libelf-dev libfl-dev \
|
libclang-"${LLVM_PACKAGE}"-dev libelf-dev libfl-dev \
|
||||||
llvm-"${LLVM_PACKAGE}"-dev libz-dev llvm-"${LLVM_PACKAGE}"
|
llvm-"${LLVM_PACKAGE}"-dev libz-dev llvm-"${LLVM_PACKAGE}"
|
||||||
|
|
||||||
|
## Install Valgrind and libc debugging symbols
|
||||||
|
sudo apt-get --yes install libc6-dbg
|
||||||
|
|
||||||
|
pushd /tmp
|
||||||
|
curl -L -O https://sourceware.org/pub/valgrind/valgrind-3.16.1.tar.bz2
|
||||||
|
tar xjf valgrind-3.16.1.tar.bz2
|
||||||
|
cd valgrind-3.16.1
|
||||||
|
./configure
|
||||||
|
sudo make -j2 install
|
||||||
|
popd
|
||||||
|
|
||||||
# For static builds, we need to compile the following
|
# For static builds, we need to compile the following
|
||||||
if [[ $STATIC == true ]]; then
|
if [[ $STATIC == true ]]; then
|
||||||
export CPPFLAGS="-P"
|
export CPPFLAGS="-P"
|
||||||
|
@ -151,3 +164,6 @@ if [[ $STATIC == true ]]; then
|
||||||
fi
|
fi
|
||||||
test
|
test
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run tests with Valgrind
|
||||||
|
test "valgrind --suppressions=build/valgrind-suppressions.supp --error-exitcode=1"
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
<supress_NULL_key_in_bpf_syscall_attr>
|
||||||
|
Memcheck:Param
|
||||||
|
bpf(attr->key)
|
||||||
|
fun:syscall
|
||||||
|
...
|
||||||
|
fun:bpf_get_first_key
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
<clang_if_parser>
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:_ZN5clang6Parser16ParseIfStatementEPNS_14SourceLocationE
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
<specific_llvm_dwarf_range_span>
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:_ZN4llvm16DwarfCompileUnit8addRangeENS_9RangeSpanE
|
||||||
|
fun:_ZN4llvm10DwarfDebug15endFunctionImplEPKNS_15MachineFunctionE
|
||||||
|
fun:_ZN4llvm16DebugHandlerBase11endFunctionEPKNS_15MachineFunctionE
|
||||||
|
fun:_ZN4llvm10AsmPrinter16EmitFunctionBodyEv
|
||||||
|
fun:_ZN4llvm10AsmPrinter20runOnMachineFunctionERNS_15MachineFunctionE
|
||||||
|
fun:_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE
|
||||||
|
fun:_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE
|
||||||
|
fun:_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE
|
||||||
|
fun:runOnModule
|
||||||
|
fun:_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE
|
||||||
|
fun:_ZN4llvm5MCJIT10emitObjectEPNS_6ModuleE
|
||||||
|
fun:_ZN4llvm5MCJIT21generateCodeForModuleEPNS_6ModuleE
|
||||||
|
fun:_ZN4llvm5MCJIT14finalizeObjectEv
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
<ebpf_clang_probe_visitor_assigns_ext_otr>
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:_ZN4ebpf12ProbeVisitor12VisitVarDeclEPN5clang7VarDeclE
|
||||||
|
fun:_ZN5clang19RecursiveASTVisitorIN4ebpf12ProbeVisitorEE12TraverseDeclEPNS_4DeclE
|
||||||
|
fun:_ZN5clang19RecursiveASTVisitorIN4ebpf12ProbeVisitorEE16dataTraverseNodeEPNS_4StmtEPN4llvm15SmallVectorImplINS6_14PointerIntPairIS5_Lj1EbNS6_21PointerLikeTypeTraitsIS5_EENS6_18PointerIntPairInfoIS5_Lj1ESA_EEEEEE
|
||||||
|
fun:_ZN4ebpf12ProbeVisitor12TraverseStmtEPN5clang4StmtE
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
<ebpf_clang_probe_visitor_visit_var_decl>
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:_ZN4ebpf12ProbeVisitor13assignsExtPtrEPN5clang4ExprEPi
|
||||||
|
fun:_ZN4ebpf12ProbeVisitor12VisitVarDeclEPN5clang7VarDeclE
|
||||||
|
...
|
||||||
|
}
|
Loading…
Reference in New Issue