m68hc11 gas testsuite wart

Message ID 20210412155204.GF5425@bubble.grove.modra.org
State New
Headers show
Series
  • m68hc11 gas testsuite wart
Related show

Commit Message

H.J. Lu via Binutils April 12, 2021, 3:52 p.m.
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.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/gas/testsuite/gas/m68hc11/m68hc11.exp b/gas/testsuite/gas/m68hc11/m68hc11.exp
index 1be2c99e56e..d58448a85f2 100644
--- a/gas/testsuite/gas/m68hc11/m68hc11.exp
+++ b/gas/testsuite/gas/m68hc11/m68hc11.exp
@@ -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