You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "stevedlawrence (via GitHub)" <gi...@apache.org> on 2023/12/14 18:04:02 UTC

[PR] Verify that debuggers are reset after TDML tests are run [daffodil]

stevedlawrence opened a new pull request, #1131:
URL: https://github.com/apache/daffodil/pull/1131

   Current behavior in Daffodil is to automatically disable debugging after a call to runOneTest, which helps to avoid errors where enabling debugging in one test might cause failures in another test.
   
   This updates a test to use the latest TDML API and confirm that this behavior actually happens. Note that the schema that originally found the issue with long-lived debugger state is no longer valid in Daffodil, so it needed some tweaks. This also simplifies the custom debugger to avoid storing strings that are never needed.
   
   DAFFODIL-790


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Verify that debuggers are reset after TDML tests are run [daffodil]

Posted by "mbeckerle (via GitHub)" <gi...@apache.org>.
mbeckerle commented on code in PR #1131:
URL: https://github.com/apache/daffodil/pull/1131#discussion_r1427089346


##########
daffodil-test/src/test/scala/org/apache/daffodil/usertests/TestUserSubmittedTests.scala:
##########
@@ -52,49 +56,38 @@ class TestUserSubmittedTests {
   @Test def test_nameDOB_test2_pass(): Unit = { runner2.runOneTest("nameDOB_test2_pass") }
   @Test def test_nameDOB_test2_fail(): Unit = { runner2.runOneTest("nameDOB_test2_fail") }
 
-  /*//DFDL-1118
   @Test def test_dfdl_782() = {
-    val tr = new CustomTraceRunner
-    tr.init
-    val crunner = new CustomInteractiveDebuggerRunner(tr)
-    val db = new InteractiveDebugger(crunner, ExpressionCompiler)
-    Debugger.setDebugging(true)
-    Debugger.setDebugger(db)
+    val crunner = new CountTraceDebuggerRunner
+    val db = new InteractiveDebugger(crunner, ExpressionCompilers)
 
-    runner.runOneTest("test_DFDL_782")
-
-    // Comment out these two lines to see issue
-    // documented in DFDL-790
-    Debugger.setDebugging(false)
-    Debugger.setDebugger(null)
-  }
-   */
+    // sets the debugger and enables debugging
+    runner.setDebugger(db)
 
-}
-
-/*
-class CustomInteractiveDebuggerRunner(dr: DebuggerRunner)
-  extends InteractiveDebuggerRunner {
-  def init(id: InteractiveDebugger): Unit = dr.init
-  def getCommand(): String = dr.getCommand
-  def lineOutput(line: String): Unit = dr.lineOutput(line)
-  def fini(): Unit = dr.fini
-}
+    // run a test with the debugger and debugging enabled so that we count the lines. runOneTest
+    // will disable debugging when the test completes
+    runner.runOneTest("test_DFDL_782")
+    assertTrue(crunner.numLines > 0)
 
-class CustomTraceRunner extends TraceRunner {
-  private var _lines = List.empty[String]
+    // reset the numeLines counter to 0

Review Comment:
   Typo numeLines



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Verify that debuggers are reset after TDML tests are run [daffodil]

Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence merged PR #1131:
URL: https://github.com/apache/daffodil/pull/1131


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Verify that debuggers are reset after TDML tests are run [daffodil]

Posted by "stevedlawrence (via GitHub)" <gi...@apache.org>.
stevedlawrence commented on PR #1131:
URL: https://github.com/apache/daffodil/pull/1131#issuecomment-1856383069

   > Do I understand that the InteractiveDebugger class here does not mean that you interact with a live interactive debugger command line, rather, it lets you supply a callback "listener" class which can trace parts of Daffodil execution and print or accumulate data to help you debug a problem?
   
   Yep. There's a number of commands that the interactive debugger understands (e.g. "break", "step", "continue", "eval"). The "listener" or "debugger runner" is what provides the commands to run and receives the results to display. The name "interactive" is probably not the best since it really doesn't need to have user interaction at all (e.g the `TraceDebuggerRunner` just uses a list of predetermined commands). But I think it originally did require user input, but was eventually generalized and the name stuck.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org