Change the debug variable in the unittest_suite to a debug flag.

Risk: Low
Visibility: Medium

Signed-off-by: Jeremy Orlow <jorlow@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@2107 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/utils/unittest_suite.py b/utils/unittest_suite.py
index e020545..d28cbf3 100644
--- a/utils/unittest_suite.py
+++ b/utils/unittest_suite.py
@@ -5,7 +5,6 @@
 from autotest_lib.utils import parallel
 
 
-debug = False
 root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
 
 parser = optparse.OptionParser()
@@ -14,6 +13,8 @@
                   help="root directory to start running unittests")
 parser.add_option("--full", action="store_true", dest="full", default=False,
                   help="whether to run the shortened version of the test")
+parser.add_option("--debug", action="store_true", dest="debug", default=False,
+                  help="run in debug mode")
 
 
 LONG_TESTS = set((
@@ -58,7 +59,7 @@
 
 
 def run_test(mod_name):
-    if not debug:
+    if not options.debug:
         parallel.redirect_io()
 
     print "Running %s" % '.'.join(mod_name)
@@ -94,7 +95,7 @@
 
     try:
         dargs = {}
-        if debug:
+        if options.debug:
             dargs['max_simultaneous_procs'] = 1
         pe = parallel.ParallelExecute(functions, **dargs)
         pe.run_until_completion()
@@ -104,6 +105,7 @@
 
 
 def main():
+    global options, args
     options, args = parser.parse_args()
     if args:
         parser.error('Unexpected argument(s): %s' % args)