Meson: Add contrib/check-hard-meson

This commit is contained in:
Tim Rühsen 2018-12-09 14:34:45 +01:00
parent 04da21e2e9
commit c8c9c5a391
1 changed files with 67 additions and 0 deletions

67
contrib/check-hard-meson Executable file
View File

@ -0,0 +1,67 @@
#!/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"
# 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
flags="-Db_sanitize=undefined"
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
# flags="-Db_sanitize=address -Db_lundef=false"
# echo
# echo " *** $options $flags"
# rm -rf builddir
# LDFLAGS="-lasan" meson builddir $options $flags
# LDFLAGS="-lasan" ninja -C builddir
# for xLCALL in C tr_TR.utf8; do
# LC_ALL=$xLCALL ninja test -C builddir
# done
done
done
END=$(date +%s.%N)
echo
echo "Duration: "$(echo "$END - $START" | bc)