2017-01-01 07:50:51 +01:00
|
|
|
# Copyright 2011-2017 Free Software Foundation, Inc.
|
2011-10-05 16:23:37 +02:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
# This file was written by Pierre Muller <muller@ics.u-strasbg.fr>
|
|
|
|
#
|
|
|
|
# Check if environment variables are correctly passed to inferiors
|
|
|
|
#
|
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# Can't pass environment variables to the inferior if when we connect,
|
|
|
|
# the inferior is already running.
|
|
|
|
if [target_info exists use_gdb_stub] {
|
|
|
|
return
|
2011-11-30 09:25:17 +01:00
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
|
test suite update - gdb.base/[t-z]
Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
Use standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
2013-06-27 21:00:47 +02:00
|
|
|
standard_testfile .c
|
2011-10-05 16:23:37 +02:00
|
|
|
|
|
|
|
# Compile binary
|
|
|
|
# and start with a fresh gdb
|
|
|
|
|
2016-12-23 17:52:18 +01:00
|
|
|
if { [prepare_for_testing "failed to prepare" ${binfile} ${srcfile}] } {
|
2011-10-05 16:23:37 +02:00
|
|
|
return -1
|
|
|
|
}
|
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# Test that the the inferior sees EXPECTED env vars starting with
|
|
|
|
# "TEST_GDB".
|
|
|
|
proc test_num_test_vars {expected message} {
|
|
|
|
set num [get_integer_valueof "j" -1 "$message, get num vars"]
|
|
|
|
gdb_assert {$num == $expected} "$message, confirmed"
|
2011-10-05 16:23:37 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
set bp_line [gdb_get_line_number "set breakpoint here"]
|
|
|
|
gdb_breakpoint $bp_line
|
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# Restart test program, and prepare for another test sequence.
|
|
|
|
# Returns true on success.
|
|
|
|
proc run_and_count_vars {} {
|
|
|
|
global srcfile bp_line
|
|
|
|
|
|
|
|
return [runto "$srcfile:$bp_line"]
|
|
|
|
}
|
|
|
|
|
|
|
|
# Find environment variable named VARNAME (peeking inferior variables
|
|
|
|
# directly), and return its value. Returns "<not found>" if not
|
|
|
|
# found.
|
|
|
|
|
|
|
|
proc find_env {varname} {
|
|
|
|
global gdb_prompt
|
|
|
|
|
|
|
|
for {set i 0} {1} {incr i} {
|
|
|
|
set test "printf \"var: %s\\n\", envp\[$i\] ? envp\[$i\] : \"\""
|
|
|
|
set var ""
|
|
|
|
gdb_test_multiple $test $test {
|
|
|
|
-re "var: \r\n$gdb_prompt $" {
|
|
|
|
return "<not found>"
|
|
|
|
}
|
|
|
|
-re "var: \(\[^\r\n\]*\)\r\n$gdb_prompt $" {
|
|
|
|
set var $expect_out(1,string)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if {[string match "$varname=*" $var]} {
|
|
|
|
set from [expr [string first "=" $var] + 1]
|
|
|
|
set to [string length $var]
|
|
|
|
return [string range $var $from $to]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-05 16:23:37 +02:00
|
|
|
#
|
|
|
|
# Test gdb set/unset environment commands.
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# The executable lists and counts all environment variables
|
2011-10-05 16:23:37 +02:00
|
|
|
# starting with TEST_GDB.
|
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
proc_with_prefix test_set_unset_env {} {
|
|
|
|
global binfile
|
|
|
|
|
|
|
|
clean_restart $binfile
|
|
|
|
|
|
|
|
# First test with no TEST_GDB_VAR.
|
|
|
|
with_test_prefix "test1" {
|
|
|
|
if ![run_and_count_vars] {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
test_num_test_vars 0 "no TEST_GDB vars"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Second test with one TEST_GDB_VAR.
|
|
|
|
with_test_prefix "test2" {
|
|
|
|
gdb_test_no_output "set env TEST_GDB_VAR1 test1" \
|
|
|
|
"set TEST_GDB_VAR1"
|
|
|
|
|
|
|
|
if ![run_and_count_vars] {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
test_num_test_vars 1 "one TEST_GDB var"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Third test with two TEST_GDB_VAR.
|
|
|
|
with_test_prefix "test3" {
|
|
|
|
gdb_test_no_output "set env TEST_GDB_VAR2 test2" \
|
|
|
|
"set TEST_GDB_VAR2"
|
|
|
|
|
|
|
|
if ![run_and_count_vars] {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
test_num_test_vars 2 "two TEST_GDB var"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Fourth test with one TEST_GDB_VAR left, after one was removed
|
|
|
|
# with unset command.
|
|
|
|
with_test_prefix "test4" {
|
|
|
|
gdb_test_no_output "unset env TEST_GDB_VAR1" \
|
|
|
|
"unset TEST_GDB_VAR1"
|
|
|
|
|
|
|
|
if ![run_and_count_vars] {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
test_num_test_vars 1 "one TEST_GDB var, after unset"
|
|
|
|
}
|
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
proc_with_prefix test_inherit_env_var {} {
|
|
|
|
global binfile
|
|
|
|
global bp_line
|
|
|
|
global env
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# This test assumes that the build's environ (where dejagnu runs)
|
|
|
|
# is the same as the host's (where gdb runs) environ.
|
|
|
|
if [is_remote host] {
|
|
|
|
return
|
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
save_vars {env(TEST_GDB_GLOBAL)} {
|
|
|
|
set env(TEST_GDB_GLOBAL) "Global environment value"
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
clean_restart $binfile
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
gdb_breakpoint $bp_line
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# First test with only inherited TEST_GDB_GLOBAL.
|
|
|
|
with_test_prefix "test1" {
|
|
|
|
if ![run_and_count_vars] {
|
|
|
|
return
|
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
gdb_test "show env" ".*TEST_GDB_GLOBAL=.*" \
|
|
|
|
"test passing TEST_GDB_GLOBAL to GDB"
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
test_num_test_vars 1 "TEST_GDB_GLOBAL"
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
set var [find_env "TEST_GDB_GLOBAL"]
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
gdb_assert {[string equal $var "Global environment value"]} \
|
|
|
|
"TEST_GDB_GLOBAL found with right value"
|
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
# Second test with one TEST_GDB_VAR.
|
|
|
|
with_test_prefix "test2" {
|
|
|
|
gdb_test_no_output "unset env TEST_GDB_GLOBAL" \
|
|
|
|
"unset TEST_GDB_GLOBAL"
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
if ![run_and_count_vars] {
|
|
|
|
return
|
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
test_num_test_vars 0 "TEST_GDB_GLOBAL is unset"
|
|
|
|
}
|
|
|
|
}
|
2011-10-05 16:23:37 +02:00
|
|
|
}
|
|
|
|
|
Fix gdb.base/testenv.exp against --target_board=native-extended-gdbserver
Currently we get:
Running ..../src/gdb/testsuite/gdb.base/testenv.exp ...
FAIL: gdb.base/testenv.exp: test no TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var
FAIL: gdb.base/testenv.exp: test with two TEST_GDB var
FAIL: gdb.base/testenv.exp: test with one TEST_GDB var, after unset
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL
FAIL: gdb.base/testenv.exp: test with TEST_GDB_GLOBAL unset
The problem is that the testcase relies on stdio. While we could fix
this for gdbserver by read output from inferior_spawn_id, a better fix
it to not rely on stdio at all. That's what this commit does.
Instead, it reads variables off of the inferior to extract the
necessary information.
Along the way, most of the .exp file is reimplemented/cleaned up using
more modern mechanisms. E.g., with_test_prefix, proc_with_prefix,
save_vars, etc. Also, a missing check for "is_remote host" is added.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/testenv.exp: Check use_gdb_stub instead of is_remote.
(test_num_test_vars, run_and_count_vars, find_env)
(test_set_unset_env, test_inherit_env_var): New procedures.
(top level): Use them.
2017-10-12 19:27:20 +02:00
|
|
|
test_set_unset_env
|
|
|
|
test_inherit_env_var
|