1 # Copyright 2019-2024 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 # Test that logging does not style.
18 # Do not run if gdb debug is enabled as it will interfere with log redirect.
19 require !gdb_debug_enabled
21 require {!is_remote host}
23 standard_testfile style.c
25 with_ansi_styling_terminal {
26 if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
34 gdb_test_no_output "set style enabled on"
36 set log_name [standard_output_file log.txt]
37 gdb_test_no_output "set logging file $log_name" \
38 "set logging filename"
39 gdb_test_no_output "set logging overwrite on"
40 gdb_test "set logging enabled on" "Copying output to .*"
42 set main_expr [style main function]
43 set base_file_expr [style ".*style\\.c" file]
44 set line_expr [style $decimal line-number]
45 set file_expr "$base_file_expr:$line_expr"
46 set arg_expr [style "arg." variable]
48 "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*"
50 gdb_test "set logging enabled off" "Done logging to .*"
52 set fd [open $log_name]
53 set data [read -nonewline $fd]
56 set testname "log is escape-free"
57 if {[regexp "\033" $data]} {