Add a WARN message to the status log when a test runs with
profile_only=True but no profilers set up. It's all too easy to make
this mistake (e.g. tweaking a control file set up for profiling runs
to turn off the profilers, but forgetting to remove the profile_only)
and it leads to lots of confusion when the test successfully runs
with zero iterations.

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


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3784 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/test.py b/client/common_lib/test.py
index f2ee0a6..a20414b 100644
--- a/client/common_lib/test.py
+++ b/client/common_lib/test.py
@@ -240,6 +240,10 @@
             hook(self)
 
         if profile_only:
+            if not self.job.profilers.present():
+                self.job.record('WARN', None, None, 'No profilers have been '
+                                'added but profile_only is set - nothing '
+                                'will be run')
             self.run_once_profiling(postprocess_profiled_run, *args, **dargs)
         else:
             self.run_once(*args, **dargs)
diff --git a/client/common_lib/test_unittest.py b/client/common_lib/test_unittest.py
index 45bd2f5..481bc72 100755
--- a/client/common_lib/test_unittest.py
+++ b/client/common_lib/test_unittest.py
@@ -19,6 +19,8 @@
             class MockProfilerManager(object):
                 def active(self):
                     return False
+                def present(self):
+                    return True
             self.job = MockJob()
             self.job.profilers = MockProfilerManager()
             self._new_keyval = False
@@ -118,7 +120,7 @@
 
 
     def test_execute_profile_only(self):
-        # test that profile_only=True works.  (same as iterations=0)
+        # test that profile_only=True works.
         self.god.stub_function(self.test, 'drop_caches_between_iterations')
         self.test.drop_caches_between_iterations.expect_call()
         self.test.run_once_profiling.expect_call(None)