Skip to content

Commit e810886

Browse files
keesshuahkh
authored andcommitted
selftests: Remove forced unbuffering for test running
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 <[email protected]> Fixes: 5c069b6 ("selftests: Move test output to diagnostic lines") Signed-off-by: Kees Cook <[email protected]> Tested-by: Takashi Iwai <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent a20d452 commit e810886

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

tools/testing/selftests/kselftest/runner.sh

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ tap_prefix()
2424
fi
2525
}
2626

27-
# If stdbuf is unavailable, we must fall back to line-at-a-time piping.
28-
tap_unbuffer()
29-
{
30-
if ! which stdbuf >/dev/null ; then
31-
"$@"
32-
else
33-
stdbuf -i0 -o0 -e0 "$@"
34-
fi
35-
}
36-
3727
run_one()
3828
{
3929
DIR="$1"
@@ -54,7 +44,7 @@ run_one()
5444
echo "not ok $test_num $TEST_HDR_MSG"
5545
else
5646
cd `dirname $TEST` > /dev/null
57-
(((((tap_unbuffer ./$BASENAME_TEST 2>&1; echo $? >&3) |
47+
(((((./$BASENAME_TEST 2>&1; echo $? >&3) |
5848
tap_prefix >&4) 3>&1) |
5949
(read xs; exit $xs)) 4>>"$logfile" &&
6050
echo "ok $test_num $TEST_HDR_MSG") ||

0 commit comments

Comments
 (0)