Fix test_that run for non-telemtry tests.

Do not add the autotest_dir argument to test_that
for non-telemetry tests.
Minor change: Remove a leftover print from download_images
unit test.

BUG: chromium:679001
TEST:crosperf unit tests
Change-Id: I0ff5365902af40097b61ae57d7c0d8d43ea308a8
Reviewed-on: https://chromium-review.googlesource.com/426073
Reviewed-by: Caroline Tice <cmtice@chromium.org>
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Trybot-Ready: Manoj Gupta <manojgupta@chromium.org>
diff --git a/crosperf/download_images_unittest.py b/crosperf/download_images_unittest.py
index 24a94a3..7a4f385 100755
--- a/crosperf/download_images_unittest.py
+++ b/crosperf/download_images_unittest.py
@@ -116,7 +116,6 @@
 
     # Verify RunCommand was called twice with correct arguments.
     self.assertEqual(mock_cmd_exec.RunCommand.call_count, 2)
-    print(mock_cmd_exec.RunCommand.call_args_list)
     # Call 1, should have 2 arguments
     self.assertEqual(len(mock_cmd_exec.RunCommand.call_args_list[0]), 2)
     actual_arg = mock_cmd_exec.RunCommand.call_args_list[0][0]
diff --git a/crosperf/suite_runner.py b/crosperf/suite_runner.py
index 744d8bb..796c1e4 100644
--- a/crosperf/suite_runner.py
+++ b/crosperf/suite_runner.py
@@ -13,6 +13,7 @@
 import test_flag
 
 TEST_THAT_PATH = '/usr/bin/test_that'
+AUTOTEST_DIR = '~/trunk/src/third_party/autotest/files'
 CHROME_MOUNT_DIR = '/tmp/chrome_root'
 
 
@@ -173,13 +174,19 @@
     # Rebooting between iterations has proven to help with this.
     self.RebootMachine(machine, label.chromeos_root)
 
-    autotest_dir = '~/trunk/src/third_party/autotest/files'
+    autotest_dir = AUTOTEST_DIR
     if label.autotest_path != '':
       autotest_dir = label.autotest_path
-    command = (
-        ('%s --autotest_dir %s --fast '
-         '%s %s %s') %
-        (TEST_THAT_PATH, autotest_dir, options, machine, benchmark.test_name))
+
+    autotest_dir_arg = '--autotest_dir %s' % autotest_dir
+    # For non-telemetry tests, specify an autotest directory only if the
+    # specified directory is different from default (crosbug.com/679001).
+    if autotest_dir == AUTOTEST_DIR:
+      autotest_dir_arg = ''
+
+    command = (('%s %s --fast '
+                '%s %s %s') % (TEST_THAT_PATH, autotest_dir_arg, options,
+                               machine, benchmark.test_name))
     if self.log_level != 'verbose':
       self.logger.LogOutput('Running test.')
       self.logger.LogOutput('CMD: %s' % command)
@@ -211,7 +218,7 @@
 
     # For telemetry runs, we can use the autotest copy from the source
     # location. No need to have one under /build/<board>.
-    autotest_dir_arg = '--autotest_dir ~/trunk/src/third_party/autotest/files'
+    autotest_dir_arg = '--autotest_dir %s' % AUTOTEST_DIR
     if label.autotest_path != '':
       autotest_dir_arg = '--autotest_dir %s' % label.autotest_path
 
diff --git a/crosperf/suite_runner_unittest.py b/crosperf/suite_runner_unittest.py
index b5a0439..15847b0 100755
--- a/crosperf/suite_runner_unittest.py
+++ b/crosperf/suite_runner_unittest.py
@@ -256,8 +256,7 @@
     args_dict = mock_chroot_runcmd.call_args_list[0][1]
     self.assertEqual(len(args_list), 2)
     self.assertEqual(args_list[0], '/tmp/chromeos')
-    self.assertEqual(args_list[1], ('/usr/bin/test_that --autotest_dir '
-                                    '~/trunk/src/third_party/autotest/files '
+    self.assertEqual(args_list[1], ('/usr/bin/test_that  '
                                     '--fast  --board=lumpy '
                                     '--iterations=2 lumpy1.cros octane'))
     self.assertEqual(args_dict['command_terminator'], self.mock_cmd_term)