From: Alan Modra Date: Mon, 12 Apr 2021 15:02:11 +0000 (+0930) Subject: m68hc11 gas testsuite wart X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4bb920c68e3a9e310095d54e0c4034c9cee12916;p=binutils-gdb.git m68hc11 gas testsuite wart 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. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 1b1dafe92d4..40fedbbe802 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2021-04-13 Alan Modra + + * 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 * config/tc-ppc.c (insn_validate): Use uint64_t for operand values. 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