]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
m68hc11 gas testsuite wart
authorAlan Modra <amodra@gmail.com>
Mon, 12 Apr 2021 15:02:11 +0000 (00:32 +0930)
committerAlan Modra <amodra@gmail.com>
Mon, 12 Apr 2021 15:50:37 +0000 (01:20 +0930)
Writing to a potentially read-only source directory is not good.

* testsuite/gas/m68hc11/m68hc11.exp (gas_m68hc11_message): Don't
write to $srcdir.  Use gas_host_run and read output file rather
than gas_start/gas_finish.

gas/ChangeLog
gas/testsuite/gas/m68hc11/m68hc11.exp

index 1b1dafe92d4f500d26da46ff5eeb9bb8d8ae09fd..40fedbbe802dbee9e12a9019baf6b3fa01cd7a11 100644 (file)
@@ -1,3 +1,9 @@
+2021-04-13  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/gas/m68hc11/m68hc11.exp (gas_m68hc11_message): Don't
+       write to $srcdir.  Use gas_host_run and read output file rather
+       than gas_start/gas_finish.
+
 2021-04-12  Alan Modra  <amodra@gmail.com>
 
        * config/tc-ppc.c (insn_validate): Use uint64_t for operand values.
index 1be2c99e56ef2e5ae28da74b5b7d6813d9a5e3f1..d58448a85f2f24b8411da4f8be5a3bab6e92f140 100644 (file)
@@ -51,35 +51,31 @@ gas_m68hc11_opcode_list "-mm9s12xg" 74
 
 # Test for a message produced when assembling a file
 proc gas_m68hc11_message { kind options line expect } {
-    global srcdir
-    global subdir
+    global AS
+    global ASFLAGS
 
     regsub -all "\n" "$line: $expect" " " title
 
     # Make a file containing the instructions to assemble.
-    set fd [open "$srcdir/$subdir/tst-m68hc1x.s" "w"]
+    set fd [open "tst-m68hc1x.s" "w"]
     puts -nonewline $fd "$line"
     close $fd
 
     verbose -log "Test: $title"
-    gas_start "tst-m68hc1x.s" "$options"
+    set status [gas_host_run "$AS $ASFLAGS $options tst-m68hc1x.s" ">&gas.out"]
     set ok 0
-    while 1 {
-       expect {
-           -re ".*: Assembler messages:\n" { }
-           -re ".*1: $kind: $expect" { incr ok; break }
-           timeout       { perror "timeout\n"; break }
-           eof           { verbose "EOF from gas"; break }
+    set fd [open "gas.out" r]
+    while { [gets $fd outline] != -1 } {
+       if { [regexp ".*1: $kind: $expect" $outline] } {
+           incr ok
        }
     }
-    #sleep 1 # Uncomment this line when using gcov
-    gas_finish
     if { $ok > 0 } then {
        pass $title
     } else {
        fail $title
     }
-    catch "exec rm -f $srcdir/$subdir/tst-m68hc1x.s"
+    catch "exec rm -f tst-m68hc1x.s gas.out"
 }
 
 # Test for an error message produced by gas