diff options
Diffstat (limited to 'gdb/testsuite/gdb.testsuite')
-rw-r--r-- | gdb/testsuite/gdb.testsuite/board-sanity.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/capture-command-output.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/cond-wrap.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/dump-system-info.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/gdb-test.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp | 84 | ||||
-rwxr-xr-x | gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb | 25 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/lmap.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/parse_options_args.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/string-cat.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/string_to_regexp.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/version-compare.exp | 74 | ||||
-rw-r--r-- | gdb/testsuite/gdb.testsuite/with-override.exp | 2 |
16 files changed, 196 insertions, 13 deletions
diff --git a/gdb/testsuite/gdb.testsuite/board-sanity.exp b/gdb/testsuite/gdb.testsuite/board-sanity.exp index acf37df..9c80282 100644 --- a/gdb/testsuite/gdb.testsuite/board-sanity.exp +++ b/gdb/testsuite/gdb.testsuite/board-sanity.exp @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Free Software Foundation, Inc. +# Copyright 2023-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/capture-command-output.exp b/gdb/testsuite/gdb.testsuite/capture-command-output.exp index 6828291..67d7b18 100644 --- a/gdb/testsuite/gdb.testsuite/capture-command-output.exp +++ b/gdb/testsuite/gdb.testsuite/capture-command-output.exp @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Free Software Foundation, Inc. +# Copyright 2022-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/cond-wrap.exp b/gdb/testsuite/gdb.testsuite/cond-wrap.exp index 3005b36..bc29c5a 100644 --- a/gdb/testsuite/gdb.testsuite/cond-wrap.exp +++ b/gdb/testsuite/gdb.testsuite/cond-wrap.exp @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Free Software Foundation, Inc. +# Copyright 2022-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/dump-system-info.exp b/gdb/testsuite/gdb.testsuite/dump-system-info.exp index 353f366..143f363 100644 --- a/gdb/testsuite/gdb.testsuite/dump-system-info.exp +++ b/gdb/testsuite/gdb.testsuite/dump-system-info.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp b/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp index 2944273..03a2f68 100644 --- a/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp +++ b/gdb/testsuite/gdb.testsuite/foreach_with_prefix.exp @@ -1,4 +1,4 @@ -# Copyright 2019-2024 Free Software Foundation, Inc. +# Copyright 2019-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp b/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp index 572ffb5..0957dbd 100644 --- a/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp +++ b/gdb/testsuite/gdb.testsuite/gdb-caching-proc-consistency.exp @@ -1,4 +1,4 @@ -# Copyright 2018-2024 Free Software Foundation, Inc. +# Copyright 2018-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp b/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp index 0b7cfae..f9610af 100644 --- a/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp +++ b/gdb/testsuite/gdb.testsuite/gdb-caching-proc.exp @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Free Software Foundation, Inc. +# Copyright 2023-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/gdb-test.exp b/gdb/testsuite/gdb.testsuite/gdb-test.exp index a8aa53c..95555f8 100644 --- a/gdb/testsuite/gdb.testsuite/gdb-test.exp +++ b/gdb/testsuite/gdb.testsuite/gdb-test.exp @@ -1,4 +1,4 @@ -# Copyright 2022-2024 Free Software Foundation, Inc. +# Copyright 2022-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp new file mode 100644 index 0000000..a05ce61 --- /dev/null +++ b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.exp @@ -0,0 +1,84 @@ +# Copyright 2025 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/>. + +# Test gdb_test_multiple -lbl, particularly with patterns that share a +# common prefix. + +standard_testfile + +clean_restart + +gdb_test_no_output "source ${srcdir}/${subdir}/$testfile.gdb" \ + "source gdb test script" + +set saw_prompt 0 +set saw_prefix 0 +set saw_command 0 +set saw_prefix_foo 0 +set saw_prefix_bar 0 + +# #1 - We need anchors so that the "prefix foo" pattern below does not +# match when the expect output buffer contains: +# +# "\r\nprefix xxx\r\n\prefix foo\r\n" +# +# #2 - We need an anchor on the prompt match as otherwise the prompt +# regexp would match: +# +# "\r\nmeant-to-be-matched-by-lbl-2\r\nprefix xxx\r\n(gdb) " +# +# This test would fail if -lbl did not force the built-in prompt match +# regexp to have an anchor as well, as without it, the built-in prompt +# regexp would have the exact same issue as #2 above. + +gdb_test_multiple "command" "" -lbl { + -re "^command(?=\r\n)" { + verbose -log <COMMAND> + incr saw_command + exp_continue + } + -re "^\r\nprefix foo(?=\r\n)" { + verbose -log <PREFIX-FOO> + incr saw_prefix_foo + exp_continue + } + -re "^\r\nprefix bar(?=\r\n)" { + verbose -log <PREFIX-BAR> + incr saw_prefix_bar + exp_continue + } + -re "^\r\nprefix \[^\r\n\]*(?=\r\n)" { + verbose -log <PREFIX> + incr saw_prefix + exp_continue + } + -re "^\r\n$gdb_prompt $" { + verbose -log <PROMPT> + incr saw_prompt + pass $gdb_test_name + } +} + +verbose -log "saw_command: $saw_command" +verbose -log "saw_prefix_foo: $saw_prefix_foo" +verbose -log "saw_prefix_bar: $saw_prefix_bar" +verbose -log "saw_prefix: $saw_prefix" +verbose -log "saw_prompt: $saw_prompt" + +gdb_assert {$saw_command == 1} +gdb_assert {$saw_prefix_foo == 1} +gdb_assert {$saw_prefix_bar == 1} +gdb_assert {$saw_prefix == 3} +gdb_assert {$saw_prompt == 1} diff --git a/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb new file mode 100755 index 0000000..8c94dfa --- /dev/null +++ b/gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb @@ -0,0 +1,25 @@ +# Copyright 2025 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/>. + +define command + echo prefix xxx\n + echo meant-to-be-matched-by-lbl-1\n + echo prefix foo\n + echo prefix bar\n + echo meant-to-be-matched-by-lbl-2\n + echo prefix xxx\n + echo prefix xxx\n + echo meant-to-be-matched-by-lbl-3\n +end diff --git a/gdb/testsuite/gdb.testsuite/lmap.exp b/gdb/testsuite/gdb.testsuite/lmap.exp index 736f670..da03722 100644 --- a/gdb/testsuite/gdb.testsuite/lmap.exp +++ b/gdb/testsuite/gdb.testsuite/lmap.exp @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Free Software Foundation, Inc. +# Copyright 2023-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/parse_options_args.exp b/gdb/testsuite/gdb.testsuite/parse_options_args.exp index 7239ef7..22a54a7 100644 --- a/gdb/testsuite/gdb.testsuite/parse_options_args.exp +++ b/gdb/testsuite/gdb.testsuite/parse_options_args.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/string-cat.exp b/gdb/testsuite/gdb.testsuite/string-cat.exp index 057aeb2..94136e3 100644 --- a/gdb/testsuite/gdb.testsuite/string-cat.exp +++ b/gdb/testsuite/gdb.testsuite/string-cat.exp @@ -1,4 +1,4 @@ -# Copyright 2024 Free Software Foundation, Inc. +# Copyright 2024-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/string_to_regexp.exp b/gdb/testsuite/gdb.testsuite/string_to_regexp.exp index 4cafce3..0cb5296 100644 --- a/gdb/testsuite/gdb.testsuite/string_to_regexp.exp +++ b/gdb/testsuite/gdb.testsuite/string_to_regexp.exp @@ -1,4 +1,4 @@ -# Copyright 2021-2024 Free Software Foundation, Inc. +# Copyright 2021-2025 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 diff --git a/gdb/testsuite/gdb.testsuite/version-compare.exp b/gdb/testsuite/gdb.testsuite/version-compare.exp new file mode 100644 index 0000000..8f2573e --- /dev/null +++ b/gdb/testsuite/gdb.testsuite/version-compare.exp @@ -0,0 +1,74 @@ +# Copyright 2025 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/>. + +# Check version_compare proc. + +proc eq { a b } { + with_test_prefix "$a == $b" { + gdb_assert { [version_compare $a == $b] } + gdb_assert { [version_compare $a <= $b] } + gdb_assert { [version_compare $a >= $b] } + gdb_assert { ![version_compare $a < $b] } + gdb_assert { ![version_compare $a > $b] } + } +} + +proc lt { a b } { + with_test_prefix "$a < $b" { + gdb_assert { [version_compare $a < $b] } + gdb_assert { [version_compare $a <= $b] } + gdb_assert { [version_compare $b > $a] } + gdb_assert { [version_compare $b >= $a] } + gdb_assert { ![version_compare $a == $b] } + gdb_assert { ![version_compare $b == $a] } + gdb_assert { ![version_compare $a > $b] } + gdb_assert { ![version_compare $a >= $b] } + gdb_assert { ![version_compare $b < $a] } + gdb_assert { ![version_compare $b <= $a] } + } +} + +# Equal, same length. +eq {1 0} {1 0} + +# Smaller than, same length. +lt {1 0} {1 1} +lt {1 1} {2 0} + +# Smaller than, different length. +lt {1 3} {2} +lt {1} {2 0} + +# The question how v1 and v1.0 relate to each other is not a trivial one. +# +# For instance, Python considers v1 == v1.0: +# $ test.py +# #!/usr/bin/python3 +# from packaging.version import parse +# v1_0 = parse("1.0") +# v1 = parse("1") +# print (v1 == v1_0) +# $ ./test.py +# True +# +# OTOH, version sort from coreutils considers v1 < v1.0: +# $ cat bla.txt +# 1.0 +# 1 +# $ sort -V bla.txt +# 1 +# 1.0 +# +# Proc version_compare seems to have taken the latter approach. +lt {1} {1 0} diff --git a/gdb/testsuite/gdb.testsuite/with-override.exp b/gdb/testsuite/gdb.testsuite/with-override.exp index a0a4962..9180150 100644 --- a/gdb/testsuite/gdb.testsuite/with-override.exp +++ b/gdb/testsuite/gdb.testsuite/with-override.exp @@ -1,4 +1,4 @@ -# Copyright 2023-2024 Free Software Foundation, Inc. +# Copyright 2023-2025 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 |