-# Copyright 2015 Free Software Foundation, Inc.
+# Copyright 2015-2020 Free Software Foundation, Inc.
# 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
# Test the setting of "history size" via the GDBHISTSIZE environment variable
+# We cannot expect remote hosts to see environment variables set on the
+# local machine.
+
+if { [is_remote host] } {
+ unsupported "can't set environment variables on remote host"
+ return -1
+}
+
# Check that the history size is properly set to SIZE when the environment
# variable ENV_VAR is set to GDBHISTSIZE.
proc test_histsize_history_setting { histsize size { env_var "GDBHISTSIZE" } } {
global env
- save_vars { env($env_var) } {
+ save_vars { env(GDBHISTFILE) env(GDBHISTSIZE) env($env_var) } {
+ # These environment variables take precedence over whatever
+ # history size is set in .gdbinit. Make sure the former is not
+ # set.
+ unset -nocomplain env(GDBHISTFILE)
+ unset -nocomplain env(GDBHISTSIZE)
+
set env($env_var) $histsize
with_test_prefix "histsize=$histsize" {