This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] [binutils][testsuite] Allow multiple lines of "as" in testsuite.


> On Tue, Feb 26, 2019 at 8:05 AM Nick Clifton <nickc@redhat.com> wrote:
> >
> 
> This breaks RHEL 7:


> invalid command name "lmap"


Thanks for the catch!


My previous patch adding the ability to have multiple "as" lines in a testcase
used a TCL feature introduced in TCL version 8.6 (the lmap procedure).
https://www.sourceware.org/ml/binutils/2019-02/msg00097.html

This doesn't work on distributions that have an older version of TCL.
https://www.sourceware.org/ml/binutils/2019-02/msg00131.html

The attached patch rewrites the sole part of the code that uses "lmap" to use
"foreach" instead.

Tested on cross compilers
mipsel-linux-gnu mipsisa32el-linux-gnu powerpc-ibm-aix5.2.0
aarch64-none-linux-gnu arm-none-linux-gnu aarch64-none-elf

And native x86_64-none-linux-gnu, both with TCL 8.6 and 8.5.

binutils/ChangeLog:

2019-02-28  Matthew Malcomson  <matthew.malcomson@arm.com>

	* testsuite/lib/binutils-common.exp (run_dump_test): Replace a use of
	"lmap" with a "foreach" loop.



###############     Attachment also inlined for ease of reply    ###############


diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index e01b3fb48462cbe6b5bd06ae8860a1e1a8c8e5e6..8f622ba6b4a5adcfe027ebbbdcbb6bac62829203 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -829,19 +829,19 @@ proc run_dump_test { name {extra_options {}} } {
 	}
     }
 
-    # Ensure there is something in $opts(as) for the lmap below.
+    # Ensure there is something in $opts(as) for the foreach loop below.
     if { [llength $opts(as)] == 0 } {
         set opts(as) [list " "]
     }
-    set as_final_flags [lmap x $opts(as) {
+    foreach x $opts(as) {
         if { [string length $x] && [string length $as_additional_flags] } {
             append x " "
         }
         append x $as_additional_flags
         regsub {\[big_or_little_endian\]} $x \
             [big_or_little_endian] x
-        expr {$x}
-    }]
+        lappend as_final_flags $x
+    }
 
     regsub {\[big_or_little_endian\]} $opts(ld) \
         [big_or_little_endian] opts(ld)



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]