Skip to content

Commit

Permalink
selftests: Remove forced unbuffering for test running
Browse files Browse the repository at this point in the history
As it turns out, the "stdbuf" command will actually force all
subprocesses into unbuffered output, and some implementations of "echo"
turn into single-character writes, which utterly wrecks writes to /sys
and /proc files.

Instead, drop the "stdbuf" usage, and for any tests that want explicit
flushing between newlines, they'll have to add "fflush(stdout);" as
needed.

Reported-by: Takashi Iwai <tiwai@suse.de>
Fixes: 5c069b6 ("selftests: Move test output to diagnostic lines")
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
  • Loading branch information
Kees Cook authored and Shuah Khan committed May 21, 2019
1 parent a20d452 commit e810886
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tools/testing/selftests/kselftest/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@ tap_prefix()
fi
}

# If stdbuf is unavailable, we must fall back to line-at-a-time piping.
tap_unbuffer()
{
if ! which stdbuf >/dev/null ; then
"$@"
else
stdbuf -i0 -o0 -e0 "$@"
fi
}

run_one()
{
DIR="$1"
Expand All @@ -54,7 +44,7 @@ run_one()
echo "not ok $test_num $TEST_HDR_MSG"
else
cd `dirname $TEST` > /dev/null
(((((tap_unbuffer ./$BASENAME_TEST 2>&1; echo $? >&3) |
(((((./$BASENAME_TEST 2>&1; echo $? >&3) |
tap_prefix >&4) 3>&1) |
(read xs; exit $xs)) 4>>"$logfile" &&
echo "ok $test_num $TEST_HDR_MSG") ||
Expand Down

0 comments on commit e810886

Please sign in to comment.