summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/fullpath-expand.exp
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-04-22 09:16:59 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-04-26 20:16:03 -0400
commit019a5c62974523a3331911130c66350ef0a6f3c4 (patch)
treecf2f44ec018c1957bff0c335820a0b87c0479715 /gdb/testsuite/gdb.base/fullpath-expand.exp
parent2538fcd3f4b6807f48de20982a2d9c584d98912b (diff)
downloadbinutils-gdb-019a5c62974523a3331911130c66350ef0a6f3c4.tar.gz
gdb/testsuite: use with_cwd where possible
I learned about with_cwd today. I spotted a few spots that could use it, to make the code more robust. Change-Id: Ia23664cb827f25e79d31948e0c006a8dc61c33e1
Diffstat (limited to 'gdb/testsuite/gdb.base/fullpath-expand.exp')
-rw-r--r--gdb/testsuite/gdb.base/fullpath-expand.exp14
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/testsuite/gdb.base/fullpath-expand.exp b/gdb/testsuite/gdb.base/fullpath-expand.exp
index efa8d63b1d4..b3890244997 100644
--- a/gdb/testsuite/gdb.base/fullpath-expand.exp
+++ b/gdb/testsuite/gdb.base/fullpath-expand.exp
@@ -25,13 +25,13 @@ if { [file pathtype $objdir] != "absolute" } {
return -1
}
-set saved_pwd [pwd]
-cd $srcdir
-set err [gdb_compile "${subdir}/${srcfile} ${subdir}/${srcfile2}" $binfile executable {debug}]
-cd $saved_pwd
-if { $err != "" } {
- untested "${srcfile} or ${srcfile2} compilation failed"
- return -1
+with_cwd $srcdir {
+ set err [gdb_compile "${subdir}/${srcfile} ${subdir}/${srcfile2}" $binfile executable {debug}]
+
+ if { $err != "" } {
+ untested "${srcfile} or ${srcfile2} compilation failed"
+ return -1
+ }
}
set result [catch "exec realpath ${srcdir}/${subdir}/${srcfile2}" realsrcfile2]