2018-12-09 14:34:45 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Do some checking before 'git push'.
|
|
|
|
|
|
|
|
# Set a stricter bash mode
|
|
|
|
set -e
|
|
|
|
set -u
|
|
|
|
|
|
|
|
# We define _GNU_SOURCE to avoid warnings with missing prototypes.
|
|
|
|
# C89 does not know snprintf, strdup, strndup, popen, pclose
|
|
|
|
export CFLAGS="-std=gnu89 -pedantic -g -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable-code -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition"
|
|
|
|
|
2018-12-09 18:30:41 +01:00
|
|
|
ASAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer -fsanitize-address-use-after-scope"
|
|
|
|
|
2018-12-09 14:34:45 +01:00
|
|
|
# measure time consumed and print it at the end of the script
|
|
|
|
START=$(date +%s.%N)
|
|
|
|
|
|
|
|
for CC in clang gcc; do
|
|
|
|
export CC
|
|
|
|
echo
|
|
|
|
echo "*** Testing with CC=$CC"
|
|
|
|
|
|
|
|
for options in \
|
|
|
|
"-Dbuiltin=libicu -Druntime=libicu" \
|
|
|
|
"-Dbuiltin=libidn2 -Druntime=libidn2" \
|
|
|
|
"-Dbuiltin=libidn -Druntime=libidn" \
|
|
|
|
"-Dbuiltin=no -Druntime=no"; do
|
|
|
|
|
|
|
|
# normal build+check+valgrind-check
|
|
|
|
echo
|
|
|
|
echo " *** $options"
|
|
|
|
rm -rf builddir
|
|
|
|
meson builddir $options
|
|
|
|
cd builddir
|
|
|
|
ninja
|
|
|
|
for xLCALL in C tr_TR.utf8; do
|
|
|
|
LC_ALL=$xLCALL meson test
|
|
|
|
LC_ALL=$xLCALL meson test --wrap='valgrind --tool=memcheck'
|
|
|
|
done
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# UBSAN build+check
|
2018-12-09 18:30:41 +01:00
|
|
|
flags="-Db_sanitize=undefined -Db_lundef=false"
|
2018-12-09 14:34:45 +01:00
|
|
|
echo
|
|
|
|
echo " *** $options $flags"
|
|
|
|
rm -rf builddir
|
|
|
|
LDFLAGS="-lubsan" meson builddir $options $flags
|
|
|
|
LDFLAGS="-lubsan" ninja -C builddir
|
|
|
|
for xLCALL in C tr_TR.utf8; do
|
|
|
|
LC_ALL=$xLCALL ninja test -C builddir
|
|
|
|
done
|
|
|
|
|
|
|
|
# ASAN build+check
|
2018-12-09 18:30:41 +01:00
|
|
|
flags="-Db_sanitize=address -Db_lundef=false"
|
|
|
|
echo
|
|
|
|
echo " *** $options $flags"
|
|
|
|
rm -rf builddir
|
|
|
|
CFLAGS="$CFLAGS $ASAN_FLAGS" meson builddir $options $flags
|
|
|
|
CFLAGS="$CFLAGS $ASAN_FLAGS" ninja -C builddir
|
|
|
|
for xLCALL in C tr_TR.utf8; do
|
|
|
|
LC_ALL=$xLCALL CFLAGS="$CFLAGS $ASAN_FLAGS" ninja test -C builddir
|
|
|
|
done
|
2018-12-09 14:34:45 +01:00
|
|
|
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
END=$(date +%s.%N)
|
|
|
|
echo
|
|
|
|
echo "Duration: "$(echo "$END - $START" | bc)
|