1# Copyright (C) 2012-2021 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
16
17# Run some tests of gas macros.
18
19if { ![istarget hppa*-*-*] || [istarget *-*-linux*] } {
20    run_dump_test test1
21}
22
23if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] && ![istarget "nds32*-*-*"] } {
24    run_dump_test test2
25}
26
27run_dump_test test3
28
29if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] && ![istarget "nds32*-*-*"] } {
30    run_dump_test irp
31    run_dump_test rept
32    run_dump_test repeat
33    run_dump_test vararg
34}
35
36gas_test_error "err.s" "" "macro infinite recursion"
37
38# The tic4x-coff target fails the next test because it defines '&'
39# as its line separator character, so the expression "(0 & TFLAG_C)"
40# becomes divided up into two lines and the parser complains about
41# a missing closing parenthesis for the first line.
42setup_xfail "tic4x*-*"
43gas_test "and.s" "" "" "logical and in macro definition"
44
45switch -glob $target_triplet {
46    hppa*-*-* { if [istarget *-*-linux*] { run_dump_test semi } }
47    *c4x*-*-* { }
48    *c54x*-*-* { }
49    default {
50	run_dump_test semi
51    }
52}
53
54if { ![istarget hppa*-*-*] || [istarget *-*-linux*] } {
55    # FIXME: Due to macro mishandling of ONLY_STANDARD_ESCAPES.
56    setup_xfail "avr-*" "cris-*" "crisv32-*" "msp430-*"
57
58    # These fail due to NO_STRING_ESCAPES
59    setup_xfail "powerpc*-*-aix*" "powerpc*-*-beos*" "powerpc*-*-macos*"
60    setup_xfail "rs6000-*-*"
61    setup_xfail "z80-*-*"
62
63    # FIXME: Due to difference in what "consecutive octets" means.
64    setup_xfail "*c4x*-*-*" "*c54x*-*"
65    run_dump_test strings
66}
67
68run_dump_test app1
69run_dump_test app2
70run_dump_test app3
71remote_download host "$srcdir/$subdir/app4b.s"
72run_dump_test app4
73
74run_list_test badarg ""
75
76switch -glob $target_triplet {
77    *c54x*-*-* { }
78    *c4x*-*-* { }
79    mmix-* { }
80    ns32k-*-* { }
81    rl78-*-* { }
82    rx-*-* { }
83    vax-*-* { }
84    default { run_list_test dot "-alm" }
85}
86run_list_test end ""
87setup_xfail "ns32k-*-*" "vax-*-*"
88run_list_test purge "--hash-size=8000"
89run_list_test redef ""
90
91# This test is valid only when '!' is not a comment character
92# (it is allowed to be a line comment character).
93if [string match "" [lindex [gas_run ../all/excl.s "-o /dev/null" ""] 0]] {
94    run_dump_test paren
95}
96
97# PR 58925: A .exitm pseudo-op outside of a macro definition
98#  prevented the assembler from parsing the rest of the file,
99#  and hence catching an erroroneous instruction.
100gas_test_error "exit.s" "" ".exitm outside of a macro"
101