diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2011-04-27 09:54:17 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2011-04-27 09:54:17 +0000 |
commit | 0f544f1ea84276cba649b68ed09a5c6a9faf768b (patch) | |
tree | 28dcc635ab59cb413112211a0bcc0ea2af3595c5 /lib | |
parent | 043159ff250093443685ef32d37ab26878686ff9 (diff) | |
download | nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.tar nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.tar.gz nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.tar.bz2 nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.tar.lz nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.tar.xz nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.tar.zst nixlib-0f544f1ea84276cba649b68ed09a5c6a9faf768b.zip |
* Add a command `forwardPort' to forward a TCP port on the host to a
TCP port on the guest. Useful during testing (e.g. to access a web server in the guest through a web browser on the host). svn path=/nixos/trunk/; revision=26987
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test-driver/Machine.pm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/test-driver/Machine.pm b/lib/test-driver/Machine.pm index 919ab7c0764c..68b374c86aa7 100644 --- a/lib/test-driver/Machine.pm +++ b/lib/test-driver/Machine.pm @@ -519,4 +519,14 @@ sub sleep { } +# Forward a TCP port on the host to a TCP port on the guest. Useful +# during interactive testing. +sub forwardPort { + my ($self, $hostPort, $guestPort) = @_; + $hostPort = 8080 unless defined $hostPort; + $guestPort = 80 unless defined $guestPort; + $self->sendMonitorCommand("hostfwd_add tcp::$hostPort-:$guestPort"); +} + + 1; |