ci: code cleanup
This commit is contained in:
parent
81edf9f0da
commit
b17a386004
|
@ -18,75 +18,72 @@ fi
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
export CC="$CC"
|
|
||||||
export CXX="$CXX"
|
|
||||||
|
|
||||||
for phase in "${PHASES[@]}"; do
|
for phase in "${PHASES[@]}"; do
|
||||||
case $phase in
|
case $phase in
|
||||||
CONFIGURE)
|
CONFIGURE)
|
||||||
opts="--disable-use-tty-group \
|
opts=(
|
||||||
--disable-makeinstall-chown \
|
--disable-use-tty-group
|
||||||
--enable-all-programs \
|
--disable-makeinstall-chown
|
||||||
--enable-asan \
|
--enable-all-programs
|
||||||
--enable-ubsan \
|
--enable-asan
|
||||||
--without-python \
|
--enable-ubsan
|
||||||
--enable-werror"
|
--without-python
|
||||||
|
--enable-werror
|
||||||
|
)
|
||||||
|
|
||||||
if [[ "$COMPILER" == clang* ]]; then
|
if [[ "$COMPILER" == clang* ]]; then
|
||||||
opts="$opts --enable-fuzzing-engine"
|
opts+=(--enable-fuzzing-engine)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo -E git clean -xdf
|
sudo -E git clean -xdf
|
||||||
|
|
||||||
./autogen.sh
|
./autogen.sh
|
||||||
CC=$CC CXX=$CXX CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ./configure $opts
|
CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" ./configure "${opts[@]}"
|
||||||
;;
|
;;
|
||||||
MAKE)
|
MAKE)
|
||||||
make -j
|
make -j
|
||||||
make -j check-programs
|
make -j check-programs
|
||||||
;;
|
;;
|
||||||
INSTALL)
|
INSTALL)
|
||||||
make install DESTDIR=/tmp/dest
|
make install DESTDIR=/tmp/dest
|
||||||
;;
|
;;
|
||||||
CHECK)
|
CHECK)
|
||||||
# All the following black magic is to make test/eject/umount work, since
|
# All the following black magic is to make test/eject/umount work, since
|
||||||
# eject execl()s the uninstrumented /bin/umount binary, which confuses
|
# eject execl()s the uninstrumented /bin/umount binary, which confuses
|
||||||
# ASan. The workaround for this is to set $LD_PRELOAD to the ASan's
|
# ASan. The workaround for this is to set $LD_PRELOAD to the ASan's
|
||||||
# runtime DSO, which works well with gcc without any additional hassle.
|
# runtime DSO, which works well with gcc without any additional hassle.
|
||||||
# However, since clang, by default, links ASan statically, we need to
|
# However, since clang, by default, links ASan statically, we need to
|
||||||
# explicitly state we want dynamic linking (see -shared-libasan above).
|
# explicitly state we want dynamic linking (see -shared-libasan above).
|
||||||
# That, however, introduces another issue - clang's ASan runtime is in
|
# That, however, introduces another issue - clang's ASan runtime is in
|
||||||
# a non-standard path, so all binaries compiled in such way refuse
|
# a non-standard path, so all binaries compiled in such way refuse
|
||||||
# to start. That's what the following blob of code is for - it detects
|
# to start. That's what the following blob of code is for - it detects
|
||||||
# the ASan's runtime path and adds the respective directory to
|
# the ASan's runtime path and adds the respective directory to
|
||||||
# the dynamic linker cache.
|
# the dynamic linker cache.
|
||||||
#
|
#
|
||||||
# The actual $LD_PRELOAD sheanigans are done directly in
|
# The actual $LD_PRELOAD sheanigans are done directly in
|
||||||
# tests/ts/eject/umount.
|
# tests/ts/eject/umount.
|
||||||
asan_rt_name="$(ldd ./kill | awk '/lib.+asan.*.so/ {print $1; exit}')"
|
asan_rt_name="$(ldd ./kill | awk '/lib.+asan.*.so/ {print $1; exit}')"
|
||||||
asan_rt_path="$($CC --print-file-name "$asan_rt_name")"
|
asan_rt_path="$($CC --print-file-name "$asan_rt_name")"
|
||||||
echo "Detected ASan runtime: $asan_rt_name ($asan_rt_path)"
|
echo "Detected ASan runtime: $asan_rt_name ($asan_rt_path)"
|
||||||
if [[ -z "$asan_rt_name" || -z "$asan_rt_path" ]]; then
|
if [[ -z "$asan_rt_name" || -z "$asan_rt_path" ]]; then
|
||||||
echo >&2 "Couldn't detect ASan runtime, can't continue"
|
echo >&2 "Couldn't detect ASan runtime, can't continue"
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$COMPILER" == clang* ]]; then
|
|
||||||
mkdir -p /etc/ld.so.conf.d/
|
|
||||||
echo "${asan_rt_path%/*}" > /etc/ld.so.conf.d/99-clang-libasan.conf
|
|
||||||
ldconfig
|
|
||||||
fi
|
|
||||||
|
|
||||||
./tests/run.sh --show-diff
|
|
||||||
;;
|
|
||||||
DISTCHECK)
|
|
||||||
make distcheck
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
echo >&2 "Unknown phase '$phase'"
|
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$COMPILER" == clang* ]]; then
|
||||||
|
mkdir -p /etc/ld.so.conf.d/
|
||||||
|
echo "${asan_rt_path%/*}" > /etc/ld.so.conf.d/99-clang-libasan.conf
|
||||||
|
ldconfig
|
||||||
|
fi
|
||||||
|
|
||||||
|
./tests/run.sh --show-diff
|
||||||
|
;;
|
||||||
|
DISTCHECK)
|
||||||
|
make distcheck
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo >&2 "Unknown phase '$phase'"
|
||||||
|
exit 1
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue