au_test_harness: Deprecate real_au_worker

Traced it all the way back to ctest.py use cases, and nowhere
real_au_worker has been used. cros flash should be used instead, but
since there is no use case for it right now, just deprecate it. It helps
with the cleanup of devserver.

BUG=chromium:872441
TEST=pfq-tryjob

Change-Id: I61e8503ea29c766d4582eecd8b0dbc80f06e69d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crostestutils/+/1808406
Reviewed-by: Daniel Wang <wonderfly@google.com>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Alex Zamorzaev <zamorzaev@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/au_test_harness/au_test.py b/au_test_harness/au_test.py
index 9cdef57..c60f30b 100644
--- a/au_test_harness/au_test.py
+++ b/au_test_harness/au_test.py
@@ -22,7 +22,6 @@
 from chromite.lib import signals
 from crostestutils.au_test_harness import cros_test_proxy
 from crostestutils.au_test_harness import gce_au_worker
-from crostestutils.au_test_harness import real_au_worker
 from crostestutils.au_test_harness import update_exception
 from crostestutils.au_test_harness import vm_au_worker
 
@@ -63,7 +62,7 @@
     elif  options.type == 'gce':
       cls.worker_class = gce_au_worker.GCEAUWorker
     else:
-      cls.worker_class = real_au_worker.RealAUWorker
+      raise ValueError('Invalid au_worker type: %s' % options.type)
 
     # Cache away options to instantiate workers later.
     cls.options = options
@@ -339,7 +338,7 @@
       frame: Current stack frame. See signal.signal for details on |signum| and
           |frame|.
     """
-    logging.warning('Received signal %d' % signum)
+    logging.warning('Received signal %d', signum)
     if signum:
       # If we've been invoked because of a signal, ignore delivery of that
       # signal from this point forward. The invoking context of this method
@@ -353,5 +352,5 @@
       signal.signal(signal.SIGTERM, signal.SIG_IGN)
     self.worker.CleanUp()
     if not signals.RelaySignal(original_handler, signum, frame):
-      logging.warning('Failed to relay signal %d to original handler.' % signum)
+      logging.warning('Failed to relay signal %d to original handler.', signum)
       sys.exit('Received signal %d.' % signum)
diff --git a/au_test_harness/cros_au_test_harness.py b/au_test_harness/cros_au_test_harness.py
index c9e94b9..454fd3b 100755
--- a/au_test_harness/cros_au_test_harness.py
+++ b/au_test_harness/cros_au_test_harness.py
@@ -125,7 +125,7 @@
     opts: Parsed opts.
   """
 
-  if not opts.type in ['real', 'vm', 'gce']:
+  if not opts.type in ['vm', 'gce']:
     parser.error('Failed to specify valid test type.')
 
   def _IsValidImage(image):
@@ -203,7 +203,7 @@
                       help='Only runs tests with specific prefix i.e. '
                       'testFullUpdateWipeStateful.')
   parser.add_argument('-p', '--type', default='vm',
-                      help='type of test to run: [vm, real, gce]. Default: vm.')
+                      help='type of test to run: [vm, gce]. Default: vm.')
   parser.add_argument('--verbose', default=True, action='store_true',
                       help='Print out rather than capture output as much as '
                       'possible.')
@@ -256,12 +256,8 @@
       if (opts.type == 'vm' or opts.type == 'gce') and opts.parallel:
         _RunTestsInParallel(opts)
       else:
-        # TODO(sosa) - Take in a machine pool for a real test.
-        # Can't run in parallel with only one remote device.
-        test_suite = _PrepareTestSuite(opts)
-        test_result = unittest.TextTestRunner().run(test_suite)
-        if not test_result.wasSuccessful():
-          cros_build_lib.Die('Test harness failed.')
+        cros_build_lib.Die('Test harness failed. unsupported test type %s' %
+                           opts.type)
 
     finally:
       if my_server:
diff --git a/au_test_harness/gce_au_worker.py b/au_test_harness/gce_au_worker.py
index 9792639..a33dd69 100644
--- a/au_test_harness/gce_au_worker.py
+++ b/au_test_harness/gce_au_worker.py
@@ -124,8 +124,8 @@
                   proxy_port=None, payload_signing_key=None):
     """Updates the image on the GCE instance.
 
-    Unlike vm_au_worker or real_au_worker, UpdateImage always creates a new
-    image and a new instance.
+    Unlike vm_au_worker, UpdateImage always creates a new image and a new
+    instance.
     """
     # Delete existing resources in the background if any.
     bg_delete = Process(target=self._DeleteExistingResources)
diff --git a/au_test_harness/real_au_worker.py b/au_test_harness/real_au_worker.py
deleted file mode 100644
index 2a21661..0000000
--- a/au_test_harness/real_au_worker.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Module containing class that implements an au_worker for a test device."""
-
-from __future__ import print_function
-
-import constants
-from chromite.lib import cros_build_lib
-from chromite.lib import path_util
-from crostestutils.au_test_harness import au_worker
-
-
-class RealAUWorker(au_worker.AUWorker):
-  """Test harness for updating real images."""
-
-  def __init__(self, options, test_results_root):
-    """Processes non-vm-specific options."""
-    super(RealAUWorker, self).__init__(options, test_results_root)
-    self.remote = options.remote
-    if not self.remote:
-      cros_build_lib.Die('We require a remote address for tests.')
-
-  def PrepareBase(self, image_path, signed_base=False):
-    """Auto-update to base image to prepare for test."""
-    return self.PrepareRealBase(image_path, signed_base)
-
-  def UpdateImage(self, image_path, src_image_path='', stateful_change='old',
-                  proxy_port=None, payload_signing_key=None):
-    """Updates a remote image using image_to_live.sh."""
-    stateful_change_flag = self.GetStatefulChangeFlag(stateful_change)
-    cmd = [os.path.join(constants.CROSTESTUTILS_DIR, 'image_to_live.sh'),
-           '--remote=%s' % self.remote,
-           stateful_change_flag,
-           '--verify',
-          ]
-    self.AppendUpdateFlags(cmd, image_path, src_image_path, proxy_port,
-                           payload_signing_key)
-    self.RunUpdateCmd(cmd)
-
-  def UpdateUsingPayload(self, update_path, stateful_change='old',
-                         proxy_port=None):
-    """Updates a remote image using image_to_live.sh."""
-    stateful_change_flag = self.GetStatefulChangeFlag(stateful_change)
-    cmd = [os.path.join(constants.CROSTESTUTILS_DIR, 'image_to_live.sh'),
-           '--payload=%s' % update_path,
-           '--remote=%s' % self.remote,
-           stateful_change_flag,
-           '--verify',
-          ]
-    if proxy_port:
-      cmd.append('--proxy_port=%s' % proxy_port)
-    self.RunUpdateCmd(cmd)
-
-  def VerifyImage(self, unittest, percent_required_to_pass=100, test=''):
-    """Verifies an image using test_that with verification suite."""
-    test_directory, _ = self.GetNextResultsPath('autotest_tests')
-    if not test:
-      test = self.verify_suite
-
-    cmd = ['test_that', '--no-quickmerge', '--results_dir=%s' % test_directory,
-           self.remote, test]
-    if self.ssh_private_key is not None:
-      cmd.append('--ssh_private_key=%s' %
-                 path_util.ToChrootPath(self.ssh_private_key))
-
-    result = cros_build_lib.RunCommand(cmd, error_code_ok=True,
-                                       enter_chroot=True, redirect_stdout=True,
-                                       cwd=constants.CROSUTILS_DIR)
-
-    return self.AssertEnoughTestsPassed(unittest, result.output,
-                                        percent_required_to_pass)