tdesc-xinclude.exp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Copyright 2007-2022 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. if {[gdb_skip_xml_test]} {
  15. unsupported "tdesc-errors.exp"
  16. return -1
  17. }
  18. gdb_start
  19. proc set_arch { srcfile errmsg } {
  20. global gdb_prompt
  21. global srcdir
  22. global subdir
  23. # Anchor the test output, so that error messages are detected.
  24. set cmd "set tdesc filename $srcdir/$subdir/$srcfile"
  25. set msg "set tdesc filename $subdir/$srcfile"
  26. set cmd_regex [string_to_regexp $cmd]
  27. gdb_test_multiple $cmd $msg {
  28. -re "^$cmd_regex\r\n$errmsg$gdb_prompt $" {
  29. pass $msg
  30. }
  31. }
  32. }
  33. set common_warn "\r\nwarning: Could not load XML target description; ignoring\r\n"
  34. # This file is valid, but specifies an unknown architecture.
  35. # We should get a warning, if we process the includes correctly.
  36. set_arch "includes.xml" \
  37. "warning:.*specified unknown architecture.* \"invalid-body\"$common_warn"
  38. # This file contains a missing include. We should warn the user about
  39. # it.
  40. set_arch "bad-include.xml" \
  41. "warning:.*Could not load XML document \"nonexistant.xml\"$common_warn"
  42. # Make sure we detect infinite loops, eventually.
  43. set_arch "loop.xml" \
  44. "warning:.*Maximum XInclude depth.*$common_warn"