This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_gdb_sample fails
Type: behavior Stage: resolved
Components: Library (Lib), Tests Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: dmalcolm Nosy List: dmalcolm, loewis, pitrou, vstinner
Priority: normal Keywords: buildbot, patch

Created on 2010-04-01 16:44 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_gdb.patch vstinner, 2010-04-17 21:40
Messages (7)
msg102104 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-01 16:44
This doesn't happen in verbose mode, because stdout isn't checked:


$ ./python -m test.regrtest test_gdb_sample
test_gdb_sample
test test_gdb_sample produced unexpected output:
**********************************************************************
42

**********************************************************************
1 test failed:
    test_gdb_sample
msg102108 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-04-01 17:13
Sorry about that.

"test_gdb_sample.py" is merely a sample script for use by "test_gdb.py" (see issue 8032); it's not intended to do anything useful by itself (though it does need a "print" invocation, since test_gdb.py uses a breakpoint in PyObject_Print).

I would probably be simplest to rename it so it doesn't have a "test_" prefix.

How about "sample_for_test_gdb.py", or somesuch?
msg102111 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-01 17:24
> I would probably be simplest to rename it so it doesn't have a "test_" prefix.

Indeed. Otherwise it gets caught and executed by regrtest as part of the
standard test suite.

> How about "sample_for_test_gdb.py", or somesuch?

Shorter would be better :)
For example gdb_sample.py, gdb_fodder.py...
msg102114 - (view) Author: Dave Malcolm (dmalcolm) (Python committer) Date: 2010-04-01 17:50
"gdb_sample.py" as a name works for me.  I don't have commit rights to SVN so I can't perform the rename myself.

(Note that due to issue 8279 the file isn't actually used at the moment by test_gdb.py so it should be safe to rename.  I have a patch attached to that latter bug; I'll fix up the patch after that file is renamed).
msg102115 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-01 17:57
> (Note that due to issue 8279 the file isn't actually used at the moment 
> by test_gdb.py so it should be safe to rename.  I have a patch attached 
> to that latter bug; I'll fix up the patch after that file is renamed).

Thank you, this is done in r79557.
msg103435 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-17 21:40
test_gdb.py refers to test_gdb_sample.py instead of gdb_sample.py. Attached patch fixes that.

But then I get new errors:
---------------
...
Verify the pretty-printing of unicode values ... ok                        
test_basic_command (__main__.PyListTests)                                  
Verify that the "py-list" command works ... FAIL                           
test_one_abs_arg (__main__.PyListTests)                                    
Verify the "py-list" command with one absolute argument ... FAIL           
test_two_abs_args (__main__.PyListTests)                                   
Verify the "py-list" command with two absolute arguments ... FAIL          
test_down_at_bottom (__main__.StackNavigationTests)                        
Verify handling of "py-down" at the bottom of the stack ... FAIL           
test_pyup_command (__main__.StackNavigationTests)                          
Verify that the "py-up" command works ... FAIL                             
test_up_at_top (__main__.StackNavigationTests)                             
Verify handling of "py-up" at the top of the stack ... FAIL                
test_up_then_down (__main__.StackNavigationTests)                          
Verify "py-up" followed by "py-down" ... FAIL                              
test_basic_command (__main__.PyBtTests)                                    
Verify that the "py-bt" command works ... FAIL                             
test_basic_command (__main__.PyPrintTests)                                 
Verify that the "py-print" command works ... FAIL                          
test_print_after_up (__main__.PyPrintTests) ... FAIL                       
test_printing_builtin (__main__.PyPrintTests) ... FAIL                     
test_printing_global (__main__.PyPrintTests) ... FAIL                      
test_basic_command (__main__.PyLocalsTests) ... FAIL                       
test_locals_after_up (__main__.PyLocalsTests) ... FAIL                     

======================================================================
FAIL: test_basic_command (__main__.PyListTests)                       
Verify that the "py-list" command works                               
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 535, in test_basic_command        
    cmds_after_breakpoint=['py-list'])                                
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_one_abs_arg (__main__.PyListTests)                         
Verify the "py-list" command with one absolute argument               
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 552, in test_one_abs_arg          
    cmds_after_breakpoint=['py-list 9'])                              
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_two_abs_args (__main__.PyListTests)                        
Verify the "py-list" command with two absolute arguments              
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 565, in test_two_abs_args         
    cmds_after_breakpoint=['py-list 1,3'])                            
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_down_at_bottom (__main__.StackNavigationTests)             
Verify handling of "py-down" at the bottom of the stack               
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 588, in test_down_at_bottom       
    cmds_after_breakpoint=['py-down'])                                
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_pyup_command (__main__.StackNavigationTests)               
Verify that the "py-up" command works                                 
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 578, in test_pyup_command         
    cmds_after_breakpoint=['py-up'])                                  
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_up_at_top (__main__.StackNavigationTests)                  
Verify handling of "py-up" at the top of the stack                    
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 595, in test_up_at_top            
    cmds_after_breakpoint=['py-up'] * 4)                              
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''                                                                                

======================================================================
FAIL: test_up_then_down (__main__.StackNavigationTests)               
Verify "py-up" followed by "py-down"                                  
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 602, in test_up_then_down         
    cmds_after_breakpoint=['py-up', 'py-down'])                       
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''                                                                                                    

======================================================================
FAIL: test_basic_command (__main__.PyBtTests)                         
Verify that the "py-bt" command works                                 
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 615, in test_basic_command        
    cmds_after_breakpoint=['py-bt'])                                  
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_basic_command (__main__.PyPrintTests)                      
Verify that the "py-print" command works                              
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 630, in test_basic_command        
    cmds_after_breakpoint=['py-print args'])                          
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_print_after_up (__main__.PyPrintTests)                     
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 636, in test_print_after_up       
    cmds_after_breakpoint=['py-up', 'py-print c', 'py-print b', 'py-print a'])
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace                   
    self.assertEquals(err, '')                                                
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''                                                                                

======================================================================
FAIL: test_printing_builtin (__main__.PyPrintTests)                   
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 648, in test_printing_builtin     
    cmds_after_breakpoint=['py-print len'])                           
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_printing_global (__main__.PyPrintTests)                    
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 642, in test_printing_global      
    cmds_after_breakpoint=['py-print __name__'])                      
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_basic_command (__main__.PyLocalsTests)                     
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 655, in test_basic_command        
    cmds_after_breakpoint=['py-locals'])                              
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''

======================================================================
FAIL: test_locals_after_up (__main__.PyLocalsTests)                   
----------------------------------------------------------------------
Traceback (most recent call last):                                    
  File "Lib/test/test_gdb.py", line 661, in test_locals_after_up      
    cmds_after_breakpoint=['py-up', 'py-locals'])                     
  File "Lib/test/test_gdb.py", line 111, in get_stack_trace           
    self.assertEquals(err, '')                                        
AssertionError: "Error occurred in Python command: 'gdb.Frame' object has no attribute 'function'\nError occurred in Python command: 'gdb.Frame' object has no attribute 'function'\n" != ''                                                                                                    
---------------

I tried with pydebug and without pydebug.
msg103439 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2010-04-17 22:01
Oops, my last message (msg103435) was for #8434, not this issue. Anyway, #8434 is a duplicate of #8279, it doesn't matter.
History
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52528
2010-04-17 22:01:02vstinnersetmessages: + msg103439
2010-04-17 21:40:13vstinnersetfiles: + test_gdb.patch

nosy: + vstinner
messages: + msg103435

keywords: + patch
2010-04-01 17:57:37pitrousetstatus: open -> closed
resolution: fixed
messages: + msg102115

stage: needs patch -> resolved
2010-04-01 17:50:45dmalcolmsetmessages: + msg102114
2010-04-01 17:24:24pitrousetmessages: + msg102111
2010-04-01 17:14:17floxsetpriority: normal
keywords: + buildbot
2010-04-01 17:13:10dmalcolmsetmessages: + msg102108
2010-04-01 16:44:55pitroucreate