diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9b446afb384..a74ac524d2c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2015-05-19 Pedro Alves + + * gdb.base/gdbinit-history.exp (test_gdbinit_history_setting): + Save the whole env array instead of just HOME. Unset HISTSIZE in + the environment while testing. Restore whole environment + afterwards. + 2015-05-16 Doug Evans * gdb.guile/scm-ports.c: New file. diff --git a/gdb/testsuite/gdb.base/gdbinit-history.exp b/gdb/testsuite/gdb.base/gdbinit-history.exp index 474680a7e13..aba15b45158 100644 --- a/gdb/testsuite/gdb.base/gdbinit-history.exp +++ b/gdb/testsuite/gdb.base/gdbinit-history.exp @@ -27,8 +27,15 @@ proc test_gdbinit_history_setting { home size } { global srcdir global subdir - set old_home $env(HOME) + array set old_env [array get env] + set env(HOME) "$srcdir/$subdir/$home" + + # The HISTSIZE environment variable takes precedence over whatever + # history size is set in .gdbinit. Make sure the former is not + # set. + unset -nocomplain env(HISTSIZE) + set saved_internal_gdbflags $INTERNAL_GDBFLAGS set INTERNAL_GDBFLAGS [string map {"-nx" ""} $INTERNAL_GDBFLAGS] @@ -44,7 +51,8 @@ proc test_gdbinit_history_setting { home size } { } set INTERNAL_GDBFLAGS $saved_internal_gdbflags - set $env(HOME) $old_home + + array set env [array get old_env] } test_gdbinit_history_setting "gdbinit-history/unlimited" "unlimited"