tests: use env and support both unbuffer/stdbuf
Triggered by commit
f612c4c67 (tests: fix --unbuffered mode with
ASAN, 2019-08-27), which says:
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 ...
So this commit here effectively reverts it and instead tries to
improve the shortcomings of the original patch. First, it uses
env(1) to set ASAN_OPTIONS instead of directly adding it to the
args array to fix execution of "${args[@]}" "$@".
Second, it now supports both unbuffer(1) and stdbuf(1). The
latter uses LD_PRELOAD tricks, which doesn't play nicely with
ASAN, so it will not be used if ASAN has been requested. It's
still valuable to have support for both, as many more systems
will have stdbuf(1) from coreutils installed but not unbuffer(1)
from expect.
Signed-off-by: Karel Zak <kzak@redhat.com>