]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Use with_cwd in gdb.src/pre-commit.exp
authorTom de Vries <tdevries@suse.de>
Mon, 20 Oct 2025 09:16:43 +0000 (11:16 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 20 Oct 2025 09:16:43 +0000 (11:16 +0200)
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.

gdb/testsuite/gdb.src/pre-commit.exp

index e73e6fe5e9621dc8383cf140b49c96d761b3d18d..5fb0dfed6d75a924123e255f10d9888c1d2f110d 100644 (file)
@@ -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"
+
+}