- Remove hardcoded paths for the perl executable.
- Rather than assuming that a process is listening on 127.0.0.1:22, use nc(1) to find an available port and bind to it for the duration of the test. MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
8381f029a6
commit
0de52e9e95
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/perl -w
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/perl -w
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# CDDL HEADER START
|
||||
#
|
||||
|
@ -58,12 +58,25 @@ fi
|
||||
|
||||
dtrace=$1
|
||||
local=127.0.0.1
|
||||
tcpport=22
|
||||
DIR=/var/tmp/dtest.$$
|
||||
|
||||
tcpport=1024
|
||||
bound=5000
|
||||
while [ $tcpport -lt $bound ]; do
|
||||
nc -z $local $tcpport >/dev/null || break
|
||||
tcpport=$(($tcpport + 1))
|
||||
done
|
||||
if [ $tcpport -eq $bound ]; then
|
||||
echo "couldn't find an available TCP port"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir $DIR
|
||||
cd $DIR
|
||||
|
||||
# nc will exit when the connection is closed.
|
||||
nc -l $local $tcpport &
|
||||
|
||||
cat > test.pl <<-EOPERL
|
||||
use IO::Socket;
|
||||
my \$s = IO::Socket::INET->new(
|
||||
@ -76,7 +89,7 @@ cat > test.pl <<-EOPERL
|
||||
sleep(2);
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
|
@ -79,7 +79,7 @@ cat > test.pl <<-EOPERL
|
||||
sleep(2);
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
|
@ -82,7 +82,7 @@ cat > test.pl <<-EOPERL
|
||||
sleep(2);
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
|
@ -87,7 +87,7 @@ cat > test.pl <<-EOPERL
|
||||
sleep(2);
|
||||
EOPERL
|
||||
|
||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||
BEGIN
|
||||
{
|
||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user