Commit ca199201 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

test/nvme/cuse: Simplify read from /dev/urandom



It's been noticed that the current solution may fail (i.e. block
indefinitely) in case one of the processes misses to handle
SIGPIPE properly. In particular, if fold fails to notice that
head already closed its end (and terminated), tr will constantly
feed fold the data which will then try to pass it down the pipe
(but there won't be anything to read that data anymore).

Instead of feeding infinite stream of bytes from /dev/urandom to
piped processes, simply read needed amount of bytes from it and
then use it to compare it byte by byte after the write/read
operation.

Change-Id: Icc915d7689d41af0894ba5fcac3a36d3ba08e42b
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20541


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 973075d4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -96,10 +96,10 @@ done
rm -Rf $testdir/match_files

# Verify read/write path
tr < /dev/urandom -dc "a-zA-Z0-9" | fold -w 512 | head -n 1 > $testdir/write_file
head -c512 /dev/urandom > "$testdir/write_file"
${NVME_CMD} write $ns --data-size=512 --data=$testdir/write_file
${NVME_CMD} read $ns --data-size=512 --data=$testdir/read_file
diff --ignore-trailing-space $testdir/write_file $testdir/read_file
cmp "$testdir/write_file" "$testdir/read_file"
rm -f $testdir/write_file $testdir/read_file

# Verify admin cmd when no data is transferred,