From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 5A943385840D for ; Fri, 1 Sep 2023 03:22:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5A943385840D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.02,218,1688457600"; d="scan'208";a="15864724" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa3.mentor.iphmx.com with ESMTP; 31 Aug 2023 19:22:51 -0800 IronPort-SDR: No0Q+fphQpnQW4/R4TDsISoARw4WtZjBqrWr5hQ89GSkUxRMZS2ikFmdwYN1e26nNg/rlbLFhC ycCSYI6oGTPHf04o6oipAxLFdoPE9VcWxz23eoK1W62VVDlTwQ6uoh2cg3F+KZCsQhJGEUAEh1 NuZ0HVFGOpcXctXPSy01ZoPvuV2TJAO+4KEPYRggc7yVKBxhGBRdmy0Qwm+ezP6L3OFSafbXDF pskLLZnX5VypQPaIE6WtGAXM4qieICEC4tIBbAj9f7WF2E2F19OWogef8BhXvYsVUOOdQFEYBz HPM= From: Sandra Loosemore To: Subject: [PATCH V3 2/4] gdb/testsuite: Adjust some testcases to allow Windows pathnames Date: Thu, 31 Aug 2023 21:22:28 -0600 Message-ID: <20230901032230.4193511-3-sandra@codesourcery.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901032230.4193511-1-sandra@codesourcery.com> References: <20230901032230.4193511-1-sandra@codesourcery.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: svr-orw-mbx-10.mgc.mentorg.com (147.34.90.210) To svr-orw-mbx-13.mgc.mentorg.com (147.34.90.213) X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This patch fixes some testcases that formerly had patterns with hardwired "/" pathname separators in them, which broke when testing on (remote) Windows host. Reviewed-By: Tom Tromey --- .../maint-expand-symbols-header-file.exp | 4 +-- gdb/testsuite/gdb.base/setshow.exp | 15 +++++++-- gdb/testsuite/gdb.dwarf2/dw2-filename.exp | 2 +- gdb/testsuite/gdb.mi/mi-info-sources.exp | 32 +++++++++---------- 4 files changed, 32 insertions(+), 21 deletions(-) diff --git a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp index d38d2ab7398..43b5aabea3c 100644 --- a/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp +++ b/gdb/testsuite/gdb.base/maint-expand-symbols-header-file.exp @@ -40,13 +40,13 @@ gdb_test_no_output "maint info symtabs" $test gdb_test_no_output "maint expand-symtabs maint-expand-symbols-header-file.h" # Check that the include symtab was in fact expanded. -set file_re "\[^\r\n\]*/maint-expand-symbols-header-file.h" +set file_re "\[^\r\n\]*maint-expand-symbols-header-file.h" gdb_test "maint info symtabs" \ "\r\n\t{ symtab $file_re \\(\\(struct symtab \\*\\) $hex\\)\r\n.*" \ "check header file psymtab expansion" # Check that the symtab the include symtab was referring to was expanded. -set file_re "\[^\r\n\]*/maint-expand-symbols-header-file.c" +set file_re "\[^\r\n\]*maint-expand-symbols-header-file.c" gdb_test "maint info symtabs" \ "\r\n\t{ symtab $file_re \\(\\(struct symtab \\*\\) $hex\\)\r\n.*" \ "check source file psymtab expansion" diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 8c160aa560e..ef01b6087f7 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -280,10 +280,21 @@ proc_with_prefix test_setshow_history {} { #get home directory path set HOME "" + set STRINGHOME "" set test "show environment HOME" gdb_test_multiple $test $test { -re "\nHOME = (\[^\r\n\]*)\[\r\n\]+$::gdb_prompt $" { set HOME $expect_out(1,string) + if { [ishost *-*-mingw*] } { + # STRINGHOME is how HOME prints with C string escapes. + # Specifically, all backslashes "\" in the pathname + # string have to be escaped as "\\". If you have other + # weird characters in your HOME pathname that need + # escaping too, maybe you shouldn't do that. :-P + regsub -all {\\} $HOME {\\\\} STRINGHOME + } else { + set STRINGHOME $HOME + } pass $test } } @@ -297,10 +308,10 @@ proc_with_prefix test_setshow_history {} { "The filename in which to record the command history is \"[string_to_regexp $HOME]/foobar.baz\"..*" \ "show history filename (~/foobar.baz)" gdb_test "p \$_gdb_setting(\"history filename\")" \ - " = \"[string_to_regexp $HOME]/foobar.baz\"" \ + " = \"[string_to_regexp $STRINGHOME]/foobar.baz\"" \ "_gdb_setting history filename" gdb_test "p \$_gdb_setting_str(\"history filename\")" \ - " = \"[string_to_regexp $HOME]/foobar.baz\"" \ + " = \"[string_to_regexp $STRINGHOME]/foobar.baz\"" \ "_gdb_setting_str history filename" #get current working directory diff --git a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp index 3bdac4c1cb8..c0ee3ac0d3f 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-filename.exp +++ b/gdb/testsuite/gdb.dwarf2/dw2-filename.exp @@ -38,4 +38,4 @@ gdb_test "interpreter-exec mi -file-list-exec-source-files" \ ".*{file=\"file1\\.txt\",fullname=\".+file1\\.txt\",debug-fully-read=\"\[^\"\]+\"}.*" # And `info sources' should return the fullname incl. the directories. -gdb_test "info sources" {[/]file1\.txt.*} +gdb_test "info sources" {.+file1\.txt.*} diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp index f639f3cdef9..3778ccb3fbe 100644 --- a/gdb/testsuite/gdb.mi/mi-info-sources.exp +++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp @@ -118,16 +118,16 @@ proc check_info_sources { debug_fully_read } { [mi_list "files" \ ".*" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \ [mi_field "debug-fully-read" "${debug_fully_read}"]] \ ".*"] set p2 \ [mi_list "files" \ ".*" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources\\.c"] \ [mi_field "debug-fully-read" "true"]] \ ".*"] } else { @@ -135,16 +135,16 @@ proc check_info_sources { debug_fully_read } { [mi_list "files" \ ".*" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources\\.c"] \ [mi_field "debug-fully-read" "true"]] \ ".*"] set p2 \ [mi_list "files" \ ".*" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \ [mi_field "debug-fully-read" "${debug_fully_read}"]] \ ".*"] } @@ -156,8 +156,8 @@ proc check_info_sources { debug_fully_read } { set p [mi_list "files" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \ [mi_field "debug-fully-read" "${debug_fully_read}"]]] mi_gdb_test "-file-list-exec-source-files --basename -- base" ".*\\^done,${p}" \ "-file-list-exec-source-files --basename -- base" @@ -171,13 +171,13 @@ proc check_info_sources { debug_fully_read } { set p [mi_list "files" \ [mi_tuple "" \ - [mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \ + [mi_field "filename" "\[^\"\]+mi-info-sources(\.debug)?"] \ [mi_field "debug-info" "${debug_info}"] \ [mi_list "sources" \ ".*" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources\\.c"] \ [mi_field "debug-fully-read" "true"]] \ ".*"]]] mi_gdb_test "-file-list-exec-source-files --group-by-objfile" \ @@ -186,13 +186,13 @@ proc check_info_sources { debug_fully_read } { set p [mi_list "files" \ [mi_tuple "" \ - [mi_field "filename" "\[^\"\]+/mi-info-sources(\.debug)?"] \ + [mi_field "filename" "\[^\"\]+mi-info-sources(\.debug)?"] \ [mi_field "debug-info" "${debug_info}"] \ [mi_list "sources" \ ".*" \ [mi_tuple "" \ - [mi_field "file" "\[^\"\]+/mi-info-sources-base\\.c"] \ - [mi_field "fullname" "\[^\"\]+/mi-info-sources-base\\.c"] \ + [mi_field "file" "\[^\"\]*mi-info-sources-base\\.c"] \ + [mi_field "fullname" "\[^\"\]+mi-info-sources-base\\.c"] \ [mi_field "debug-fully-read" "${debug_fully_read}"]] \ ".*"]]] mi_gdb_test "-file-list-exec-source-files --group-by-objfile" \ -- 2.31.1