binutils-gdb/gdb/testsuite/gdb.base/inferior-clone.exp
Lancelot SIX 1f927a4a28 gdb: Fix copyright year in gdb/testsuite/gdb.base/inferior-clone.exp
I just realized that I forgot to update the year before pushing the
patch that created this file.  Since it landed after the global
copyright year update have been done, this file’s copyright year is
updated.

This patch fixes that.

Change-Id: I280f7d86e02d38425f7afdcf19a1c3500d51c23f
2022-01-06 06:59:25 -05:00

94 lines
3.9 KiB
Plaintext

# Copyright (C) 2021-2022 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
# 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 testcase checks that the clone-inferior command copies important
# properties from the original to the new inferior such CWD, args and env.
# Add an environment variable that can be modified later for each inferior
# in GDB.
set env(ENVVAR) var
# This test does not need a binfile.
clean_restart
# Set custom properties for Inferior 1
with_test_prefix "setup inferior 1" {
gdb_test_no_output "set args foo bar 'b a z'"
gdb_test_no_output "set cwd /any/where"
gdb_test_no_output "set environment FOO foo"
gdb_test_no_output "set environment BAR bar"
gdb_test_no_output "set inferior-tty some_tty"
}
# Check that properties of inferior 1 have been copied
with_test_prefix "inferior 2" {
gdb_test "clone-inferior" "Added inferior 2.*"
gdb_test "inferior 2" "\[Switching to inferior 2 \[<null>\] (.*)\]" "change inferior"
gdb_test "show args" \
"Argument list to give program being debugged when it is started is \"foo bar 'b a z'\"\."
gdb_test "show cwd" \
"Current working directory that will be used when starting the inferior is \"/any/where\"\."
gdb_test "show environment FOO" "FOO = foo"
gdb_test "show environment BAR" "BAR = bar"
gdb_test "show environment ENVVAR" "ENVVAR = var"
gdb_test "show inferior-tty" \
"Terminal for future runs of program being debugged is \"some_tty\"\."
}
# Change this second inferior, to check that the next clone-inferior
# clones from the active inferior, and changing the values for inferior 2
# does not interfere with values on inferior 1.
with_test_prefix "update inferior 2" {
gdb_test_no_output "set args foo"
gdb_test_no_output "set cwd /somewhere/else"
gdb_test_no_output "set environment FOO oof"
}
with_test_prefix "inferior 1" {
gdb_test "inferior 1" "\[Switching to inferior 1 \[<null>\] (.*)\]" "change inferior"
gdb_test "show args" \
"Argument list to give program being debugged when it is started is \"foo bar 'b a z'\"\."
gdb_test "show cwd" \
"Current working directory that will be used when starting the inferior is \"/any/where\"\."
gdb_test "show environment FOO" "FOO = foo"
gdb_test "show environment BAR" "BAR = bar"
gdb_test "show environment ENVVAR" "ENVVAR = var"
gdb_test "show inferior-tty" \
"Terminal for future runs of program being debugged is \"some_tty\"\."
}
# Tweak inferior 1 a bit more.
with_test_prefix "update inferior 1" {
gdb_test_no_output "unset environment FOO"
gdb_test_no_output "unset environment ENVVAR"
}
# Check that the values observed on inferior 3 are those copied from
# inferior 1.
with_test_prefix "inferior 3" {
gdb_test "clone-inferior" "Added inferior 3.*"
gdb_test "inferior 3" "\[Switching to inferior 3 \[<null>\] (.*)\]" "change inferior"
gdb_test "show args" \
"Argument list to give program being debugged when it is started is \"foo bar 'b a z'\"\."
gdb_test "show cwd" \
"Current working directory that will be used when starting the inferior is \"/any/where\"\."
gdb_test "show environment FOO" "Environment variable \"FOO\" not defined\."
gdb_test "show environment BAR" "BAR = bar"
gdb_test "show environment ENVVAR" "Environment variable \"ENVVAR\" not defined\."
gdb_test "show inferior-tty" \
"Terminal for future runs of program being debugged is \"some_tty\"\."
}