From 265e624459a420b31ddab0d848e4160ce55c5a84 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 9 Feb 2010 14:15:00 +0100
Subject: [PATCH] Add debug mode to burnin

There are two entry points to job execution in burnin, ExecOp and
ExecOrQueue, and these are modified to call the new _SetDebug method on
the opcodes.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 tools/burnin | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/burnin b/tools/burnin
index 8bd428135..a17e85245 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -117,6 +117,7 @@ OPTIONS = [
                  default=128, type="unit", metavar="<size>",
                  completion_suggest=("128M 256M 512M 1G 4G 8G"
                                      " 12G 16G").split()),
+  cli.DEBUG_OPT,
   cli.VERBOSE_OPT,
   cli.NOIPCHECK_OPT,
   cli.NONAMECHECK_OPT,
@@ -305,6 +306,11 @@ class Burner(object):
             (msg, MAX_RETRIES - retry_count + 1, MAX_RETRIES, err))
         self.MaybeRetry(retry_count - 1, msg, fn, *args)
 
+  def _SetDebug(self, ops):
+    """Set the debug value on the given opcodes"""
+    for op in ops:
+      op.debug_level = self.opts.debug
+
   def _ExecOp(self, *ops):
     """Execute one or more opcodes and manage the exec buffer.
 
@@ -330,11 +336,13 @@ class Burner(object):
       rval = MAX_RETRIES
     else:
       rval = 0
+    self._SetDebug(ops)
     return self.MaybeRetry(rval, "opcode", self._ExecOp, *ops)
 
   def ExecOrQueue(self, name, *ops):
     """Execute an opcode and manage the exec buffer."""
     if self.opts.parallel:
+      self._SetDebug(ops)
       self.queued_ops.append((ops, name))
     else:
       return self.ExecOp(self.queue_retry, *ops)
-- 
GitLab