[gdb/testsuite] Capture many-headers.exp progress and output in gdb.log
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / endian.exp
CommitLineData
b811d2c2 1# Copyright (C) 2018-2020 Free Software Foundation, Inc.
4b2dfa9d
MR
2
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.
7#
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.
12#
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/>.
15
16# Test automatic endianness selection.
17
18standard_testfile
19
20set en_auto "The target endianness is set automatically"
21set en_set "The target is assumed to be"
22
23clean_restart
24
25# First check that the automatic endianness is updated
26# with the `set endian' command.
27gdb_test "set endian auto" \
28 "$en_auto \\\(currently \(\?:big\|little\) endian\\\)" \
29 "default target endianness"
30gdb_test "set endian big" "$en_set big endian" \
31 "set target endianness"
32gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
33 "auto target endianness"
34gdb_test "set endian little" "$en_set little endian" \
35 "set target endianness little"
36gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)" \
37 "auto target endianness little"
38gdb_test "set endian big" "$en_set big endian" \
39 "set target endianness big"
40gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
41 "auto target endianness big"
42
43if { [build_executable ${testfile}.exp $testfile] } {
44 gdb_suppress_entire_file "$pf_prefix cannot build executable"
45}
46
47if { [gdb_file_cmd $binfile] } {
48 gdb_suppress_entire_file "$pf_prefix cannot select executable"
49}
50set test "get target endianness"
51if { [gdb_test_multiple "show endian" "$test" {
52 -re "$en_auto \\\(currently \(big\|little\) endian\\\).*$gdb_prompt" {
53 set endian $expect_out(1,string)
54 pass "$test"
55 }
56}] } {
57 gdb_suppress_entire_file \
58 "$pf_prefix cannot determine executable endianness"
59 set endian ""
60}
61
62# Now check that the automatic endianness is updated
63# according to the executable selected.
64if { [gdb_unload] } {
65 gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
66}
67gdb_test "set endian big" "$en_set big endian" \
68 "override target endianness big"
69gdb_test "set endian auto" "$en_auto \\\(currently big endian\\\)" \
70 "override auto target endianness big"
71if { [gdb_file_cmd $binfile] } {
72 gdb_suppress_entire_file "$pf_prefix cannot select executable"
73}
74gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
75 "previously big default executable endianness"
76if { [gdb_unload] } {
77 gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
78}
79gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
80 "previously big default no executable endianness"
81gdb_test "set endian little" "$en_set little endian" \
82 "override target endianness little"
83gdb_test "set endian auto" "$en_auto \\\(currently little endian\\\)" \
84 "override auto target endianness little"
85if { [gdb_file_cmd $binfile] } {
86 gdb_suppress_entire_file "$pf_prefix cannot select executable"
87}
88gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
89 "previously little default executable endianness"
90if { [gdb_unload] } {
91 gdb_suppress_entire_file "$pf_prefix cannot unselect executable"
92}
93gdb_test "show endian" "$en_auto \\\(currently $endian endian\\\)" \
94 "previously little default no executable endianness"
This page took 0.241506 seconds and 4 git commands to generate.