Author: eelco
Date: Wed Apr 27 09:54:17 2011
New Revision: 26987
URL: https://svn.nixos.org/websvn/nix/?rev=26987&sc=1

Log:
* 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).

Modified:
   nixos/trunk/lib/test-driver/Machine.pm

Modified: nixos/trunk/lib/test-driver/Machine.pm
==============================================================================
--- nixos/trunk/lib/test-driver/Machine.pm      Wed Apr 27 09:51:11 2011        
(r26986)
+++ nixos/trunk/lib/test-driver/Machine.pm      Wed Apr 27 09:54:17 2011        
(r26987)
@@ -519,4 +519,14 @@
 }
 
 
+# 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;
_______________________________________________
nix-commits mailing list
nix-comm...@cs.uu.nl
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to