aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-events.exp
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2017-01-26 16:12:12 -0500
committerSimon Marchi <simon.marchi@ericsson.com>2017-01-26 16:12:12 -0500
commit72ca04104418e4926790872a203f404af9453024 (patch)
treee1315a30ae264a92846f1c92b83ecb7b9b15df71 /gdb/testsuite/gdb.python/py-events.exp
parente3ceef3544fb2178cef284b5fb8b267bf0ab4397 (diff)
downloadgdb-72ca04104418e4926790872a203f404af9453024.zip
gdb-72ca04104418e4926790872a203f404af9453024.tar.gz
gdb-72ca04104418e4926790872a203f404af9453024.tar.bz2
Change method of loading .py files in Python tests
With my debug build of Python (--with-pydebug), many tests fails because of the same issue. Python scripts are loaded by the tests using this pattern: (gdb) python exec (open ('file.py').read ()) This causes Python to output this warning: __main__:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='file.py' mode='r' encoding='ANSI_X3.4-1968'> and the test to fail because of that extra output. Instead of using the open + read + exec trick which leaks the file and causes the warning, why not just source the files? (gdb) source file.py This patch changes this, and standardizes the test names of the tests I touched to "load python file" (some of them were empty, others were overly complicated). gdb/testsuite/ChangeLog: * gdb.python/py-bad-printers.exp: Load python file using "source". * gdb.python/py-events.exp: Likewise. * gdb.python/py-evsignal.exp: Likewise. * gdb.python/py-evthreads.exp: Likewise. * gdb.python/py-frame-args.exp: Likewise. * gdb.python/py-framefilter-invalidarg.exp: Likewise. * gdb.python/py-framefilter-mi.exp: Likewise. * gdb.python/py-framefilter.exp: Likewise. * gdb.python/py-mi.exp: Likewise. * gdb.python/py-pp-maint.exp: Likewise. * gdb.python/py-pp-registration.exp: Likewise. * gdb.python/py-prettyprint.exp: Likewise. (run_lang_tests): Likewise. * gdb.python/py-typeprint.exp: Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-events.exp')
-rw-r--r--gdb/testsuite/gdb.python/py-events.exp2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 12936f3..16ea110 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -43,7 +43,7 @@ clean_restart ${testfile}
if { [skip_python_tests] } { continue }
-gdb_test_no_output "python exec (open ('${pyfile}').read ())" ""
+gdb_test_no_output "source ${pyfile}" "load python file"
gdb_test "test-objfile-events" "Object file events registered."