Commit 93827ad5 authored by Matthieu Baerts's avatar Matthieu Baerts Committed by Jakub Kicinski

selftests: mptcp: join: create tmp files only if needed

These tmp files will only be created when a test will be launched.

This avoid 'dd' output when '-h' is used for example.

While at it, also avoid creating netns that will be removed when
starting the first test.
Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 0a40e273
...@@ -17,6 +17,7 @@ capture=0 ...@@ -17,6 +17,7 @@ capture=0
checksum=0 checksum=0
ip_mptcp=0 ip_mptcp=0
do_all_tests=1 do_all_tests=1
init=0
TEST_COUNT=0 TEST_COUNT=0
...@@ -38,7 +39,7 @@ CBPF_MPTCP_SUBOPTION_ADD_ADDR="14, ...@@ -38,7 +39,7 @@ CBPF_MPTCP_SUBOPTION_ADD_ADDR="14,
6 0 0 65535, 6 0 0 65535,
6 0 0 0" 6 0 0 0"
init() init_partial()
{ {
capout=$(mktemp) capout=$(mktemp)
...@@ -98,6 +99,21 @@ cleanup_partial() ...@@ -98,6 +99,21 @@ cleanup_partial()
done done
} }
init() {
init=1
sin=$(mktemp)
sout=$(mktemp)
cin=$(mktemp)
cinsent=$(mktemp)
cout=$(mktemp)
trap cleanup EXIT
make_file "$cin" "client" 1
make_file "$sin" "server" 1
}
cleanup() cleanup()
{ {
rm -f "$cin" "$cout" "$sinfail" rm -f "$cin" "$cout" "$sinfail"
...@@ -107,8 +123,13 @@ cleanup() ...@@ -107,8 +123,13 @@ cleanup()
reset() reset()
{ {
cleanup_partial if [ "${init}" != "1" ]; then
init init
else
cleanup_partial
fi
init_partial
} }
reset_with_cookies() reset_with_cookies()
...@@ -2106,16 +2127,6 @@ usage() ...@@ -2106,16 +2127,6 @@ usage()
exit ${ret} exit ${ret}
} }
sin=$(mktemp)
sout=$(mktemp)
cin=$(mktemp)
cinsent=$(mktemp)
cout=$(mktemp)
init
make_file "$cin" "client" 1
make_file "$sin" "server" 1
trap cleanup EXIT
for arg in "$@"; do for arg in "$@"; do
# check for "capture/checksum" args before launching tests # check for "capture/checksum" args before launching tests
if [[ "${arg}" =~ ^"-"[0-9a-zA-Z]*"c"[0-9a-zA-Z]*$ ]]; then if [[ "${arg}" =~ ^"-"[0-9a-zA-Z]*"c"[0-9a-zA-Z]*$ ]]; then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment