[2/3] GAS/testsuite: Add a helper for paths outside the source dir

Message ID alpine.DEB.2.21.2406111150190.9248@angie.orcam.me.uk
State New
Headers
Series GAS/testsuite: Make sure none.s is not overwritten |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Test passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Test passed

Commit Message

Maciej W. Rozycki June 11, 2024, 11:51 a.m. UTC
  From: Maciej W. Rozycki <macro@redhat.com>

Implement a helper to construct a relative path from $srcdir/$subdir, 
where `gas_run' operates, to an arbitrary place in the filesystem, for 
example a file in the test object directory.
---
 gas/testsuite/lib/gas-defs.exp |   13 +++++++++++++
 1 file changed, 13 insertions(+)

binutils-test-gas-srcdir-path.diff
  

Patch

Index: binutils-gdb/gas/testsuite/lib/gas-defs.exp
===================================================================
--- binutils-gdb.orig/gas/testsuite/lib/gas-defs.exp
+++ binutils-gdb/gas/testsuite/lib/gas-defs.exp
@@ -104,6 +104,19 @@  proc gas_host_run { cmd redir } {
     return [list [lindex $status 0] "$to_return"]
 }
 
+# gas_srcdir_path FILENAME
+#
+# Return a path to FILENAME relative to the directory we normally get
+# sources from in the current script.  For use when the actual source
+# is for example in the test output directory.
+
+proc gas_srcdir_path { filename } {
+    global srcdir
+    global subdir
+
+    return [get_relative_path $srcdir/$subdir $filename]
+}
+
 proc gas_run { prog as_opts redir } {
     global AS
     global ASFLAGS