summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2020-08-03 16:56:51 +0200
committerSébastien Hinderer <Sebastien.Hinderer@inria.fr>2020-08-06 14:31:09 +0200
commit7c0623b33e39af5f6ed7300b480ec19ef3364b40 (patch)
tree89805683570d8f4978133efd9a19e80806a2d44b /tools
parentf3ff1337a1b0ce01411c475cf3ecf0c2c9a9103f (diff)
downloadocaml-7c0623b33e39af5f6ed7300b480ec19ef3364b40.tar.gz
Simplify the tools/ci/inria/extra-checks script
Use the ability to pass flags to the C compiler at configure time to simplify this CI script. Looking at the diff, it may seem that some flags like -fwrapv, -fno-strict-aliasing, -Wall and -Werror got lost by this commit. It is actually not the case. In its previous version, this script was overriding the flags as defined by the compiler's build system, so it had to provide a rather exhaustive list of flags. Now one only needs to add the flags specific to the build one wishes to do. The flags mentionned above* are provided by the compiler's build system so they do not need to be mentionned here any longer.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ci/inria/extra-checks50
1 files changed, 16 insertions, 34 deletions
diff --git a/tools/ci/inria/extra-checks b/tools/ci/inria/extra-checks
index 1a9663839f..fc929d46d6 100755
--- a/tools/ci/inria/extra-checks
+++ b/tools/ci/inria/extra-checks
@@ -48,16 +48,6 @@ arch_error() {
error "$msg"
}
-# Change a variable in Makefile.config
-# Usage: set_config_var <variable name> <new value>
-
-
-set_config_var() {
- conffile=Makefile.config
- mv ${conffile} ${conffile}.bak
- (grep -v "^$1=" ${conffile}.bak; echo "$1=$2") > ${conffile}
-}
-
#########################################################################
# Print each command before its execution
@@ -151,10 +141,6 @@ echo "======== clang 9, address sanitizer, UB sanitizer =========="
git clean -q -f -d -x
# Use clang 9
-# We cannot give the sanitizer options as part of -cc because
-# then various autoconfiguration tests fail.
-# Instead, we'll fix OC_CFLAGS a posteriori.
-./configure CC=clang-9 --disable-stdlib-manpages --enable-dependency-generation
# These are the undefined behaviors we want to check
# Others occur on purpose e.g. signed arithmetic overflow
@@ -172,12 +158,14 @@ shift-exponent,\
unreachable"
# Select address sanitizer and UB sanitizer, with trap-on-error behavior
+sanitizers="-fsanitize=address -fsanitize-trap=$ubsan"
+
# Don't optimize too much to get better backtraces of errors
-set_config_var OC_CFLAGS "-O1 \
--fno-strict-aliasing -fwrapv -fno-omit-frame-pointer \
--Wall -Werror \
--fsanitize=address \
--fsanitize-trap=$ubsan"
+
+./configure \
+ CC=clang-9 \
+ CFLAGS="-O1 -fno-omit-frame-pointer $sanitizers" \
+ --disable-stdlib-manpages --enable-dependency-generation
# Build the system. We want to check for memory leaks, hence
# 1- force ocamlrun to free memory before exiting
@@ -205,14 +193,13 @@ echo "======== clang 9, thread sanitizer =========="
git clean -q -f -d -x
-./configure CC=clang-9 --disable-stdlib-manpages --enable-dependency-generation
-
# Select thread sanitizer
# Don't optimize too much to get better backtraces of errors
-set_config_var OC_CFLAGS "-O1 \
--fno-strict-aliasing -fwrapv -fno-omit-frame-pointer \
--Wall -Werror \
--fsanitize=thread"
+
+./configure \
+ CC=clang-9 \
+ CFLAGS="-O1 -fno-omit-frame-pointer -fsanitize=thread" \
+ --disable-stdlib-manpages --enable-dependency-generation
# Build the system
make $jobs
@@ -234,20 +221,15 @@ TSAN_OPTIONS="die_after_fork=0" $run_testsuite
# git clean -q -f -d -x
# # Use clang 6.0
-# # We cannot give the sanitizer options as part of -cc because
-# # then various autoconfiguration tests fail.
-# # Instead, we'll fix OC_CFLAGS a posteriori.
# # Memory sanitizer doesn't like the static data generated by ocamlopt,
# # hence build bytecode only
-# ./configure CC=clang-9 --disable-native-compiler
-
# # Select memory sanitizer
# # Don't optimize at all to get better backtraces of errors
-# set_config_var OC_CFLAGS "-O0 -g \
-# -fno-strict-aliasing -fwrapv -fno-omit-frame-pointer \
-# -Wall -Werror \
-# -fsanitize=memory"
+# ./configure \
+# CC=clang-9 \
+# CFLAGS="-O0 -g -fno-omit-frame-pointer -fsanitize=memory" \
+# --disable-native-compiler
# # A tool that makes error backtraces nicer
# # Need to pick the one that matches clang-6.0
# export MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer