binutils-gdb/gdb/testsuite/gdb.python
Simon Marchi 72ca041044 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.
2017-01-26 16:12:12 -05:00
..
amd64-py-framefilter-invalidarg.S update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
lib-types.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
lib-types.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-arch.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-arch.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-as-string.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-as-string.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-bad-printers.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-bad-printers.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-bad-printers.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-block.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-block.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-breakpoint-create-fail.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-breakpoint-create-fail.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-breakpoint-create-fail.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-breakpoint.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-breakpoint.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-caller-is.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-caller-is.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-cmd.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-cmd.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-completion.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-completion.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-error.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-error.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-events-shlib.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-events.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-events.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-events.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-evsignal.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-evthreads.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-evthreads.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-explore-cc.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-explore.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-explore.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-explore.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-finish-breakpoint.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-finish-breakpoint.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-finish-breakpoint.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-finish-breakpoint2.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-finish-breakpoint2.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-finish-breakpoint2.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-frame-args.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-frame-args.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-frame-args.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-frame-inline.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-frame-inline.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-frame.c
py-frame.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-framefilter-gdb.py.in update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-framefilter-invalidarg-gdb.py.in update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-framefilter-invalidarg.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-framefilter-invalidarg.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-framefilter-mi.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-framefilter-mi.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-framefilter.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-framefilter.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-framefilter.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-function.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-inferior.c
py-inferior.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-infthread.c
py-infthread.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-lazy-string.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-lazy-string.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-linetable.S update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-linetable.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-linetable.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-lookup-type.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi-events-gdb.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi-events.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi-events.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi-objfile-gdb.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi-objfile.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi-objfile.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-mi.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-objfile-script-gdb.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-objfile-script.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-objfile-script.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-objfile.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-objfile.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-parameter.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-integral.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-integral.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-integral.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-maint.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-maint.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-pp-maint.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-re-notag.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-re-notag.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-re-notag.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-registration.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-pp-registration.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-pp-registration.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-prettyprint.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-prettyprint.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-prettyprint.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-progspace.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-progspace.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-prompt.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-prompt.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-recurse-unwind.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-recurse-unwind.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-recurse-unwind.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-section-script.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-section-script.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-section-script.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-shared-sl.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-shared.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-shared.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-strfns.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-strfns.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-symbol.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-symbol.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-symtab.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-sync-interp.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-sync-interp.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-template.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-template.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-type.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-type.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-typeprint.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-typeprint.exp Change method of loading .py files in Python tests 2017-01-26 16:12:12 -05:00
py-typeprint.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-unwind-maint.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-unwind-maint.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-unwind-maint.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-unwind.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-unwind.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-unwind.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-value-cc.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-value-cc.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-value.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-value.exp update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-xmethods.cc update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-xmethods.exp Fix uppercase test names in gdb.python/py-xmethods.exp 2017-01-20 13:58:40 -06:00
py-xmethods.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
python-1.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
python.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
python.exp Make gdb.python/python.exp more robust 2017-01-20 13:15:36 -06:00
source1 update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
source2.py update copyright year range in GDB files 2017-01-01 10:52:34 +04:00