From: Tom de Vries Date: Mon, 20 Oct 2025 09:16:43 +0000 (+0200) Subject: [gdb/testsuite] Use with_cwd in gdb.src/pre-commit.exp X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9d169b98c5e6b3908fed307d0ba647499b68cdf;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Use with_cwd in gdb.src/pre-commit.exp I ran the testsuite and ran into ERRORs in two test-cases, gdb.trace/save-trace.exp and gdb.threads/tls-sepdebug.exp. Recently added test-case gdb.src/pre-commit.exp changes the working directory, and the change stays active in following test-cases, which was not the intention. Fix this using with_cwd. Tested on x86_64-linux. --- diff --git a/gdb/testsuite/gdb.src/pre-commit.exp b/gdb/testsuite/gdb.src/pre-commit.exp index e73e6fe5e96..5fb0dfed6d7 100644 --- a/gdb/testsuite/gdb.src/pre-commit.exp +++ b/gdb/testsuite/gdb.src/pre-commit.exp @@ -22,15 +22,17 @@ if {![file isdirectory $repodir/.git]} { return } -cd $repodir +with_cwd $repodir { -set result [remote_exec build "pre-commit --version"] -set status [lindex $result 0] -if {$status != 0} { - unsupported "pre-commit missing or broken" - return -} + set result [remote_exec build "pre-commit --version"] + set status [lindex $result 0] + if {$status != 0} { + unsupported "pre-commit missing or broken" + return + } -set result [remote_exec build "pre-commit run --all-files -v"] -set status [lindex $result 0] -gdb_assert {$status == 0} "pre-commit checks" + set result [remote_exec build "pre-commit run --all-files -v"] + set status [lindex $result 0] + gdb_assert {$status == 0} "pre-commit checks" + +}