[PATCH] add --debug switch

Nathaniel Smith njs at pobox.com
Tue Jul 15 23:51:46 UTC 2003


Little patch to add a --debug switch, allowing one to run QMTest under
pdb.

-- Nathaniel

-- 
"If you can explain how you do something, then you're very very bad at it."
  -- John Hopfield
-------------- next part --------------
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=setup_path.py --exclude=qm.sh --exclude=qm.spec qm-clean/ChangeLog qm-debug/ChangeLog
--- qm-clean/ChangeLog	2003-07-15 15:45:35.000000000 -0700
+++ qm-debug/ChangeLog	2003-07-15 16:45:14.000000000 -0700
@@ -1,3 +1,10 @@
+2003-07-15  Nathaniel Smith  <njs at codesourcery.com>
+
+	* qm/test/cmdline.py (QMTest.debug_option_spec): New --debug
+	option.
+	(QMTest.global_options_spec): Add --debug option.
+	(QMTest.Execute): Check for --debug option.
+
 2003-07-15  Vladimir Prus <ghost at cs.msu.su>
 	    Mark Mitchell <mark at codesourcery.com>
 
diff -urN --exclude='*~' --exclude='.*' --exclude=CVS --exclude='*.pyo' --exclude='*.pyc' --exclude=build --exclude=GNUmakefile --exclude=config.log --exclude=config.status --exclude=setup_path.py --exclude=qm.sh --exclude=qm.spec qm-clean/qm/test/cmdline.py qm-debug/qm/test/cmdline.py
--- qm-clean/qm/test/cmdline.py	2003-07-03 12:28:22.000000000 -0700
+++ qm-debug/qm/test/cmdline.py	2003-07-15 16:25:35.000000000 -0700
@@ -139,6 +139,13 @@
         "Path to the test database."
         )
 
+    debug_option_spec = (
+        None,
+        "debug",
+        None,
+        "Start QMTest in a debugger"
+        )
+
     extension_output_option_spec = (
         "o",
         "output",
@@ -304,6 +311,7 @@
         verbose_option_spec,
         version_option_spec,
         db_path_option_spec,
+        debug_option_spec,
         ]
 
     commands_spec = [
@@ -655,6 +663,12 @@
 
         error_occurred = 0
         
+        # If the user requested a debugger, start it now, immediately
+        # before their command is executed.
+        if self.HasGlobalOption("debug"):
+            import pdb
+            pdb.set_trace()
+
         # Dispatch to the appropriate method.
         if self.__command == "create-tdb":
             self.__ExecuteCreateTdb(db_path)


More information about the qmtest mailing list