[autotest] test_droid V1.

This CL introduces test_droid, a script to launch autotest
tests against local Android DUTs connected to the host
computer via USB.

Much of the logic is similar to test_that, so this has all
been pulled into a new script test_utils.py

Pending work:

* Moving of generate_test_report to somewhere it is accesible
  outside of the chroot.
* Add in support for remote adb hosts (i.e. the DUT is
  connected to a remote computer).
* Sequences support.

BUG=b:25748759
TEST=./test_droid.py 7d52318 brillo_WhitelistedGtests
CQ-DEPEND=CL:315230

Change-Id: Idab3805f7921173fbc706354b322f37244240fa2
Reviewed-on: https://chromium-review.googlesource.com/314870
Commit-Ready: Simran Basi <[email protected]>
Tested-by: Simran Basi <[email protected]>
Reviewed-by: Aviv Keshet <[email protected]>
diff --git a/server/autoserv_utils.py b/server/autoserv_utils.py
index 3a11cca..679418c 100644
--- a/server/autoserv_utils.py
+++ b/server/autoserv_utils.py
@@ -29,7 +29,8 @@
                              no_console_prefix=False,
                              ssh_options=None,
                              use_packaging=True,
-                             in_lab=False):
+                             in_lab=False,
+                             host_attributes=None):
     """
     Construct an autoserv command from a job or host queue entry.
 
@@ -61,6 +62,7 @@
                    environment. This information is useful as autoserv knows
                    the database is available and can make database calls such
                    as looking up host attributes at runtime.
+    @param host_attributes: Dict of host attributes to pass into autoserv.
 
     @returns The autoserv command line as a list of executable + parameters.
 
@@ -109,6 +111,9 @@
             elif control_type_value == control_data.CONTROL_TYPE.SERVER:
                 command.append('-s')
 
+    if host_attributes:
+        command += ['--host_attributes', repr(host_attributes)]
+
     if verbose:
         command.append('--verbose')