More refactoring of the job state code to try and reduce duplication.
In the process this also refactors a bunch of job.run_test duplication,
specifically the handling of job tags (there's still lots more
duplicate code left).

The main state refactorings are:
  * Storing client job steps in __steps and special-casing its removal
    in autotest.py is gone. Instead the client job code stores it
    directly in the client.steps state, and the autotest.py generically
    removes the entire client.* namespace.
  * Moving this out of the publicly-visible state and into a private
    namespace allows us to drop has_state and discard_state, which
    were really only needed so that we could make sure __steps was
    not persisted across jobs.
  * All of this client-job state managment was moved out of autotest.py
    and into server_job.py. All the data this code was getting and
    setting was in the job object, so it seemed like a better place
    to put it. This also let us drop load_state and save_state, which
    were really only there to make it easier to push and pull data
    out of the server job object.
  * Eliminate get_run_number and set_run_number in favour of a generic
    use_sequence_number boolean property (that works on both client
    and server automatically). The get_ and set_ code was only being
    used to enable and disable an auto-incrementing sequence number to
    be tagged to each test run, so we can just make the public
    interface a boolean and handle the sequencing under the covers.
  * Drop all the test_tag and test_tag_prefix code in favour of a
    persistent automatic_test_tag property. Also drops the
    show_kernel_in_test_tag flag in favour of just implementing this
    in the control file generator using automatic_test_tag.
  * Refactor all the test name tagging code into base_job, unifying
    the tagging portion of the job.run_test code.

Signed-off-by: John Admanski <jadmanski@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4075 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/control_file.py b/frontend/afe/control_file.py
index 0cd59da..90b34ef 100644
--- a/frontend/afe/control_file.py
+++ b/frontend/afe/control_file.py
@@ -23,8 +23,7 @@
         job.next_step(boot_kernel, kernel_info)
         job.next_step(step_test, kernel_info['version'])
     if len(kernel_list) > 1:
-        job.set_run_number(1)  # Include run numbers in output directory names.
-        job.show_kernel_in_test_tag(True)  # Include kernel in output dir name.
+        job.use_sequence_number = True  # include run numbers in directory names
 
 
 def boot_kernel(kernel_info):
@@ -45,6 +44,10 @@
 def step_test(kernel_version):
     global kernel
     kernel = kernel_version  # Set the global in case anyone is using it.
+    if len(kernel_list) > 1:
+        # this is local to a machine, safe to assume there's only one host
+        host, = job.hosts
+        job.automatic_test_tag = host.get_kernel_ver()
 """
 
 SERVER_KERNEL_TEMPLATE = """\
@@ -98,7 +101,7 @@
         # a suffix to the test name otherwise we cannot run the same test on
         # different kernel versions
         if len(kernel_list) > 1:
-            job.set_test_tag_prefix(kernel_host.get_kernel_ver())
+            job.automatic_test_tag = kernel_host.get_kernel_ver()
         step_test()