Commit 91148be1 authored by Dominik Charousset's avatar Dominik Charousset

Add UBSan check to build matrix

parent 0221960c
...@@ -28,8 +28,9 @@ elif [ $# = 2 ]; then ...@@ -28,8 +28,9 @@ elif [ $# = 2 ]; then
if [ "$1" = 'test' ] && [ -d "$2" ]; then if [ "$1" = 'test' ] && [ -d "$2" ]; then
Mode='test' Mode='test'
BuildDir="$2" BuildDir="$2"
elif [ "$1" = 'assert' ] && [ "$2" = 'LeakSanitizer' ]; then elif [ "$1" = 'assert' ]; then
Mode='assert' Mode='assert'
What="$2"
else else
usage usage
fi fi
...@@ -85,10 +86,37 @@ runLeakSanitizerCheck() { ...@@ -85,10 +86,37 @@ runLeakSanitizerCheck() {
fi fi
} }
runUBSanitizerCheck() {
UBSanCheckStr="
int main(int argc, char**) {
int k = 0x7fffffff;
k += argc;
return 0;
}
"
echo "${UBSanCheckStr}" > UBSanCheck.cpp
c++ UBSanCheck.cpp -o UBSanCheck -fsanitize=undefined -fno-omit-frame-pointer
out=`./UBSanCheck 2>&1 | grep -o 'signed integer overflow'`
if [ -z "$out" ]; then
echo "unable to detected undefined behavior on this platform!"
return 1
fi
}
if [ "$Mode" = 'build' ]; then if [ "$Mode" = 'build' ]; then
runBuild runBuild
elif [ "$Mode" = 'test' ]; then elif [ "$Mode" = 'test' ]; then
runTest runTest
else else
case "$What" in
LeakSanitizer)
runLeakSanitizerCheck runLeakSanitizerCheck
;;
UBSanitizer)
runUBSanitizerCheck
;;
*)
echo "unrecognized tag: $What!"
return 1
esac
fi fi
...@@ -93,13 +93,18 @@ config = [ ...@@ -93,13 +93,18 @@ config = [
'ASAN_OPTIONS=detect_leaks=1', 'ASAN_OPTIONS=detect_leaks=1',
], ],
]], ]],
// One extra debug build with static libraries. // One extra debug build with static libraries and UBSanitizer.
['debian-10', [ ['fedora-32', [
numCores: 4, numCores: 4,
tags: ['docker'], tags: ['docker', 'UBSanitizer'],
builds: ['debug'], builds: ['debug'],
extraBuildFlags: [ extraBuildFlags: [
'BUILD_SHARED_LIBS:BOOL=OFF', 'BUILD_SHARED_LIBS:BOOL=OFF',
'CAF_SANITIZERS:STRING=address,undefined',
],
extraBuildEnv: [
'CXXFLAGS=-fno-sanitize-recover=undefined',
'LDFLAGS=-fno-sanitize-recover=undefined',
], ],
]], ]],
// Other UNIX systems. // Other UNIX systems.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment