[PATCH 7/57][Arm][GAS] Add support for MVE instructions: vstr/vldr
[binutils-gdb.git] / gdb / testsuite / gdb.base / history-duplicates.exp
blob8d443bc8a0796bfda4568fa77c02f434b598accd
1 # Copyright 2015-2019 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 # This file is part of the gdb testsuite.
18 # Test the operation of the "history remove-duplicates" option.
21 # Check that the previous history entry is ENTRY.
23 proc check_prev_history_entry { entry { test_suffix "" } } {
24     set test_name "history entry is $entry"
25     if { $test_suffix != "" } {
26         append test_name " $test_suffix"
27     }
29     # Send ^P followed by ^L.
30     send_gdb "\x10\x0c"
32     gdb_expect {
33         -re $entry {
34             pass $test_name
35         }
36         timeout {
37             fail $test_name
38         }
39     }
42 # Foreach element ELT in THINGS, run the command "print $ELT", making sure that
43 # each invocation of "print" has a unique test name.
45 proc run_print_on_each_thing { things } {
46     set index 0
48     foreach thing $things {
49         gdb_test "print $thing" "" "printing $thing (item #$index)"
50         incr index
51     }
54 gdb_exit
55 gdb_start
57 # These tests require readline support.
58 if { ![readline_is_used] } {
59     unsupported "readline isn't used."
60     return -1
63 # By default the option is set to 0.
64 gdb_test "show history remove-duplicates" "is 0\\."
66 # Test the "unlimited" setting.
67 with_test_prefix "remove-duplicates=unlimited" {
68     gdb_exit
69     gdb_start
70     gdb_test "set history remove-duplicates unlimited"
72     run_print_on_each_thing { 0 1 2 1 1 2 3 3 4 1 2 3 4 }
74     check_prev_history_entry "print 4"
75     check_prev_history_entry "print 3"
76     check_prev_history_entry "print 2"
77     check_prev_history_entry "print 1"
78     check_prev_history_entry "print 0"
82 # Test the "1" setting.
83 with_test_prefix "remove-duplicates=1" {
84     gdb_exit
85     gdb_start
86     gdb_test "set history remove-duplicates 1"
88     run_print_on_each_thing { 0 1 0 2 2 1 }
90     check_prev_history_entry "print 1"
91     check_prev_history_entry "print 2"
92     check_prev_history_entry "print 0"
93     check_prev_history_entry "print 1" "(again)"
94     check_prev_history_entry "print 0" "(again)"
98 # Test the "0" setting.
99 with_test_prefix "remove-duplicates=0" {
100     gdb_exit
101     gdb_start
102     gdb_test "set history remove-duplicates 0"
104     run_print_on_each_thing { 0 0 1 1 }
106     check_prev_history_entry "print 1"
107     check_prev_history_entry "print 1" "(again)"
108     check_prev_history_entry "print 0"
109     check_prev_history_entry "print 0" "(again)"
113 # Test the "2" setting.
114 with_test_prefix "remove-duplicates=2" {
115     gdb_exit
116     gdb_start
117     gdb_test "set history remove-duplicates 2"
119     run_print_on_each_thing { 1 2 0 2 0 }
121     check_prev_history_entry "print 0"
122     check_prev_history_entry "print 2"
123     check_prev_history_entry "print 1"