]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tests: Don't use nc -d or -w options
authorMartin Schwenke <martin@meltin.net>
Thu, 8 Mar 2018 00:49:56 +0000 (11:49 +1100)
committerMartin Schwenke <martins@samba.org>
Fri, 9 Mar 2018 11:24:13 +0000 (12:24 +0100)
nmap-ncat is used in some distributions to replace netcat.  It has a
different meaning for these options.

We can get the same effect as the current combination of -d and -w by
piping a sleep process to nc.  Subsequent use of $! works because it
gets the last process in pipeline.

Note that redirecting from /dev/null doesn't work with some versions
of nc.  They just exit when they get EOF.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Fri Mar  9 12:24:13 CET 2018 on sn-devel-144

ctdb/tests/complex/30_nfs_tickle_killtcp.sh
ctdb/tests/complex/31_nfs_tickle.sh
ctdb/tests/complex/32_cifs_tickle.sh
ctdb/tests/complex/34_nfs_tickle_restart.sh
ctdb/tests/complex/36_smb_reset_server.sh
ctdb/tests/complex/37_nfs_reset_server.sh

index d1e7d7146469b0a1c6388c49e8b670ef2e1a42bb..40ec6babf2ed9d6a15a78b733564617ac69f7964 100755 (executable)
@@ -46,7 +46,7 @@ test_port=2049
 
 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
 
-nc -d -w 30 $test_ip $test_port &
+sleep 30 | nc $test_ip $test_port &
 nc_pid=$!
 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
 
index c82d31dda1b569e437532382196efca8654fd3f8..0b6990f8df9adf3c075a10bf4a8aefecd9801ebd 100755 (executable)
@@ -54,7 +54,7 @@ test_port=2049
 
 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
 
-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
 nc_pid=$!
 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
 
index da369b9f5f72704501fdb92e4c1d22c2d07a6234..366824501da5cb1fb5ad45877fa5eefd4c2eed3a 100755 (executable)
@@ -52,7 +52,7 @@ test_port=445
 
 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
 
-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
 nc_pid=$!
 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
 
index 6350db68c2eedbc5859e42c6a229e4e2f1966fda..2aab0614ff9b0605507b4dd8357c056de33ad85d 100755 (executable)
@@ -53,7 +53,7 @@ test_port=2049
 
 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with netcat..."
 
-nc -d -w 600 $test_ip $test_port &
+sleep 600 | nc $test_ip $test_port &
 nc_pid=$!
 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
 
index 5723ac7e0252657d6698c1f4139a165c8ae74774..beff1a220144283dc51946ae261b976f51827212 100755 (executable)
@@ -52,7 +52,7 @@ sleep_for 5
 
 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."
 
-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
 nc_pid=$!
 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"
 
index d6dd0f03b1ff7e14536a29159e302fd63eac512a..07bd034d6c7a75be868a6bc5a129f9eb33864d08 100755 (executable)
@@ -52,7 +52,7 @@ sleep_for 5
 
 echo "Connecting to node ${test_node} on IP ${test_ip}:${test_port} with nc..."
 
-nc -d -w $(($monitor_interval * 4)) $test_ip $test_port &
+sleep $((monitor_interval * 4)) | nc $test_ip $test_port &
 nc_pid=$!
 ctdb_test_exit_hook_add "kill $nc_pid >/dev/null 2>&1"