Skip to content

Commit d328fe8

Browse files
matttbePaolo Abeni
authored andcommitted
selftests: mptcp: join: avoid using 'cmp --bytes'
BusyBox's 'cmp' command doesn't support the '--bytes' parameter. Some CIs -- i.e. LKFT -- use BusyBox and have the mptcp_join.sh test failing [1] because their 'cmp' command doesn't support this '--bytes' option: cmp: unrecognized option '--bytes=1024' BusyBox v1.35.0 () multi-call binary. Usage: cmp [-ls] [-n NUM] FILE1 [FILE2] Instead, 'head --bytes' can be used as this option is supported by BusyBox. A temporary file is needed for this operation. Because it is apparently quite common to use BusyBox, it is certainly better to backport this fix to impacted kernels. Fixes: 6bf4102 ("selftests: mptcp: update and extend fastclose test-cases") Cc: stable@vger.kernel.org Link: https://qa-reports.linaro.org/lkft/linux-mainline-master/build/v6.3-rc5-5-g148341f0a2f5/testrun/16088933/suite/kselftest-net-mptcp/test/net_mptcp_userspace_pm_sh/log [1] Suggested-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Mat Martineau <martineau@kernel.org> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 1919b39 commit d328fe8

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ sout=""
1717
cin=""
1818
cinfail=""
1919
cinsent=""
20+
tmpfile=""
2021
cout=""
2122
capout=""
2223
ns1=""
@@ -175,6 +176,7 @@ cleanup()
175176
{
176177
rm -f "$cin" "$cout" "$sinfail"
177178
rm -f "$sin" "$sout" "$cinsent" "$cinfail"
179+
rm -f "$tmpfile"
178180
rm -rf $evts_ns1 $evts_ns2
179181
cleanup_partial
180182
}
@@ -383,9 +385,16 @@ check_transfer()
383385
fail_test
384386
return 1
385387
fi
386-
bytes="--bytes=${bytes}"
388+
389+
# note: BusyBox's "cmp" command doesn't support --bytes
390+
tmpfile=$(mktemp)
391+
head --bytes="$bytes" "$in" > "$tmpfile"
392+
mv "$tmpfile" "$in"
393+
head --bytes="$bytes" "$out" > "$tmpfile"
394+
mv "$tmpfile" "$out"
395+
tmpfile=""
387396
fi
388-
cmp -l "$in" "$out" ${bytes} | while read -r i a b; do
397+
cmp -l "$in" "$out" | while read -r i a b; do
389398
local sum=$((0${a} + 0${b}))
390399
if [ $check_invert -eq 0 ] || [ $sum -ne $((0xff)) ]; then
391400
echo "[ FAIL ] $what does not match (in, out):"

0 commit comments

Comments
 (0)