spu.exp 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Expect script for ld-spu tests
  2. # Copyright (C) 2006-2022 Free Software Foundation, Inc.
  3. #
  4. # This file is part of the GNU Binutils.
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  19. # MA 02110-1301, USA.
  20. #
  21. if { ![istarget "spu-*-*"] } {
  22. return
  23. }
  24. proc embed_test { } {
  25. global subdir srcdir
  26. global AS ASFLAGS LD LDFLAGS READELF READELFFLAGS
  27. set cmd "$AS $ASFLAGS -o tmpdir/ear.o $srcdir/$subdir/ear.s"
  28. send_log "$cmd\n"
  29. set cmdret [catch "exec $cmd" comp_output]
  30. set comp_output [prune_warnings $comp_output]
  31. if { $cmdret != 0 || $comp_output != ""} then {
  32. send_log "$comp_output\n"
  33. verbose "$comp_output" 3
  34. fail "ear assembly"
  35. return
  36. }
  37. set cmd "$LD $LDFLAGS -o tmpdir/ear tmpdir/ear.o"
  38. send_log "$cmd\n"
  39. set cmdret [catch "exec $cmd" comp_output]
  40. set comp_output [prune_warnings $comp_output]
  41. if { $cmdret != 0 || $comp_output != ""} then {
  42. send_log "$comp_output\n"
  43. verbose "$comp_output" 3
  44. fail "ear link"
  45. return
  46. }
  47. set cmd "sh $srcdir/../../binutils/embedspu.sh -m32 ear tmpdir/ear tmpdir/embed.o"
  48. send_log "$cmd\n"
  49. set cmdret [catch "exec $cmd" comp_output]
  50. set comp_output [prune_warnings $comp_output]
  51. if { $cmdret != 0 || $comp_output != ""} then {
  52. send_log "$comp_output\n"
  53. verbose "$comp_output" 3
  54. if { [regexp "unknown pseudo-op: `.reloc'" $comp_output] } {
  55. untested "ear embedspu"
  56. return
  57. }
  58. fail "ear embedspu"
  59. return
  60. }
  61. set cmd "$READELF $READELFFLAGS -r --wide tmpdir/embed.o > tmpdir/embed.out"
  62. send_log "$cmd\n"
  63. set cmdret [catch "exec $cmd" comp_output]
  64. set comp_output [prune_warnings $comp_output]
  65. if { $cmdret != 0 || $comp_output != ""} then {
  66. send_log "$comp_output\n"
  67. verbose "$comp_output" 3
  68. fail "ear embed readelf"
  69. return
  70. }
  71. if { [regexp_diff "tmpdir/embed.out" $srcdir/$subdir/embed.rd] } then {
  72. fail "ear embed output"
  73. return
  74. }
  75. pass "ear embed"
  76. }
  77. set rd_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
  78. foreach sputest $rd_test_list {
  79. verbose [file rootname $sputest]
  80. run_dump_test [file rootname $sputest]
  81. }
  82. if { [isbuild "powerpc*-*-linux*"] } {
  83. embed_test
  84. }