cheets_GTS_N: fix for R79

BUG=b:68021674
TEST=bot

Change-Id: Icd837b5f3b32c1f1ab12450bb879c5cbc4aae16a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1995111
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Commit-Queue: Kazuhiro Inaba <kinaba@chromium.org>
Tested-by: Kazuhiro Inaba <kinaba@chromium.org>
Auto-Submit: Kazuhiro Inaba <kinaba@chromium.org>
diff --git a/server/site_tests/cheets_GTS_N/cheets_GTS_N.py b/server/site_tests/cheets_GTS_N/cheets_GTS_N.py
index 001bcc2..005976b 100644
--- a/server/site_tests/cheets_GTS_N/cheets_GTS_N.py
+++ b/server/site_tests/cheets_GTS_N/cheets_GTS_N.py
@@ -61,13 +61,35 @@
     def _get_tradefed_base_dir(self):
         return 'android-gts'
 
-    def _tradefed_cmd_path(self):
-        return os.path.join(self._repository, 'tools', 'gts-tradefed')
+    def _run_tradefed(self, commands):
+        """Kick off GTS.
 
-    def _tradefed_env(self):
+        @param commands: the command(s) to pass to GTS.
+        @return: The result object from utils.run.
+        """
+        gts_tradefed = os.path.join(self._repository, 'tools', 'gts-tradefed')
+        env = None
         if self._authkey:
-            return dict(os.environ, APE_API_KEY=self._authkey)
-        return None
+            env = dict(os.environ, APE_API_KEY=self._authkey)
+        with tradefed_test.adb_keepalive(self._get_adb_targets(),
+                                         self._install_paths):
+            for command in commands:
+                timeout = self._timeout * self._timeout_factor
+                logging.info('RUN(timeout=%d): ./gts-tradefed %s', timeout,
+                             ' '.join(command))
+                output = self._run(
+                    gts_tradefed,
+                    args=tuple(command),
+                    env=env,
+                    timeout=timeout,
+                    verbose=True,
+                    ignore_status=False,
+                    # Make sure to tee tradefed stdout/stderr to autotest logs
+                    # continuously during the test run.
+                    stdout_tee=utils.TEE_TO_LOGS,
+                    stderr_tee=utils.TEE_TO_LOGS)
+                logging.info('END: ./gts-tradefed %s\n', ' '.join(command))
+        return output
 
     def run_once(self,
                  test_name,