- 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
94d919b999
commit
6b9db41be6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286171
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/env perl
|
||||||
#
|
#
|
||||||
# CDDL HEADER START
|
# CDDL HEADER START
|
||||||
#
|
#
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/perl -w
|
#!/usr/bin/env perl
|
||||||
#
|
#
|
||||||
# CDDL HEADER START
|
# CDDL HEADER START
|
||||||
#
|
#
|
||||||
|
@ -58,12 +58,25 @@ fi
|
|||||||
|
|
||||||
dtrace=$1
|
dtrace=$1
|
||||||
local=127.0.0.1
|
local=127.0.0.1
|
||||||
tcpport=22
|
|
||||||
DIR=/var/tmp/dtest.$$
|
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
|
mkdir $DIR
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
|
# nc will exit when the connection is closed.
|
||||||
|
nc -l $local $tcpport &
|
||||||
|
|
||||||
cat > test.pl <<-EOPERL
|
cat > test.pl <<-EOPERL
|
||||||
use IO::Socket;
|
use IO::Socket;
|
||||||
my \$s = IO::Socket::INET->new(
|
my \$s = IO::Socket::INET->new(
|
||||||
@ -76,7 +89,7 @@ cat > test.pl <<-EOPERL
|
|||||||
sleep(2);
|
sleep(2);
|
||||||
EOPERL
|
EOPERL
|
||||||
|
|
||||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||||
BEGIN
|
BEGIN
|
||||||
{
|
{
|
||||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||||
|
@ -79,7 +79,7 @@ cat > test.pl <<-EOPERL
|
|||||||
sleep(2);
|
sleep(2);
|
||||||
EOPERL
|
EOPERL
|
||||||
|
|
||||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||||
BEGIN
|
BEGIN
|
||||||
{
|
{
|
||||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||||
|
@ -82,7 +82,7 @@ cat > test.pl <<-EOPERL
|
|||||||
sleep(2);
|
sleep(2);
|
||||||
EOPERL
|
EOPERL
|
||||||
|
|
||||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||||
BEGIN
|
BEGIN
|
||||||
{
|
{
|
||||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||||
|
@ -87,7 +87,7 @@ cat > test.pl <<-EOPERL
|
|||||||
sleep(2);
|
sleep(2);
|
||||||
EOPERL
|
EOPERL
|
||||||
|
|
||||||
$dtrace -c '/usr/bin/perl test.pl' -qs /dev/stdin <<EODTRACE
|
$dtrace -c 'perl test.pl' -qs /dev/stdin <<EODTRACE
|
||||||
BEGIN
|
BEGIN
|
||||||
{
|
{
|
||||||
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
ipsend = tcpsend = ipreceive = tcpreceive = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user