Skip to content

Commit a17805b

Browse files
committed
Test GNAT encodings in arr_acc_idx_w_gap.exp
While working on a GNAT bug, I wanted to also test arr_acc_idx_w_gap.exp using GNAT encodings. When the GNAT change is ready, I plan to add a new case here. Tested on x86-64 Fedora 36. I am checking this in.
1 parent 86dfe01 commit a17805b

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,56 @@ require allow_ada_tests
1919

2020
standard_ada_testfile enum_with_gap_main
2121

22-
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
23-
return -1
24-
}
22+
foreach_with_prefix scenario {all minimal} {
23+
set flags [list debug additional_flags=-fgnat-encodings=$scenario]
2524

26-
clean_restart ${testfile}
25+
if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \
26+
executable $flags] != ""} {
27+
return -1
28+
}
2729

28-
set bp_location [gdb_get_line_number "BREAK" ${testdir}/enum_with_gap_main.adb]
29-
if {![runto "enum_with_gap_main.adb:$bp_location"]} {
30-
return
31-
}
30+
clean_restart ${testfile}-${scenario}
3231

33-
gdb_test "print indexed_by_enum.all" \
34-
" = \\(lit1 => 1, 43, 42, 41\\)"
35-
gdb_test "print s.all" \
36-
" = \"Hello!\""
32+
set bp_location [gdb_get_line_number "BREAK" \
33+
${testdir}/enum_with_gap_main.adb]
34+
if {![runto "enum_with_gap_main.adb:$bp_location"]} {
35+
return
36+
}
3737

38-
gdb_test "print indexed_by_enum'length" \
39-
" = 4"
40-
gdb_test "print s'length" \
41-
" = 6"
38+
gdb_test "print indexed_by_enum.all" \
39+
" = \\(lit1 => 1, 43, 42, 41\\)"
40+
gdb_test "print s.all" \
41+
" = \"Hello!\""
4242

43-
gdb_test "print indexed_by_enum'first" \
44-
" = lit1"
45-
gdb_test "print s'first" \
46-
" = 1"
43+
gdb_test "print indexed_by_enum'length" \
44+
" = 4"
45+
gdb_test "print s'length" \
46+
" = 6"
4747

48-
gdb_test "print indexed_by_enum'last" \
49-
" = lit4"
50-
gdb_test "print s'last" \
51-
" = 6"
48+
gdb_test "print indexed_by_enum'first" \
49+
" = lit1"
50+
gdb_test "print s'first" \
51+
" = 1"
5252

53-
gdb_test "print indexed_by_enum(lit2..lit4)" \
54-
" = \\(lit2 => 43, 42, 41\\)"
55-
gdb_test "print s(2..4)" \
56-
" = \"ell\""
53+
gdb_test "print indexed_by_enum'last" \
54+
" = lit4"
55+
gdb_test "print s'last" \
56+
" = 6"
5757

58-
gdb_test "print v" " = lit3"
59-
gdb_test "print enum_subrange'pos(v)" " = 3"
60-
gdb_test "print enum_subrange'val(3)" " = lit3"
58+
gdb_test "print indexed_by_enum(lit2..lit4)" \
59+
" = \\(lit2 => 43, 42, 41\\)"
60+
gdb_test "print s(2..4)" \
61+
" = \"ell\""
6162

62-
gdb_test "print indexed_by_enum(lit2)" "43"
63-
gdb_test "print s(2)" "101 'e'"
63+
gdb_test "print v" " = lit3"
64+
gdb_test "print enum_subrange'pos(v)" " = 3"
65+
gdb_test "print enum_subrange'val(3)" " = lit3"
6466

65-
gdb_test "print enum_with_gaps'enum_rep(lit3)" " = 13" \
66-
"enum_rep"
67-
gdb_test "print enum_with_gaps'enum_val(21)" " = lit4" \
68-
"enum_val"
67+
gdb_test "print indexed_by_enum(lit2)" "43"
68+
gdb_test "print s(2)" "101 'e'"
69+
70+
gdb_test "print enum_with_gaps'enum_rep(lit3)" " = 13" \
71+
"enum_rep"
72+
gdb_test "print enum_with_gaps'enum_val(21)" " = lit4" \
73+
"enum_val"
74+
}

0 commit comments

Comments
 (0)