diff options
author | markj <markj@FreeBSD.org> | 2015-08-02 00:23:18 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2015-08-02 00:23:18 +0000 |
commit | 0de52e9e95c185a617fba3793d130a6494cbe270 (patch) | |
tree | 3e75e108f2956495cfedac0dfee14eeac80012f5 /cddl/contrib/opensolaris/cmd/dtrace/test/tst | |
parent | 8381f029a6cefb0e98c470634d215f3d8dd469d4 (diff) | |
download | FreeBSD-src-0de52e9e95c185a617fba3793d130a6494cbe270.zip FreeBSD-src-0de52e9e95c185a617fba3793d130a6494cbe270.tar.gz |
- 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
Diffstat (limited to 'cddl/contrib/opensolaris/cmd/dtrace/test/tst')
6 files changed, 20 insertions, 7 deletions
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl index ccc247d..5f58eb8 100755 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv4remote.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # # CDDL HEADER START # diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl index 35bea8e..fbfcdfd 100755 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/get.ipv6remote.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/env perl # # CDDL HEADER START # diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh index 2e3ffec..1d2a992 100755 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4localtcp.ksh @@ -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; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh index 65ede66..4c91f00 100755 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.ipv4remotetcp.ksh @@ -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; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh index 9668ad5..d7a3780 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.localtcpstate.ksh @@ -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; diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh index 6771280..271cc78 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh +++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/ip/tst.remotetcpstate.ksh @@ -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; |