From 314bb8c368cda35590c589cafae49b05dd434513 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Wed, 4 Sep 2013 23:49:21 +0000 Subject: [PATCH] * gdb.python/py-events.py (exit_handler): Verify we get the expected event. (continue_handler, new_objfile_handler): Ditto. (test_events): Rename command to "test-events". (test_newobj_events): Rename command to "test-objfile-events". * gdb.python/py-events.exp: Update. * gdb.python/py-evsignal.exp: Update. * gdb.python/py-evthreads.exp: Update. --- gdb/testsuite/ChangeLog | 9 +++++++++ gdb/testsuite/gdb.python/py-events.exp | 4 ++-- gdb/testsuite/gdb.python/py-events.py | 24 +++++++++++------------ gdb/testsuite/gdb.python/py-evsignal.exp | 2 +- gdb/testsuite/gdb.python/py-evthreads.exp | 2 +- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cfa5590475b..499784e5edb 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2013-09-04 Doug Evans + * gdb.python/py-events.py (exit_handler): Verify we get the expected + event. + (continue_handler, new_objfile_handler): Ditto. + (test_events): Rename command to "test-events". + (test_newobj_events): Rename command to "test-objfile-events". + * gdb.python/py-events.exp: Update. + * gdb.python/py-evsignal.exp: Update. + * gdb.python/py-evthreads.exp: Update. + * gdb.base/enumval.c (ZERO): New enum value. (main): Use it * gdb.base/enumval.exp: Test ability to print ZERO. diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp index 7bd6562066a..390a2bad30b 100644 --- a/gdb/testsuite/gdb.python/py-events.exp +++ b/gdb/testsuite/gdb.python/py-events.exp @@ -45,7 +45,7 @@ if { [skip_python_tests] } { continue } gdb_test_no_output "python exec (open ('${pyfile}').read ())" "" -gdb_test "Test_Newobj_Events" "New ObjectFile Event tester registered." "Register new objfile event handler" +gdb_test "test-objfile-events" "Object file events registered." gdb_breakpoint "main" {temporary} @@ -53,7 +53,7 @@ gdb_test "run" ".*event type: new_objfile.*new objfile name.*" "New objfile noti gdb_test_no_output "set detach-on-fork off" "" -gdb_test "Test_Events" "Event testers registered." +gdb_test "test-events" "Event testers registered." gdb_breakpoint "first" gdb_breakpoint "first" diff --git a/gdb/testsuite/gdb.python/py-events.py b/gdb/testsuite/gdb.python/py-events.py index bfab78e6043..6c6dcda8140 100644 --- a/gdb/testsuite/gdb.python/py-events.py +++ b/gdb/testsuite/gdb.python/py-events.py @@ -40,31 +40,29 @@ def breakpoint_stop_handler (event): print ("all threads stopped") def exit_handler (event): - if (isinstance (event, gdb.ExitedEvent)): - print ("event type: exit") + assert (isinstance (event, gdb.ExitedEvent)) + print ("event type: exit") print ("exit code: %d" % (event.exit_code)) print ("exit inf: %d" % (event.inferior.num)) print ("dir ok: %s" % str('exit_code' in dir(event))) def continue_handler (event): - if (isinstance (event, gdb.ContinueEvent)): - print ("event type: continue") + assert (isinstance (event, gdb.ContinueEvent)) + print ("event type: continue") if ( event.inferior_thread is not None) : print ("thread num: %s" % (event.inferior_thread.num)) def new_objfile_handler (event): - if (isinstance (event, gdb.NewObjFileEvent)): - print ("event type: new_objfile") - if (event.new_objfile is not None): - print ("new objfile name: %s" % (event.new_objfile.filename)) - else: - print ("new objfile is None") + assert (isinstance (event, gdb.NewObjFileEvent)) + print ("event type: new_objfile") + print ("new objfile name: %s" % (event.new_objfile.filename)) + print ("inferior number: %d" % (event.inferior.num)) class test_events (gdb.Command): """Test events.""" def __init__ (self): - gdb.Command.__init__ (self, "test_events", gdb.COMMAND_STACK) + gdb.Command.__init__ (self, "test-events", gdb.COMMAND_STACK) def invoke (self, arg, from_tty): gdb.events.stop.connect (signal_stop_handler) @@ -79,10 +77,10 @@ class test_newobj_events (gdb.Command): """NewObj events.""" def __init__ (self): - gdb.Command.__init__ (self, "test_newobj_events", gdb.COMMAND_STACK) + gdb.Command.__init__ (self, "test-objfile-events", gdb.COMMAND_STACK) def invoke (self, arg, from_tty): gdb.events.new_objfile.connect (new_objfile_handler) - print ("New ObjectFile Event tester registered.") + print ("Object file events registered.") test_newobj_events () diff --git a/gdb/testsuite/gdb.python/py-evsignal.exp b/gdb/testsuite/gdb.python/py-evsignal.exp index c71cc6ac067..d70274201fa 100644 --- a/gdb/testsuite/gdb.python/py-evsignal.exp +++ b/gdb/testsuite/gdb.python/py-evsignal.exp @@ -33,7 +33,7 @@ if { [skip_python_tests] } { continue } gdb_test_no_output "python exec (open ('${pyfile}').read ())" "" -gdb_test "Test_Events" "Event testers registered." +gdb_test "test-events" "Event testers registered." gdb_test_no_output "set non-stop on" gdb_test_no_output "set target-async on" diff --git a/gdb/testsuite/gdb.python/py-evthreads.exp b/gdb/testsuite/gdb.python/py-evthreads.exp index 8bf8ee9a953..a25df46017b 100644 --- a/gdb/testsuite/gdb.python/py-evthreads.exp +++ b/gdb/testsuite/gdb.python/py-evthreads.exp @@ -38,7 +38,7 @@ if { [skip_python_tests] } { continue } gdb_test_no_output "python exec (open ('${pyfile}').read ())" "" -gdb_test "Test_Events" "Event testers registered." +gdb_test "test-events" "Event testers registered." gdb_test_no_output "set non-stop on" gdb_test_no_output "set target-async on" -- 2.30.2