From 5ad2694b1ebe123ea92fcee094a69bcdc9769985 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 28 Oct 2021 14:18:15 +0200 Subject: [PATCH] [gdb/testsuite] Require python in gdb.server/server-kill-python.exp I came across this when running test-case gdb.server/server-kill-python.exp with a gdb configured without python: ... builtin_spawn gdb -nw -nx -data-directory data-directory -iex set height 0 \ -iex set width 0 -quiet -iex set height 0 -iex set width 0 \ -ex source outputs/gdb.server/server-kill-python/file1.py^M FAIL: gdb.server/server-kill-python.exp: ensure inferior is running Executing on target: kill -9 28535 (timeout = 300) builtin_spawn -ignore SIGHUP kill -9 28535^M file1.py:1: Error in sourced command file:^M Undefined command: "import". Try "help".^M ... Fix this by testing for python support in the test-case. Tested on aarch64-linux (with python support disabled) and x86_64-linux (with python support enabled). --- gdb/testsuite/gdb.server/server-kill-python.exp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp index 0a41df0fd3b..3e58c514e4c 100644 --- a/gdb/testsuite/gdb.server/server-kill-python.exp +++ b/gdb/testsuite/gdb.server/server-kill-python.exp @@ -27,6 +27,14 @@ if {[skip_gdbserver_tests]} { return 0 } +# Gdb needs to be running for skip_python_tests, but exit once we're done, +# we'll start a custom gdb after this. +clean_restart +if { [skip_python_tests] } { + return 0 +} +gdb_exit + if {[build_executable "failed to prepare" ${testfile} \ ${srcfile}] == -1} { return -1 -- 2.30.2