If you reboot during a server-side test while using a profiler, we
need to log a WARN message so that the user is aware that their
profiling data may be corrupt. Add a supports_reboot flag to the
profilers interface that allows profilers to disable this warning
if we know they're reboot-safe.
Risk: Low
Visibility: Adds feedback so that users don't blindly trust profiler
data when they reboot their machines during a test.
Signed-off-by: John Admanski <[email protected]>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2528 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/profiler.py b/server/profiler.py
index df3deac..645dc77 100644
--- a/server/profiler.py
+++ b/server/profiler.py
@@ -1,4 +1,6 @@
import os, itertools, shutil, tempfile
+import common
+
from autotest_lib.client.common_lib import utils, error
from autotest_lib.server import autotest
@@ -64,6 +66,12 @@
self.installed_hosts = {}
self.current_test = None
+ # does the profiler support rebooting?
+ profiler_module = common.setup_modules.import_module(
+ profiler_name, "autotest_lib.client.profilers.%s" % profiler_name)
+ profiler_class = getattr(profiler_module, profiler_name)
+ self.supports_reboot = profiler_class.supports_reboot
+
def _install(self):
""" Install autotest on any current job hosts. """
@@ -176,5 +184,10 @@
def handle_reboot(self, host):
if self.current_test:
test = self.current_test
+ if not self.supports_reboot:
+ msg = "profiler '%s' does not support rebooting during tests"
+ msg %= self.name
+ self.job.record("WARN", os.path.basename(test.outputdir),
+ None, msg)
self.report(test, host, wait_on_client=False)
self.start(test, host)