NMEA: benchmark for sentence STN added.
[marnav.git] / bin / sanitize-wrap
blobf630e4eb3c6347cddd5a87c11b5cd42085711285
1 #!/bin/bash -eux
3 # when using the address sanitizer, libasan must be linked/loaded first.
4 # to make sure this happens, this script uses LD_PRELOAD to load the
5 # library first, but only if it is necessary. If the executable is not
6 # linked against libasan, it will be executed just as it is.
8 # example:
10 # sanitize-wrap build/test/testrunner --gtest_shuffle
13 # find link to libasan
14 libasan=$(ldd $1 | grep libasan | sed 's/^[[:space:]]//' | cut -d ' ' -f1)
16 # define LD_PRELOAD if necessary
17 if [ -n "${libasan}" ] ; then
18 set +u
19 if [ -n "${LD_PRELOAD}" ] ; then
20 export LD_PRELOAD="${libasan};${LD_PRELOAD}"
21 else
22 export LD_PRELOAD="${libasan}"
24 set -u
27 # execute binary
28 exec $@