1 # Test for error messages when a bad register name, an out of range operand, or
2 # invalid syntax is used. Adapted from Ben Elliston's load-hazard testcase.
4 # Run GAS and check that it emits the desired error for the test case.
6 # file -- name of the test case to assemble.
7 # testname -- a string describing the test.
8 # warnpattern -- a regular expression, suitable for use by the Tcl
9 # regexp command, to decide if the warning string was emitted by
10 # the assembler to stderr.
12 proc mrisc1_error_test { file testname {warnpattern ""} } {
15 gas_run $file "" ">/dev/null"
16 verbose "output was $comp_output" 2
18 if {$warnpattern == ""} {
19 if {$comp_output == ""} { pass $testname } else { fail $testname }
23 if {[regexp "Error: $warnpattern" $comp_output]} {
30 if [istarget ms1-*-*] {
31 foreach file [glob -nocomplain -- $srcdir/$subdir/bad*.s] {
32 set file [file tail $file]
35 set warnpattern "unrecognized keyword/register name *"
38 set warnpattern "unrecognized form of instruction*"
41 set warnpattern "unrecognized keyword/register name *"
44 set warnpattern "unrecognized form of instruction*"
47 set warnpattern "Operand out of range. Must be between -32768 and 32767.*"
50 set warnpattern "Operand out of range. Must be between -32768 and 32767.*"
52 "badunsignedimmhigh.s" {
53 set warnpattern "operand out of range (65536 not between 0 and 65535)*"
55 "badunsignedimmlow.s" {
56 set warnpattern "operand out of range (65536 not between 0 and 65535)*"
58 "badsignedimmhigh.s" {
59 set warnpattern "operand out of range.*"
62 set warnpattern "operand out of range.*"
65 set warnpattern "unrecognized instruction *"
68 set warnpattern "junk at end of line *"
71 error "no expected result specified for $file"
76 mrisc1_error_test $file "assembler emits error for $file" $warnpattern