- 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:
Mark Johnston 2015-08-02 00:23:18 +00:00
parent 94d919b999
commit 6b9db41be6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=286171
6 changed files with 20 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!/usr/bin/env perl
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/perl -w
#!/usr/bin/env perl
#
# CDDL HEADER START
#

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;