Merge remote branch 'cros/upstream' into master

Merged to upstream autotest @4749~@5215.

The entire change list description is too big to enlist here. Please refer to upstream (http://autotest.kernel.org/browser) for more details.

BUG=
TEST=emerged both x86 and arm build.
Tested emerged x86 build bvt against a chromeos device.

Review URL: http://codereview.chromium.org/6246035

Change-Id: I8455f2135c87c321c6efc232e2869dc8f675395e
diff --git a/utils/unittest_suite.py b/utils/unittest_suite.py
index 629eba6..78a9602 100755
--- a/utils/unittest_suite.py
+++ b/utils/unittest_suite.py
@@ -16,6 +16,8 @@
 parser.add_option("--skip-tests", dest="skip_tests",  default=[],
                   help="A space separated list of tests to skip")
 
+parser.set_defaults(module_list=None)
+
 
 REQUIRES_DJANGO = set((
         'monitor_db_unittest.py',
@@ -64,6 +66,11 @@
     'logging_manager_test.py',
     ))
 
+# This particular KVM autotest test is not a unittest
+SKIP = set((
+    'guest_test.py',
+    ))
+
 LONG_TESTS = (REQUIRES_DJANGO |
               REQUIRES_MYSQLDB |
               REQUIRES_GWT |
@@ -103,16 +110,10 @@
             raise TestFailure(msg)
 
 
-def find_and_run_tests(start, options):
-    """
-    Find and run Python unittest suites below the given directory.  Only look
-    in subdirectories of start that are actual importable Python modules.
-
-    @param start: The absolute directory to look for tests under.
-    @param options: optparse options.
-    """
+def scan_for_modules(start, options):
     modules = []
-    skip_tests = set()
+
+    skip_tests = SKIP
     if options.skip_tests:
         skip_tests.update(options.skip_tests.split())
 
@@ -142,6 +143,22 @@
                 modules.append(['autotest_lib'] + names)
                 if options.debug:
                     print 'testing', path_no_py
+    return modules
+
+def find_and_run_tests(start, options):
+    """
+    Find and run Python unittest suites below the given directory.  Only look
+    in subdirectories of start that are actual importable Python modules.
+
+    @param start: The absolute directory to look for tests under.
+    @param options: optparse options.
+    """
+    if options.module_list:
+        modules = []
+        for m in options.module_list:
+            modules.append(m.split('.'))
+    else:
+        modules = scan_for_modules(start, options)
 
     if options.debug:
         print 'Number of test modules found:', len(modules)
@@ -170,9 +187,7 @@
 def main():
     options, args = parser.parse_args()
     if args:
-        parser.error('Unexpected argument(s): %s' % args)
-        parser.print_help()
-        sys.exit(1)
+        options.module_list = args
 
     # Strip the arguments off the command line, so that the unit tests do not
     # see them.