From 629e58ca5bfc726050c70fef36b2cdf124957479 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Thu, 2 Oct 2014 18:45:54 -0700
Subject: [PATCH] Add 'use' test for using VM interactively

---
 util/vm/build.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/util/vm/build.py b/util/vm/build.py
index f56d71fd..9a695b71 100755
--- a/util/vm/build.py
+++ b/util/vm/build.py
@@ -554,6 +554,20 @@ def walkthroughTest( vm, prompt=Prompt ):
     vm.sendline( 'sudo python ~/mininet/mininet/test/test_walkthrough.py -v' )
 
 
+def useTest( vm, prompt=Prompt ):
+    "Use VM interactively - exit by pressing control-]"
+    old = vm.logfile
+    if old == stdout:
+        # Avoid doubling every output character!
+        log( '* Temporarily disabling logging to stdout' )
+        vm.logfile = None
+    log( '* Switching to interactive use - press control-] to exit' )
+    vm.interact()
+    if old == stdout:
+        log( '* Restoring logging to stdout' )
+        vm.logfile = stdout
+
+
 def checkOutBranch( vm, branch, prompt=Prompt ):
     # This is a bit subtle; it will check out an existing branch (e.g. master)
     # if it exists; otherwise it will create a detached branch.
-- 
GitLab