Merge remote branch 'cros/upstream' into autotest-rebase

Merged to upstream trunk@5066, from trunk@4749.

There is no way I could enlist each individual CL from the upstream here since it will blow up the changelist description field.

BUG=
TEST=
Had patched this CL into a fresh cut client to avoid any side effect.
run_remote_test bvt from both emerged location and third_party/autotest/file.

Both test passed!

We should also keep any eye on this to see how it gets propagated into cautotest server.
TBR=dalecurtis

Change-Id: I72f2bc7a9de530178484aea1bfb5ace68bcad029
diff --git a/server/autotest_unittest.py b/server/autotest_unittest.py
index 6025af6..04023e9 100755
--- a/server/autotest_unittest.py
+++ b/server/autotest_unittest.py
@@ -256,6 +256,7 @@
         self.host.get_autodir.expect_call().and_return(None)
         self._expect_failed_run('test -x /some/path/bin/autotest')
         self.host.run.expect_call('test -x /another/path/bin/autotest')
+        self.host.run.expect_call('test -w /another/path')
 
         autodir = autotest.Autotest.get_installed_autodir(self.host)
         self.assertEquals(autodir, '/another/path')
@@ -268,6 +269,7 @@
         self._expect_failed_run('test -x /another/path/bin/autotest')
         self._expect_failed_run('mkdir -p /some/path')
         self.host.run.expect_call('mkdir -p /another/path')
+        self.host.run.expect_call('test -w /another/path')
 
         install_dir = autotest.Autotest.get_install_dir(self.host)
         self.assertEquals(install_dir, '/another/path')