On Wed, Aug 28, 2019 at 12:51:07PM +0200, Karel Zak wrote: > On Tue, Aug 27, 2019 at 02:26:08PM +0200, Patrick Steinhardt wrote: > > 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. > > Applied, thanks. > > Unfortunately, it seems result is fragile. It fails on travis > https://travis-ci.org/karelzak/util-linux/jobs/577767328 > > The problem is the order of some output lines, for example: > tests/output/rename/exit_codes > > Maybe the best and most robust solution would be split stdout and > stderr into two files for each test. Now we have $TS_OUTPUT, what about > to replace it with $TS_STDOUT and $TS_STDERR? Something like: > > - $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT >> $TS_OUTPUT 2>&1 > + $TS_CMD_MOUNT $DEVICE $TS_MOUNTPOINT >> $TS_STDOUT 2>> $TS_STDERR > > And also create tests/expected//{.err} for tests where any > output on stderr is expected, otherwise assume $TS_STDERR is empty. > > This change will be pretty invasive, but than we can easily compare > outputs and keep track about what is where printed. > > Karel Sorry, I somehow didn't see this mail. I thought about splitting it up too, but shied away as I expected it to be rather involved. Anyway, I think in the long run it's definitely the best way to tackle the issue at hand, so thanks for your effort! I've just done a test run on musl libc, and everything except for the known issue with POSIXLY_CORRECT getopt passes. Patrick