Unfortunately, ASAN is pretty sensitive to LD_PRELOAD, but stdbuf from
coreutils is based on LD_PRELOAD. So, I have replaced stdbuf with
unbuffer (from expect pkg).
The another problem is "${args[@]}" "$@" which does not work as expected.
Well, this patch sucks. It would be nice to have things in the way
how it has been original expected by Patrick's patch, but ...
Signed-off-by: Karel Zak <kzak@redhat.com>
while true; do
case "$1" in
--unbuffered)
while true; do
case "$1" in
--unbuffered)
+ if type stdbuf >/dev/null 2>&1; then
+ UNBUFFERED=1
+ fi
#
# ASAN mode
#
if [ "$TS_ENABLE_ASAN" == "yes" ]; then
#
# ASAN mode
#
if [ "$TS_ENABLE_ASAN" == "yes" ]; then
- args+=(ASAN_OPTIONS='detect_leaks=1')
- fi
-
- #
- # Disable buffering of stdout
- #
- if [ -n "$UNBUFFERED" ]; then
- if type stdbuf >/dev/null 2>&1; then
- args+=(stdbuf --output=0)
+ if [ -n "$UNBUFFERED" ]; then
+ ASAN_OPTIONS='detect_leaks=1' unbuffer "$@"
+ else
+ ASAN_OPTIONS='detect_leaks=1' "$@"
- if [ -n "$TS_VALGRIND_CMD" ]; then
- args+=(libtool --mode=execute "$TS_VALGRIND_CMD" --tool=memcheck --leak-check=full)
- args+=(--leak-resolution=high --num-callers=20 --log-file="$TS_VGDUMP")
+ elif [ -n "$TS_VALGRIND_CMD" ]; then
+ libtool --mode=execute \
+ $TS_VALGRIND_CMD --tool=memcheck --leak-check=full \
+ --leak-resolution=high --num-callers=20 \
+ --log-file="$TS_VGDUMP" "$@"
+ #
+ # default mode
+ #
+ else
+ if [ -n "$UNBUFFERED" ]; then
+ unbuffer "$@"
+ else
+ "$@"
+ fi
ts_check_test_command "$TESTPROG"
ts_check_test_command "$TS_CMD_SFDISK"
ts_check_test_command "$TS_CMD_WIPEFS"
ts_check_test_command "$TESTPROG"
ts_check_test_command "$TS_CMD_SFDISK"
ts_check_test_command "$TS_CMD_WIPEFS"
TEST_IMAGE_NAME=$(ts_image_init 15)
TEST_IMAGE_NAME=$(ts_image_init 15)
ts_check_test_command "$TS_CMD_MKSWAP"
ts_check_test_command "$TS_CMD_SWAPLABEL"
ts_check_test_command "$TS_HELPER_SYSINFO"
ts_check_test_command "$TS_CMD_MKSWAP"
ts_check_test_command "$TS_CMD_SWAPLABEL"
ts_check_test_command "$TS_HELPER_SYSINFO"
# fallocate does not work on most file systems
function fallocate_or_skip()
# fallocate does not work on most file systems
function fallocate_or_skip()
ts_init "$*"
ts_check_test_command "$TS_CMD_RENAME"
ts_init "$*"
ts_check_test_command "$TS_CMD_RENAME"
+ts_check_prog unbuffer
+
ts_cd "$TS_OUTDIR"
touch rename_exit_codes.{1..2}
ts_cd "$TS_OUTDIR"
touch rename_exit_codes.{1..2}