NOTE: This depends on the (not yet committed) patches mailed out to add default_profile_only support to the job classes.

Add a new parameter to the control file generation RPCs to generate
control files that make use of the new set_default_profile_only
API.

Risk: Low
Visibility: Adds a new optional parameter to generate_control_file

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


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3829 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/control_file.py b/frontend/afe/control_file.py
index 355c65f..d84af80 100644
--- a/frontend/afe/control_file.py
+++ b/frontend/afe/control_file.py
@@ -249,8 +249,10 @@
     return '\n'.join(res)
 
 
-def _get_profiler_commands(profilers, is_server):
+def _get_profiler_commands(profilers, is_server, profile_only):
     prepend, append = [], []
+    if profile_only is not None:
+        prepend.append("job.set_default_profile_only(%r)" % profile_only)
     for profiler in profilers:
         prepend.append("job.profilers.add('%s')" % profiler.name)
         append.append("job.profilers.delete('%s')" % profiler.name)
@@ -289,7 +291,7 @@
 
 
 def generate_control(tests, kernels=None, platform=None, is_server=False,
-                     profilers=(), client_control_file=''):
+                     profilers=(), client_control_file='', profile_only=None):
     """
     Generate a control file for a sequence of tests.
 
@@ -301,6 +303,8 @@
     @param profilers A list of profiler objects to enable during the tests.
     @param client_control_file Contents of a client control file to run as the
             last test after everything in tests.  Requires is_server=False.
+    @param profile_only bool, should this control file run all tests in
+            profile_only mode by default
 
     @returns The control file text as a string.
     """
@@ -314,7 +318,7 @@
     else:
         control_file_text = EMPTY_TEMPLATE
 
-    prepend, append = _get_profiler_commands(profilers, is_server)
+    prepend, append = _get_profiler_commands(profilers, is_server, profile_only)
 
     control_file_text += get_tests_stanza(tests, is_server, prepend, append,
                                           client_control_file)