mirror of
https://github.com/intel/isa-l.git
synced 2025-10-26 18:42:39 +01:00
test: Add undefined behaviour sanitizer to test_checks
Change-Id: Id953cca99c6a6c64875185452e2ca6630cf47541 Signed-off-by: Roy Oursler <roy.j.oursler@intel.com>
This commit is contained in:
@@ -43,6 +43,23 @@ if uname | grep -q 'Darwin' 2>&1; then
|
||||
fi
|
||||
|
||||
# Build and run check tests
|
||||
if [ -z "$CFLAGS" ]; then
|
||||
CFLAGS='-g -O2 -fsanitize=undefined -fno-sanitize=nonnull-attribute -fsanitize-undefined-trap-on-error'
|
||||
|
||||
if [ $CC ]; then
|
||||
echo int main\(\)\{\}\; | $CC $CFLAGS -xc -o /dev/null - >& /dev/null && sanitize=1
|
||||
elif ( command -V gcc > /dev/null ); then
|
||||
echo int main\(\)\{\}\; | gcc $CFLAGS -xc -o /dev/null - >& /dev/null && sanitize=1
|
||||
elif ( command -V clang > /dev/null ); then
|
||||
echo int main\(\)\{\}\; | clang $CFLAGS -xc -o /dev/null - >& /dev/null && sanitize=1
|
||||
fi
|
||||
|
||||
if [ $sanitize ]; then
|
||||
echo "Sanitizing undefined behaviour"
|
||||
export CFLAGS=$CFLAGS
|
||||
fi
|
||||
fi
|
||||
|
||||
time ./autogen.sh
|
||||
time ./configure --prefix=$tmp_install_dir $opt_config_target
|
||||
time $MAKE -j $cpus
|
||||
|
||||
Reference in New Issue
Block a user