PageRenderTime 53ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/IronPython_Main/Languages/IronPython/Tests/debugging/__init__.py

#
Python | 774 lines | 751 code | 1 blank | 22 comment | 1 complexity | 23367d8ddb5878a6ebd0840e175c36f0 MD5 | raw file
Possible License(s): GPL-2.0, MPL-2.0-no-copyleft-exception, CPL-1.0, CC-BY-SA-3.0, BSD-3-Clause, ISC, AGPL-3.0, LGPL-2.1, Apache-2.0
  1. #####################################################################################
  2. #
  3. # Copyright (c) Microsoft Corporation. All rights reserved.
  4. #
  5. # This source code is subject to terms and conditions of the Apache License, Version 2.0. A
  6. # copy of the license can be found in the License.html file at the root of this distribution. If
  7. # you cannot locate the Apache License, Version 2.0, please send an email to
  8. # ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound
  9. # by the terms of the Apache License, Version 2.0.
  10. #
  11. # You must not remove this notice, or any other, from this software.
  12. #
  13. #
  14. #####################################################################################
  15. '''
  16. -------------------------------------------------------------------------------
  17. INTRODUCTION
  18. This test plan addresses debugging test coverage for the 2.x series of
  19. IronPython interpreter releases.
  20. EDITORS NOTES
  21. Throughout this document you will find references to documentation in
  22. other packages similar to "See documentation for debugging.pdb_module". This simply
  23. means that relative to this package (i.e., debugging), you should follow
  24. the 'pdb_module (package)' link at the bottom of this page.
  25. -------------------------------------------------------------------------------
  26. FEATURE GOALS
  27. The goals of IP's debugging feature is to provide IronPython users with
  28. complete use of CPython's existing debugger functionality, the "pdb" and
  29. "bdb" modules respectively, while also providing a great interactive debugging
  30. experience using Microsoft tools such as mdbg and the Visual Studio IDE.
  31. -------------------------------------------------------------------------------
  32. PRIMARY TESTING CONCERNS
  33. - new builtin module attributes added to IP to support CPython's "bdb" and "pdb"
  34. modules
  35. - compatibility with CPython's use of the "bdb" and "pdb" modules
  36. - what happens breakpoint-wise when IP steps into .NET code from "pdb"?
  37. - .NET applications hosting IP should be able to debug Python code
  38. - the experience of debugging IP under Microsoft's mdbg and Visual
  39. Studio tools is what existing CSharp and VB.Net would expect; but still
  40. Pythonic
  41. - "-D" command-line flag
  42. -------------------------------------------------------------------------------
  43. PRIMARY TESTING FOCUS
  44. Our principal testing focus will be on testing that IP's support of the
  45. "pdb" module is completely compatible with that of CPython by running existing
  46. CPython tests, and also by creating a new generic side-by-side testing framework.
  47. The secondardy focus will be testing that debugging IP under mdbg is a
  48. pleasant experience. This will initially be acheived by using the CLR Team's
  49. existing debugging test framework, but in the long run we will move to a
  50. new generic, side-by-side testing framework which can be reused for other
  51. side-by-side testing areas.
  52. -------------------------------------------------------------------------------
  53. REFERENCES
  54. * IronPython Test Plan Internal IP SharePoint site
  55. * Feature Specifications None...
  56. * Development Documents None...
  57. * Schedule Documents None...
  58. * CPython pdb module http://docs.python.org/library/pdb.html
  59. * CPython bdb module http://docs.python.org/library/bdb.html
  60. * pdb tutorial http://onlamp.com/pub/a/python/2005/09/01/debugger.html
  61. * MDbg.exe http://msdn.microsoft.com/en-us/library/ms229861.aspx
  62. * Debugging IP in Visual Studio http://devhawk.net/2008/05/08/Debugging+IronPython+Code+In+Visual+Studio.aspx
  63. * Bug queries http://ironpython.codeplex.com/WorkItem/AdvancedList.aspx
  64. and set the component to "Debugging"
  65. * Build drop location Updated at http://ironpython.codeplex.com/SourceControl/ListDownloadableCommits.aspx
  66. on weekdays
  67. * source file tree $/.../dlr/Debugging/ and also $/.../dlr/.../IronPython/*
  68. -------------------------------------------------------------------------------
  69. PERSONNEL
  70. Program Manager: hpierson
  71. Developer: dinov
  72. Tester: dfugate
  73. -------------------------------------------------------------------------------
  74. TESTING SCHEDULE
  75. Phase I - Test Plan and Enabling Existing Tests
  76. - Write test plan for IronPython Debugging feature
  77. - Enable any existing CPython test cases for "pdb" and "bdb" in SNAP
  78. - Enable any existing CPython test cases for Python features supporting
  79. "pdb" and "bdb" in SNAP
  80. Phase II - Examine Coverage of Existing Cases and Write High-priority Cases
  81. - Verify that developer tests for new additions to IP
  82. supporting "pdb" and "bdb" modules are sufficient. Write more test
  83. cases if not
  84. - Write additional test cases for the "pdb" module if CPython's test cases
  85. are insufficient
  86. - Examine our existing mdbg test (cases) looking for holes. Write new test
  87. cases if needed
  88. - Author a few manual sanity test cases for verifying IP can
  89. be debugged under the Visual Studio IDE. These should be folded into
  90. the CodePlex test pass signoff procedure for major releases
  91. Phase III - Design and Implement Side-by-Side Testing Framework
  92. - Based on the needs of test cases added in the previous phase either:
  93. 1. Design a side-by-side testing infrastructure to be used with testing
  94. IP's CPython debugging compatibility OR
  95. 2. Look for existing side-by-side testing frameworks we could reuse.
  96. The pexpect package might be useful here
  97. - Implement (or add existing) side-by-side testing framework
  98. Phase IV - Implement High-priority Cases
  99. - Implement test cases for additions to IP which support the
  100. "pdb" module IF NEEDED
  101. - Implement test cases for the "pdb" module IF NEEDED
  102. - Implement test cases for mdbg IF NEEDED
  103. Phase IV - Write Lower Priority Cases
  104. - Write test cases around stepping into (hosted) Python code from a
  105. .NET application
  106. - Write test cases around stepping into .NET code from an ipy.exe
  107. process
  108. - Write performance test cases
  109. Phase V - Implement Lower Priority Cases
  110. - Implement test cases around stepping into (hosted) Python code from a
  111. .NET application
  112. - Implement test cases around stepping into .NET code from an ipy.exe
  113. process
  114. - Implement performance test cases
  115. Phase VI - Future
  116. - Develop test cases for the "bdb" module if CPython's test cases are
  117. insufficient
  118. - Automate manual sanity Visual Studio debugging tests
  119. - Migrate existing mdbg tests to the new side-by-side testing framework
  120. - Low-resource test cases and implementation
  121. - Reliability test cases and implementation
  122. - Scalability test cases and implementation
  123. - Stress test cases and implementation
  124. - Internationalization test cases and implementation
  125. Phase P - All Public Releases
  126. - Verify all user documentation with respect to debugging
  127. - Setup testing - verify pdb.py and all supporting modules are installed by the MSI
  128. - Generate code coverage report and verify block coverage as greater
  129. than 80%
  130. -------------------------------------------------------------------------------
  131. FEATURE HISTORY
  132. 2.0: Tests implemented for IronPython under mdbg. Scenarios which still
  133. need to be covered are:
  134. * Attach scenario with and without the -D option
  135. * Step into/out when there is no pdb file for IP
  136. binaries
  137. * Multiple statements in one line (e.g., "x = 1;y=2"
  138. * if x and \\n y: print 1
  139. * dict/tuple spanning multiple lines
  140. * break/continue, explicit raise
  141. * other multi-line statement scenarios such as:
  142. if True: print 1
  143. if True:\\n print 1
  144. * MdbgInterop
  145. able to break into the C# code from Python
  146. able to break back into Python code from C#
  147. 2.6B2: First release of IronPython to include support of CPython's pdb module.
  148. Only works if -X:Frames or -X:FullFrames option supplied to ipy.exe.
  149. No pdb-related tests running in SNAP at this point, but we are running
  150. all of CPython's tests WRT supporting functions in the sys module.
  151. Debugging test plan completely rewritten in the form of pydoc strings,
  152. and made public.
  153. -------------------------------------------------------------------------------
  154. FEATURES:
  155. - sys.settrace, sys.gettrace, and sys.call_tracing. NOTE: while each of these
  156. three builtin module members needs to be tested within unit tests on their
  157. own, the real use case here is through the "bdb" and "pdb" modules
  158. - ipy.exe's generation of PDBs
  159. - ipy.exe's PDB visualizers
  160. -------------------------------------------------------------------------------
  161. FILES AND MODULES:
  162. - FILES LIST:
  163. * everything under Microsoft.Scripting.Debugging, although the DLR
  164. officially owns this
  165. * sys.cs
  166. * IronPython.Runtime.PythonTracebackListener
  167. - REGISTRY, INI SETTINGS: None
  168. - SETUP PROCEDURES:
  169. CPython standard library must be installed and present in sys.path to be
  170. usable
  171. - DE-INSTALLATION PROCEDURES
  172. N/A
  173. - DATABASE SETUP AND PROCEDURES
  174. N/A
  175. - NETWORK DOMAIN/TOPOLOGIES CONFIGURATION PROCEDURES
  176. N/A
  177. - PERFORMANCE MONITORING COUNTERS SETUP AND CONFIGURATIONS
  178. N/A
  179. -------------------------------------------------------------------------------
  180. OPERATIONAL ISSUES
  181. N/A. This feature of IP is not being monitored/maintained by operational
  182. staff, and IP is provided on an as-is basis.
  183. -------------------------------------------------------------------------------
  184. SCOPE OF TEST CASES
  185. We'll be getting most of our test coverage on the debugging feature of
  186. IP by unit testing the CPython 'pdb' module. Doing this thoroughly
  187. should guarantee we hit nearly all blocks of code supporting debugging in
  188. IP DLLs. This will be validated and verified through monthly code
  189. coverage runs. As an aside, this should in theory hit most of the DLR's
  190. Microsoft.Scripting.Debugging.dll as well.
  191. As IP currently has no tie-in into the Visual Studio IDE, this is
  192. arguably far less important to test than our support of the 'pdb' module or
  193. even mdbg. As a result, the Microsoft toolset testing emphasis will involve
  194. exahaustively covering all aspects of mdbg. That said, some of our users do in
  195. fact have VS Pro installed implying that we should perform at least minimal,
  196. manual sanity tests before every major public release of IP. Should we
  197. ever provide visualizers for our debug symbols we'll need much more
  198. comprehensive and automated tests for VS of course.
  199. -------------------------------------------------------------------------------
  200. ACCEPTANCE CRITERIA
  201. - no debugging related feature should be checked into the internal source
  202. repository without some form of unit test hooked into SNAP checked in as
  203. well
  204. - we should not publically advertise the existance of any new debugging features
  205. in an IP release unless:
  206. - if the feature is CPython-based; the majority of it's corresponding
  207. CPython unit test cases have been enabled in SNAP and pass
  208. - if the feature is novel to IP; block coverage should be greater
  209. than 70%
  210. - the feature needs to be documented in some form other than a blog
  211. - performance of the feature needs to be "within reason"
  212. - if the feature is not CPython-based; it needs a Pythonic feel to it
  213. - at least half of all bugs opened on the feature since its inception are
  214. fixed
  215. -------------------------------------------------------------------------------
  216. KEY FEATURE ISSUES
  217. - no spec on debugging IP from mdbg, VS, or what debugging symbols
  218. should be generated for various Python constructs
  219. - insufficient test resources to adequately test this feature
  220. - insufficient resources to implement all debugging features called out in this
  221. test plan
  222. - existing mdbg tests are based on CLR infrastructure and require a Perl
  223. installation. We cannot redistribute this publically
  224. - existing mdbg tests in SNAP are flakey
  225. -------------------------------------------------------------------------------
  226. TEST APPROACH
  227. - DESIGN VALIDATION
  228. We have no part in the design of the "pdb" and "bdb" standard modules.
  229. As for debugging under mdbg...there is no current design document on
  230. debugging Python sessions. Generally speaking test will simply ensure that
  231. whatever mdbg functionality exists with regard to IP is "Pythonic",
  232. but at the same time familiar to CSharp and VB developers.
  233. - DATA VALIDATION
  234. pdb/bdb: at a very low-level, all we need to validate is that parameters passed
  235. to a trace function we set via sys.settrace are as expected. In particular,
  236. the first parameter passed in is the current stack frame which we have a
  237. very solid chance of getting wrong.
  238. mdbg/VS: need to validate that generation of PDB symbols "make sense"
  239. with respect to whatever Python source is being compiled. There are at
  240. least two ways to accomplish this:
  241. 1. Create a regression test in which we compare the generated PDB of a
  242. known Python script to an expected PDB file. The Python script should
  243. exhaustively cover everything that's possible in the Python grammar.
  244. Testing in this manner is not really maintainable in the long run as we
  245. expect the PDB generated for a given Python script to change over time
  246. reflecting optimizations and new features added to IP
  247. 2. Test that the behavior of mdbg, given a known Python script, does not
  248. regress. Again, this Python script should exhaustively cover everything
  249. that's possible in Python's grammar, but this time around we'll also
  250. need to cover everything that's possible under mdbg
  251. - API TESTING
  252. We'll exhaustively cover the entire "pdb" standard module without ever
  253. touching the CSharp APIs directly. Prior coverage runs have shown that
  254. (generally speaking) any block of code that is not directly hittable through
  255. the Python API is likely dead code. Also, testing "bdb" module is lower
  256. priority as "pdb" uses this for its own implementation. The final
  257. justification for this is that there is actually very little in terms of
  258. debugging APIs in IP DLLs. Most of the debugging support is built
  259. directly into the DLR's Microsoft.Scripting.Debugging.dll.
  260. For mdbg/VS, we'll exhaustively cover all mdbg commands.
  261. - CONTENT TESTING
  262. All debugging documentation should be thoroughly reviewed by Test before any
  263. public release of IronPython. Careful attention will be given to duplicating
  264. exactly any command fed into ipy.exe or mdbg.exe, and this should be
  265. automated entirely if feasible.
  266. - LOW-RESOURCE TESTING
  267. Use of the debugging feature has a few side effects which might be interesting
  268. from a limited resources perspective. First and foremost, use of the -X:Frames
  269. and -X:FullFrames IP console flags imply that IP will consume more
  270. memory than under normal circumstances. We should check that IP does not
  271. consume "too much" extra memory. Next, use of the debugging flag, '-D', in
  272. conjunction with the '-X:SaveAssemblies' flag will generate
  273. Snippets.debug.scripting.pdb in the %TMP% directory. What occurs if the drive
  274. containing %TMP% is full?
  275. NOTE: while this is an interesting test area to explore, there are no current
  276. plans to test it. We should perform general low-resource testing of
  277. IP before tackling it for this specific feature.
  278. - SETUP TESTING
  279. The only option of IP's MSI installer capable of affecting
  280. the debugging feature is the ability to selectively install CPython's standard
  281. library. As we generate the list of CPython modules to include in the MSI
  282. dynamically, it would be worthwhile to always check that pdb.py is included.
  283. NOTE: IronPython currently has no automated tests for the MSI. Once we
  284. do, we need to add a check to ensure pdb.py is always included. For the time
  285. being this will have to be done manually.
  286. - MODES AND RUNTIME OPTIONS
  287. We should focus our efforts on testing IP with the following modes:
  288. * -D -X:Frames
  289. * -D -X:FullFrames
  290. * -D -X:Frames -X:SaveAssemblies
  291. * -D
  292. * -X:Frames
  293. *
  294. using both debug and release IP assemblies. Also note that this
  295. needs to be performed for both Python interactive sessions and Python scripts
  296. passed into ipy.exe (e.g., "ipy.exe test_str.py"). Last but
  297. not least, there's the %PYTHONDEBUG% environment variable to consider.
  298. - INTEROPERABILITY
  299. Of primary concern is that IP produces an identical experience as
  300. CPython when given input which utilizes the pdb module. This will be
  301. accomplished via side-by-side testing and verification that the output of
  302. IP is the same as CPython given an identical input.
  303. We will also verify that IP can be debugged from mdbg and the Visual
  304. Studio IDE.
  305. - INTEGRATION TESTING
  306. * Silverlight support of debugging?
  307. * breaking into .NET code from pdb
  308. * breaking into COM from pdb
  309. * breaking into IronRuby from pdb
  310. * breaking into Python code from DLR hosting APIs
  311. * breaking into Python code from IronRuby
  312. - BETA TESTING
  313. The second beta release of IronPython 2.6 will support the debugging feature
  314. in the form of very limited pdb module support with the -X:Frames flag
  315. passed to ipy.exe. As with all beta releases of IP, this will be
  316. released on CodePlex to the general public. We will then use feedback
  317. from the IronPython Community to determine the amount of effort that goes
  318. into fully testing this feature.
  319. - ENVIRONMENT/SYSTEM - GENERAL
  320. The %PYTHONDEBUG% environment variable may have some impact on this feature.
  321. Other than this, the VS IDE will of course need to be installed for testing
  322. the VS debugging experience.
  323. - CONFIGURATION
  324. Need .NET 2.0 Service Pack 1 installed to run IP, and .NET 3.5
  325. Service Pack 1 to build the feature.
  326. - USER INTERFACE
  327. IP provides no user interfaces.
  328. - PERFORMANCE & CAPACITY TESTING
  329. Minimally, we need to run one or more tests in the perf lab under the -X:Frames
  330. and -X:FullFrames test modes. We should also measure the end-to-end run time
  331. of a complete, yet minimal, debugging sample utilizing the pdb module in the
  332. lab. The focus here will simply be on ensuring there are no perf regressions
  333. which are greater than 15% for any given checkin, and also that overall
  334. performance of the debugging feature remains palatable to our userbase.
  335. In terms of capacity testing we should look at:
  336. - if perf gets affected when breaking into deeply nested functions (e.g.,
  337. recursive functions)
  338. - anything else?
  339. - PRIVACY
  340. Does %TMP%\Snippets.debug.scripting.pdb contain sensitive customer data? If
  341. so, does IP disclose the existence of this file?
  342. Is remote debugging supported? If so, what safeguards are in place?
  343. - RELIABILITY
  344. Most end-users are expected to enter into debugging sessions for short
  345. periods of time to diagnose issues with Python code. From this perspective
  346. the so-called "up time" of debugging sessions is less important than the
  347. overall sporadic failure frequency. We can get a good sense of how often
  348. sporadic failures occur by automatically running debugging tests in SNAP
  349. for every IP checkin.
  350. - SCALABILITY
  351. Does debugging still work correctly when stepping into deeply nested (e.g., 1000)
  352. functions?
  353. - STRESS TESTING
  354. - gcstress
  355. - MDA
  356. - assemblies in the GAC
  357. - call pdb functions multiple times and look for memory leaks
  358. - what happens when stepping into unreasonably deeply nested functions?
  359. - VOLUME TESTING
  360. App building exercise or try utilizing pdb from some of our internal Python
  361. tools. It would be interesting to use this from gopackage when exceptions
  362. are encountered.
  363. - INTERNATIONAL ISSUES
  364. As Python is not a localized language and available only in English, we
  365. simply need to confirm that nothing gets localized. This can be done by
  366. running a simple debugbing test against non-English OSes such as Deutsche
  367. Vista.
  368. - ROBUSTNESS
  369. We'll need a dedicated test or two in the stress lab to ensure there are no
  370. memory leaks. Also, we'll need to keep an eye out for sporadic failures of
  371. debugging tests in SNAP.
  372. - ERROR TESTING
  373. What happens when invalid commands are fed to the pdb debugger? Is this
  374. handled identically to CPython?
  375. Is there any conceivable way to fully break debugging without actually
  376. breaking ipy.exe in general? What happens under the mode
  377. "-D -X:SaveAssemblies" when the current user doesn't have write
  378. permissions on %TMP%? What happens if MS.Scripting.Debugging.dll is
  379. removed outright?
  380. - USABILITY
  381. There are three major usability issues with debugging:
  382. * IP offers no visualizer for the VS IDE
  383. * we're largely incompatible with CPython's pdb module
  384. * debugging Python code from .NET apps isn't currently possible
  385. Test will depend on feedback from the IronPython Mailing List and blogs to
  386. determine more usability issues. Resource permitting, we may also do
  387. app building exercises.
  388. The usability goal of this feature is that there are no complaints about
  389. the IP debugging experience from our users.
  390. - ACCESSIBILITY
  391. As this feature provides no new user interfaces to IronPython. and simply
  392. emits output to the stdout stream of command prompts, there should be no
  393. need to invest into accessibility testing.
  394. - USER SCENARIOS
  395. It's anticipated that users of this feature will be limited almost exclusively to
  396. developers. Expert Python users will likely prefer using the pdb
  397. module or debugging their applications directly via the "-i" ipy.exe
  398. option. Existing Microsoft customers with little Python background will
  399. probably be more comfortable with the VS IDE debugging experience. Due to
  400. this we must make sure both experiences are great!
  401. The types of applications being debugged will likely:
  402. * be non-trivial
  403. * consist of many different modules/packages
  404. * make heavy use of the CPython standard library and/or third party Python
  405. packages
  406. * be debugged often during the application development phase
  407. * be debugged infrequently in a production environment when something goes
  408. awry
  409. With these constraints in mind, we should try to debug existing major third
  410. party Python applications and/or add debugging support to our own internal
  411. Python tools.
  412. - BOUNDARIES AND LIMITS
  413. What happens when stepping into a recursive function at the maximum recursion
  414. level?
  415. - OPERATIONAL ISSUES
  416. None
  417. - SPECIAL CODE PROFILING AND OTHER METRICS
  418. Overall block coverage of all assemblies with "ipy" or "IronPython" in their
  419. names should be above 80% and file coverage should stay above 97%. Visual
  420. Studio's mstest will be used to measure code coverage.
  421. -------------------------------------------------------------------------------
  422. TEST ENVIRONMENT
  423. - OPERATING SYSTEMS
  424. 32-bit Windows XP
  425. 32-bit Windows 2003
  426. 64-bit Windows 2003
  427. 32-bit Windows Vista
  428. 64-bit Windows Vista
  429. 32-bit Windows Vista (Deutsche)
  430. - NETWORKS
  431. General Intranet network connection required for SNAP.
  432. May be other special network needs if remote debugging is/becomes a supported scenario.
  433. - HARDWARE
  434. - MACHINES
  435. At least two machines of every OS variety called out above with at least
  436. 10 gigs of free hard disk space, 2 gigs of RAM, and a modern CPU
  437. - SOFTWARE
  438. * Visual Studio 2008 Team System Service Pack 1 installed to run the
  439. test suite
  440. * PowerShell 1.0 to run any supporting test scripts
  441. * CPython for side-by-side tests
  442. * mdbg
  443. -------------------------------------------------------------------------------
  444. UNIQUE TESTING CONCERNS FOR SPECIFIC FEATURES
  445. It should be relatively easy to drive pdb or mdbg via the command line in an
  446. automated fashion, but the same cannot be said about the VS IDE debugging
  447. experience. We'll need to reuse the VS team's automation infrastructure and
  448. ensure any machines running these tests in SNAP are never locked at the
  449. username/password screen which would cause the test to fail. Also, should
  450. visualization ever be a supported scenario, we may have no other option than to
  451. test this manually (note - this needs to be investigated).
  452. -------------------------------------------------------------------------------
  453. AREA BREAKDOWN
  454. - CPython's "pdb" module
  455. See debugging.pdb_mod.
  456. - mdbg tool support
  457. See debugging.mdbg_tool.
  458. - VS IDE
  459. See debugging.vs.
  460. - sys module extensions
  461. - sys.settrace
  462. settrace(function)
  463. Set the system's trace function, which allows you to implement a Python
  464. source code debugger in Python. The function is thread-specific; for a
  465. debugger to support multiple threads, it must be registered using
  466. settrace() for each thread being debugged.
  467. Trace functions should have three arguments: frame, event, and arg. frame
  468. is the current stack frame. event is a string: 'call', 'line', 'return',
  469. 'exception', 'c_call', 'c_return', or 'c_exception'. arg depends on the
  470. event type.
  471. The trace function is invoked (with event set to 'call') whenever a new
  472. local scope is entered; it should return a reference to a local trace
  473. function to be used that scope, or None if the scope shouldn't be traced.
  474. The local trace function should return a reference to itself (or to another
  475. function for further tracing in that scope), or None to turn off tracing
  476. in that scope.
  477. The events have the following meaning:
  478. 'call'
  479. A function is called (or some other code block entered). The global
  480. trace function is called; arg is None; the return value specifies the
  481. local trace function.
  482. 'line'
  483. The interpreter is about to execute a new line of code (sometimes
  484. multiple line events on one line exist). The local trace function is
  485. called; arg is None; the return value specifies the new local trace
  486. function.
  487. 'return'
  488. A function (or other code block) is about to return. The local trace
  489. function is called; arg is the value that will be returned. The trace
  490. function's return value is ignored.
  491. 'exception'
  492. An exception has occurred. The local trace function is called; arg is
  493. a tuple (exception, value, traceback); the return value specifies the
  494. new local trace function.
  495. 'c_call'
  496. A C function is about to be called. This may be an extension function
  497. or a builtin. arg is the C function object.
  498. 'c_return'
  499. A C function has returned. arg is None.
  500. 'c_exception'
  501. A C function has thrown an exception. arg is None.
  502. Note that as an exception is propagated down the chain of callers, an
  503. 'exception' event is generated at each level.
  504. - sys.gettrace
  505. Get the trace function as set by settrace().
  506. - sys.call_tracing
  507. call_tracing(func, args) -> object
  508. Call func(*args), while tracing is enabled. The tracing state is
  509. saved, and restored afterwards. This is intended to be called from
  510. a debugger from a checkpoint, to recursively debug some other code.
  511. -------------------------------------------------------------------------------
  512. TEST CASE STRUCTURE
  513. Test cases will be stored directly in the pydoc strings of the functions
  514. implementing the tests. In turn, the modules containing these test case
  515. functions can be found under the "debugging" test package. Generating pydoc for
  516. the "debugging" test package and all sub-modules/sub-packages will generate
  517. this test plan.
  518. -------------------------------------------------------------------------------
  519. SPEC REVIEW ISSUES
  520. There is no IronPython spec for this feature. Any issues observed in the pdb
  521. module, which acts as a spec, and reproducible under CPython should be reported
  522. to http://bugs.python.org.
  523. -------------------------------------------------------------------------------
  524. TEST TOOLS
  525. One of the following:
  526. - reuse CLR's debugging test infrastructure. NOTE: this is only suitable for
  527. mdbg tests
  528. - write our own new side-by-side testing infrastructure entirely in Python
  529. so that we can eventually contribute pdb tests back to CPython
  530. - write our own new side-by-side testing infrastructure in any
  531. language using any framework. http://sourceforge.net/projects/pexpect/ could
  532. be useful as would be PowerShell
  533. - re-use some internal tool that might not be redistributable on CodePlex
  534. which will minimally need to support the following features:
  535. - ability to ignore lines (matching some regular expression) entirely
  536. - ability to substitute strings in lines
  537. - ability to run arbitrary commands (e.g., not limited to "ipy.exe ..." or "mdbg ...")
  538. - ability to match the current output against a reference output stored on disk
  539. - ability to run two or more arbitrary commands and compare their output against each other
  540. As per usual, the plan is to automate all tests using the SNAP checkin system
  541. and VS's mstest tool.
  542. -------------------------------------------------------------------------------
  543. SMOKE TEST (ACCEPTANCE TEST, BUILD VERIFICATION, ETC.)
  544. pdb acceptance test
  545. ipy.exe -c "import pdb"
  546. mdbg
  547. TODO (July 30, 2009)
  548. Visual Studio IDE
  549. TODO (July 30, 2009)
  550. -------------------------------------------------------------------------------
  551. AUTOMATED TESTS
  552. pdb and mdbg tests will be 100% automated in SNAP.
  553. -------------------------------------------------------------------------------
  554. MANUAL TESTS
  555. Setup testing will be manual for now, and we'll eventually move to automated
  556. testing in SNAP using PowerShell support scripts.
  557. Visual Studio IDE testing is also manual for now. Sometime in the
  558. future we'll migrate to using the VS team's automation technologies.
  559. Manual testing will only occur for major IP releases and the
  560. instructions will be documented on the internal IP website under the
  561. "Release Process" wiki.
  562. -------------------------------------------------------------------------------
  563. REGRESSION TESTS
  564. Regression tests will be added to existing test modules under the "debugging"
  565. package before any CodePlex or internal bug dealing with debugging is closed.
  566. As such, the majority of these regressions will be automated and run on every
  567. developer or test checkin. Developers should preferably add a regression test
  568. for every bug fix, and Test will verify the sufficiency of the test, extending
  569. it if necessary.
  570. -------------------------------------------------------------------------------
  571. BUG BASHES
  572. While considered to be extremely useful, we have no current plans for internal
  573. bug bashes on this feature. Quite simply put, we need more IronPython headcount
  574. and/or interest from the rest of Visual Studio Languages to accomplish this.
  575. -------------------------------------------------------------------------------
  576. BUG REPORTING
  577. All bug reports on this feature which do not include information consided to be
  578. Microsoft confidential are to be filed at
  579. http://ironpython.codeplex.com/WorkItem/AdvancedList.aspx under the "Debugging"
  580. component using the bug template found at
  581. http://ironpython.codeplex.com/Wiki/View.aspx?title=IronPython%20Bug%20Template.
  582. Bugs will be triaged on a weekly basis by the entire IronPython Team.
  583. -------------------------------------------------------------------------------
  584. PLAN CONTINGENCIES
  585. Without at least one additional SDET or other test tasks getting dropped, only
  586. phases I and II of this plan are implementable prior to the release of
  587. IP 2.6 RTM.
  588. -------------------------------------------------------------------------------
  589. EXTERNAL DEPENDENCIES
  590. We depend on the DLR for their implementation of Microsoft.Scripting.Debugging.dll
  591. which forms the basis of our support of the CPython pdb module. This plan
  592. assumes that this DLL has been adequately tested.
  593. There are no teams/projects we know about which are taking a dependency on
  594. IP's debugging functionality.
  595. -------------------------------------------------------------------------------
  596. HEADCOUNT REQUIREMENTS
  597. At least two FTE IronPython SDETs will be needed to implement this test plan
  598. fully: one to handle general, day-to-day IP test operations
  599. (i.e., passes/investigations/issues/regressions, etc), and another to work exclusively on the
  600. debugging feature. A loose approximation is that the SDET working full-time
  601. on debugging would need anywhere from one to three months to completely
  602. implement all aspects of this plan. This estimate varies considerably
  603. depending upon how much emphasis is to be given to pdb versus mdbg versus the
  604. VS IDE. Having a second full-time SDET on the debugging feature would have a
  605. not positive effect as the division of labor between testing command-line IP
  606. debugging support and VS IDE support is quite clear.
  607. -------------------------------------------------------------------------------
  608. PRODUCT SUPPORT
  609. IP is not a supported product in the conventional Microsoft sense.
  610. Support for IP is freely given directly by the IP Team via the
  611. IronPython Mailing List.
  612. -------------------------------------------------------------------------------
  613. DROP PROCEDURES
  614. All developer checkins must go through the SNAP checkin system => IronPython
  615. sources are always in a "good" state. Test will build IP from sources
  616. using developer instructions.
  617. -------------------------------------------------------------------------------
  618. RELEASE PROCEDURES
  619. See the IP "Release Process" wiki on the internal IP website.
  620. -------------------------------------------------------------------------------
  621. ALIAS/NEWSGROUPS AND COMMUNICATION CHANNELS
  622. Major changes around IP debugging support should be announced on the
  623. IronPython Mailing List, users@lists.ironpython.com.
  624. -------------------------------------------------------------------------------
  625. REGULAR MEETINGS
  626. - FEATURE TEAM MEETINGS
  627. There is no feature team for debugging.
  628. - PROJECT TEST TEAM MEETINGS
  629. IronPython weekly team meeting. Day and time are subject to change.
  630. We'll triage debugging work items during this meeting and discuss IP
  631. debugging issues as necessary.
  632. - FEATURE TEAM TEST MEETINGS
  633. There is no feature test team for debugging.
  634. -------------------------------------------------------------------------------
  635. DECISION MAKING PROCEDURES
  636. Decisions on this feature will be driven by the following criteria:
  637. - Microsoft business needs
  638. - IronPython Community feature requests
  639. - Previous decisions made by CPython. E.g., the pdb module
  640. - Existing debugging support in Microsoft products such as VS
  641. In the event a conscensus cannot be reached by the team on something, Jim
  642. Hugunin's input should be sought.
  643. Miscellaneous Procedures:
  644. - the gopackage tool is responsible for validating all source pushes to
  645. CodePlex
  646. - at least two IP team members need to sanity check public builds
  647. before they can be released
  648. - full test pass signoff on this feature will be needed for every public, signed
  649. release
  650. - bug triages will be performed with all three software disciplines in attendance
  651. - development design should be reviewed both by the PM and Test disciplines
  652. -------------------------------------------------------------------------------
  653. NOTES
  654. MDBG TEST CASE WRITING TIPS
  655. - use different language structures as the last line in the Python file
  656. - when only one line lives inside a block of code, but the code should not be
  657. stepped through
  658. - correct step-through: no extra step-throughs or lack thereof
  659. -
  660. '''