packed_array_assign.exp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Copyright 2018-2022 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, see <http://www.gnu.org/licenses/>.
  15. load_lib "ada.exp"
  16. if { [skip_ada_tests] } { return -1 }
  17. standard_ada_testfile tester
  18. if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
  19. return -1
  20. }
  21. clean_restart ${testfile}
  22. runto "aggregates.run_test"
  23. set kfail_int128support_re \
  24. "That operation is not available on integers of more than 8 bytes\\."
  25. set cmd \
  26. [list \
  27. "print pra := " \
  28. "((packed_array_assign_x => 2," \
  29. "packed_array_assign_y => 0," \
  30. "packed_array_assign_w => 17)," \
  31. "pr," \
  32. "(packed_array_assign_x => 7," \
  33. "packed_array_assign_y => 1," \
  34. "packed_array_assign_w => 23))"]
  35. set cmd [join $cmd]
  36. set re \
  37. [list \
  38. " = \\(\\(packed_array_assign_w => 17," \
  39. "packed_array_assign_x => 2," \
  40. "packed_array_assign_y => 0\\)," \
  41. "\\(packed_array_assign_w => 104," \
  42. "packed_array_assign_x => 2," \
  43. "packed_array_assign_y => 3\\)," \
  44. "\\(packed_array_assign_w => 23," \
  45. "packed_array_assign_x => 7," \
  46. "packed_array_assign_y => 1\\)\\)"]
  47. set re [join $re]
  48. gdb_test_multiple $cmd "value of pra" {
  49. -re -wrap $re {
  50. pass $gdb_test_name
  51. }
  52. -re -wrap $kfail_int128support_re {
  53. kfail gdb/20991 $gdb_test_name
  54. }
  55. }
  56. set cmd "print pra(1) := pr"
  57. set re \
  58. [list \
  59. " = \\(packed_array_assign_w => 104," \
  60. "packed_array_assign_x => 2," \
  61. "packed_array_assign_y => 3\\)"]
  62. set re [join $re]
  63. gdb_test_multiple $cmd "" {
  64. -re -wrap $re {
  65. pass $gdb_test_name
  66. }
  67. -re -wrap $kfail_int128support_re {
  68. kfail gdb/20991 $gdb_test_name
  69. }
  70. }
  71. set cmd "print pra(1)"
  72. set re \
  73. [list \
  74. " = \\(packed_array_assign_w => 104," \
  75. "packed_array_assign_x => 2," \
  76. "packed_array_assign_y => 3\\)"]
  77. set re [join $re]
  78. gdb_test_multiple $cmd "" {
  79. -re -wrap $re {
  80. pass $gdb_test_name
  81. }
  82. -re -wrap $kfail_int128support_re {
  83. kfail gdb/20991 $gdb_test_name
  84. }
  85. }
  86. gdb_test "print npr := (q000 => 3, r000 => (packed_array_assign_x => 6, packed_array_assign_y => 1, packed_array_assign_w => 117))" \
  87. " = \\(q000 => 3, r000 => \\(packed_array_assign_w => 117, packed_array_assign_x => 6, packed_array_assign_y => 1\\)\\)" \
  88. "value of npr"