1 # This testcase is part of GDB, the GNU debugger.
3 # Copyright 2019 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Test the gdb::option framework.
20 # The test uses the "maintenance test-options" subcommands to exercise
21 # TAB-completion and option processing.
23 # It also tests option integration in various commands, including:
34 load_lib completion-support.exp
38 if {[build_executable "failed to prepare" $testfile $srcfile debug]} {
44 if { ![readline_is_used] } {
45 untested "no tab completion support without readline"
49 # Check the completion result, as returned by the "maintenance show
50 # test-options-completion-result" command. TEST is used as test name.
51 proc check_completion_result {expected test} {
52 gdb_test "maintenance show test-options-completion-result" \
54 "$test: res=$expected"
57 # Like test_gdb_complete_unique, but the expected output is expected
58 # to be the input line. I.e., the line is already complete. We're
59 # just checking whether GDB recognizes the option and auto-appends a
61 proc test_completer_recognizes {res input_line} {
62 set expected_re [string_to_regexp $input_line]
63 test_gdb_complete_unique $input_line $expected_re
64 check_completion_result $res $input_line
67 # Wrapper around test_gdb_complete_multiple that also checks the
68 # completion result is RES.
69 proc res_test_gdb_complete_multiple {res cmd_prefix completion_word args} {
70 test_gdb_complete_multiple $cmd_prefix $completion_word {*}$args
71 check_completion_result $res "$cmd_prefix$completion_word"
74 # Wrapper around test_gdb_complete_none that also checks the
75 # completion result is RES.
76 proc res_test_gdb_complete_none { res input_line } {
77 test_gdb_complete_none $input_line
78 check_completion_result $res "$input_line"
81 # Wrapper around test_gdb_complete_unique that also checks the
82 # completion result is RES.
83 proc res_test_gdb_complete_unique { res input_line args} {
84 test_gdb_complete_unique $input_line {*}$args
85 check_completion_result $res "$input_line"
88 # Make a full command name from VARIANT. VARIANT is either
89 # "require-delimiter", "unknown-is-error" or "unknown-is-operand".
90 proc make_cmd {variant} {
91 return "maint test-options $variant"
94 # Return a string for the expected result of running "maint
95 # test-options xxx", with no flag/option set. OPERAND is the expected
97 proc expect_none {operand} {
98 return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint 0 -zuint-unl 0 -- $operand"
101 # Return a string for the expected result of running "maint
102 # test-options xxx", with -flag set. OPERAND is the expected operand.
103 proc expect_flag {operand} {
104 return "-flag 1 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint 0 -zuint-unl 0 -- $operand"
107 # Return a string for the expected result of running "maint
108 # test-options xxx", with -bool set. OPERAND is the expected operand.
109 proc expect_bool {operand} {
110 return "-flag 0 -xx1 0 -xx2 0 -bool 1 -enum xxx -uint 0 -zuint-unl 0 -- $operand"
113 # Return a string for the expected result of running "maint
114 # test-options xxx", with one of the integer options set to $VAL.
115 # OPTION determines which option to expect set. OPERAND is the
117 proc expect_integer {option val operand} {
118 if {$option == "uinteger"} {
119 return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint $val -zuint-unl 0 -- $operand"
120 } elseif {$option == "zuinteger-unlimited"} {
121 return "-flag 0 -xx1 0 -xx2 0 -bool 0 -enum xxx -uint 0 -zuint-unl $val -- $operand"
123 error "unsupported option: $option"
134 "-zuinteger-unlimited"
137 # Basic option-machinery + "print" command integration tests.
138 proc_with_prefix test-print {{prefix ""}} {
141 # Completing "print" with no argument completes on symbols only,
142 # no options are offered. Since we haven't loaded any symbols,
143 # the match list should be empty.
144 test_gdb_complete_none "${prefix}print "
146 # OTOH, completing at "-" should list all options.
147 test_gdb_complete_multiple "${prefix}print " "-" "" {
164 clean_restart $binfile
167 fail "cannot run to main"
171 # Mix options and format.
172 gdb_test "${prefix}print -pretty -- /x 1" " = 0x1"
174 # Smoke test that options actually work.
175 gdb_test "${prefix}print -pretty -- g_s" \
183 test_gdb_complete_unique \
184 "${prefix}print xxx" \
185 "${prefix}print xxx1"
186 test_gdb_complete_unique \
187 "${prefix}print -- xxx" \
188 "${prefix}print -- xxx1"
190 # Error messages when testing with "compile" are different from
191 # the error messages gdb's internal parser throws. This procedure
192 # hides the difference. EXPECTED_RE is only considered when not
193 # testing with "compile".
194 proc test_invalid_expression {cmd expected_re} {
197 if {$prefix != "compile "} {
198 gdb_test $cmd $expected_re
200 # Error messages depend on compiler version, so we just
201 # look for the last line indicating a failure.
202 gdb_test $cmd "Compilation failed\\."
206 # Check that '-XXX' without a "--" is handled as an
208 gdb_test "${prefix}print -1" " = -1"
209 test_invalid_expression \
210 "${prefix}print --1" \
211 "Left operand of assignment is not an lvalue\\."
212 test_invalid_expression \
213 "${prefix}print -object" \
214 "No symbol \"object\".*"
216 # Test printing with options and no expression.
217 set test "${prefix}print -object --"
218 if {$prefix != "compile "} {
219 # Regular "print" repeats the last history value.
220 gdb_test $test " = -1"
222 # "compile print" starts a multiline expression.
223 gdb_test_multiple $test $test {
225 gdb_test "-1\nend" " = -1" \
231 # Check that everything after "-- " is treated as an
232 # expression, not confused with an option.
233 test_invalid_expression \
234 "${prefix}print -- -address" \
236 gdb_test "${prefix}print -- -1" " = -1"
237 test_invalid_expression \
238 "${prefix}print -- --1" \
239 "Left operand of assignment is not an lvalue\\."
242 # Basic option-machinery + "backtrace" command integration tests.
243 proc_with_prefix test-backtrace {} {
246 test_gdb_complete_unique "backtrace" "backtrace"
247 test_gdb_complete_none "backtrace "
249 gdb_test "backtrace -" "Ambiguous option at: -"
250 gdb_test "backtrace --" "No stack\\."
251 gdb_test "backtrace -- -" "No stack\\."
253 test_gdb_complete_multiple "backtrace " "-" "" {
261 "-raw-frame-arguments"
264 # Test that we complete the qualifiers, if there's any.
265 test_gdb_complete_unique \
268 test_gdb_complete_unique \
271 test_gdb_complete_unique \
273 "backtrace no-filters"
276 clean_restart $binfile
279 fail "cannot run to main"
283 # COUNT in "backtrace COUNT" is parsed as an expression. Check
284 # that we complete expressions.
286 test_gdb_complete_unique \
290 test_gdb_complete_unique \
294 test_gdb_complete_unique \
295 "backtrace 1 + xxx" \
298 test_gdb_complete_unique \
299 "backtrace (1 + xxx" \
300 "backtrace (1 + xxx1"
303 # Basic option-machinery + "frame apply" command integration tests.
304 proc_with_prefix test-frame-apply {} {
305 test_gdb_complete_unique "frame apply all" "frame apply all"
307 gdb_test "frame apply level 0-" \
308 "Please specify a command to apply on the selected frames"
309 test_gdb_complete_none "frame apply level 0-"
314 "frame apply level 0"
318 test_gdb_completion_offers_commands "$cmd "
320 # tfaas is silent on command error by design. This procedure
321 # hides that aspect. EXPECTED_RE is only considered when not
322 # testing with "faas"/"tfaas".
323 proc test_error_cmd {cmd arg expected_re} {
324 if {$cmd == "tfaas"} {
325 gdb_test_no_output "$cmd$arg"
327 gdb_test "$cmd$arg" $expected_re
330 # Same, but for tests where both "faas" and "tfaas" are
331 # expected to be silent.
332 proc test_error_cmd2 {cmd arg expected_re} {
333 if {$cmd == "tfaas" || $cmd == "faas"} {
334 gdb_test_no_output "$cmd$arg"
336 gdb_test "$cmd$arg" $expected_re
340 test_error_cmd $cmd " -" "Ambiguous option at: -"
341 test_gdb_complete_multiple "$cmd " "-" "" {
349 with_test_prefix "no-trailing-space" {
350 test_error_cmd $cmd " --" \
351 "Please specify a command to apply on the selected frames"
352 test_gdb_complete_unique "$cmd --" "$cmd --"
355 with_test_prefix "trailing-space" {
356 test_error_cmd $cmd " -- " \
357 "Please specify a command to apply on the selected frames"
358 test_gdb_completion_offers_commands "$cmd -- "
361 # '-' is a valid TUI command.
362 test_error_cmd2 $cmd " -- -" \
363 "Cannot enable the TUI when output is not a terminal"
364 test_gdb_complete_unique \
368 test_error_cmd2 $cmd " -foo" \
369 "Undefined command: \"-foo\". Try \"help\"\\."
370 test_gdb_complete_none "$cmd -foo"
372 test_gdb_completion_offers_commands "$cmd -s "
376 # Basic option-machinery + "thread apply" command integration tests.
377 proc_with_prefix test-thread-apply {} {
379 test_gdb_complete_unique "thread apply all" "thread apply all"
380 test_gdb_complete_unique "taas" "taas"
382 gdb_test "thread apply 1-" \
384 test_gdb_complete_none "frame apply level 1-"
391 test_gdb_completion_offers_commands "$cmd "
393 # taas is silent on command error by design. This procedure
394 # hides the difference. EXPECTED_RE is only considered when
395 # not testing with "taas".
396 proc test_invalid_cmd {cmd arg expected_re} {
397 if {$cmd != "taas"} {
398 gdb_test "$cmd$arg" $expected_re
400 gdb_test_no_output "$cmd$arg"
404 gdb_test "$cmd -" "Ambiguous option at: -"
406 if {$cmd != "thread apply 1"} {
407 test_gdb_complete_multiple "$cmd " "-" "" {
414 # "-ascending" only works with "all".
415 test_gdb_complete_multiple "$cmd " "-" "" {
422 if {$cmd == "thread apply all" || $cmd == "taas"} {
424 "Please specify a command at the end of 'thread apply all'"
425 } elseif {$cmd == "thread apply 1"} {
427 "Please specify a command following the thread ID list"
429 error "unexpected cmd: $cmd"
432 with_test_prefix "no-trailing-space" {
433 gdb_test "$cmd --" $errmsg
434 test_gdb_complete_unique "$cmd --" "$cmd --"
437 with_test_prefix "trailing-space" {
438 gdb_test "$cmd -- " $errmsg
439 test_gdb_completion_offers_commands "$cmd -- "
442 # '-' is a valid TUI command.
443 test_invalid_cmd "$cmd" " -- -" \
444 "Cannot enable the TUI when output is not a terminal"
445 test_gdb_complete_unique \
449 test_invalid_cmd $cmd " -foo" \
450 "Undefined command: \"-foo\". Try \"help\"\\."
451 test_gdb_complete_none "$cmd -foo"
453 test_gdb_completion_offers_commands "$cmd -c "
457 # Basic option-machinery + "info threads" command integration tests.
458 proc_with_prefix test-info-threads {} {
459 test_gdb_complete_multiple "info threads " "" "" {
464 test_gdb_complete_unique \
468 # "ID" isn't really something the user can type.
469 test_gdb_complete_none "info threads I"
472 # Miscellaneous tests.
473 proc_with_prefix test-misc {variant} {
476 set cmd [make_cmd $variant]
478 # Call test command with no arguments at all.
479 gdb_test "$cmd" [expect_none ""]
481 # Now with a single dash.
482 if {$variant == "require-delimiter"} {
483 gdb_test "$cmd -" [expect_none "-"]
485 gdb_test "$cmd -" "Ambiguous option at: -"
488 # Completing at "-" should list all options.
489 res_test_gdb_complete_multiple \
490 "1 [expect_none "-"]" \
491 "$cmd " "-" "" $all_options
493 # Now with a double dash.
494 gdb_test "$cmd --" [expect_none ""]
496 # "--" is recognized by options completer, gdb auto-appends a
498 test_completer_recognizes \
499 "1 [expect_none "--"]" \
502 # Now with a double dash, plus a dash as operand.
503 gdb_test "$cmd -- -" [expect_none "-"]
504 res_test_gdb_complete_none "0 -" "$cmd -- -"
506 # Completing an unambiguous option just appends an empty space.
507 test_completer_recognizes \
508 "1 [expect_none "-flag"]" \
511 # Try running an ambiguous option.
512 if {$variant == "require-delimiter"} {
513 gdb_test "$cmd -xx" [expect_none "-xx"]
515 gdb_test "$cmd -xx" "Ambiguous option at: -xx"
518 # Check that options are not case insensitive.
519 gdb_test "$cmd -flag --" [expect_flag ""]
521 # Check how the different modes behave on unknown option, with a
523 gdb_test "$cmd -FLAG --" \
524 "Unrecognized option at: -FLAG --"
526 # Check how the different modes behave on unknown option, without
528 if {$variant == "unknown-is-error"} {
529 gdb_test "$cmd -FLAG" \
530 "Unrecognized option at: -FLAG"
532 gdb_test "$cmd -FLAG" [expect_none "-FLAG"]
535 # Test parsing stops at a negative integer.
536 gdb_test "$cmd -1 --" \
537 "Unrecognized option at: -1 --"
538 gdb_test "$cmd -2 --" \
539 "Unrecognized option at: -2 --"
543 proc_with_prefix test-flag {variant} {
546 set cmd [make_cmd $variant]
548 # Completing a flag just appends a space.
549 test_completer_recognizes \
550 "1 [expect_none "-flag"]" \
553 # Add a dash, and all options should be shown.
554 res_test_gdb_complete_multiple \
555 "1 [expect_flag "-"]" \
556 "$cmd -flag " "-" "" $all_options
558 # Basic smoke tests of accepted / not accepted values.
560 # Check all the different variants a bool option may be specified.
561 if {$variant == "require-delimiter"} {
562 gdb_test "$cmd -flag 999" [expect_none "-flag 999"]
564 gdb_test "$cmd -flag 999" [expect_flag "999"]
566 gdb_test "$cmd -flag -- 999" [expect_flag "999"]
568 # If the "--" separator is present, then GDB errors out if the
569 # flag option is passed some value -- check that too.
570 gdb_test "$cmd -flag xxx 999 --" "Unrecognized option at: xxx 999 --"
571 gdb_test "$cmd -flag o 999 --" "Unrecognized option at: o 999 --"
572 gdb_test "$cmd -flag 1 999 --" "Unrecognized option at: 1 999 --"
574 # Extract twice the same flag, separated by one space.
575 gdb_test "$cmd -flag -flag -- non flags args" \
576 [expect_flag "non flags args"]
578 # Extract twice the same flag, separated by one space.
579 gdb_test "$cmd -xx1 -xx2 -xx1 -xx2 -xx1 -- non flags args" \
580 "-flag 0 -xx1 1 -xx2 1 -bool 0 -enum xxx -uint 0 -zuint-unl 0 -- non flags args"
582 # Extract 2 known flags in front of unknown flags.
583 gdb_test "$cmd -xx1 -xx2 -a -b -c -xx1 --" \
584 "Unrecognized option at: -a -b -c -xx1 --"
586 # Check that combined flags are not recognised.
587 gdb_test "$cmd -xx1 -xx1xx2 -xx1 --" \
588 "Unrecognized option at: -xx1xx2 -xx1 --"
590 # Make sure the completer don't confuse a flag option with a
591 # boolean option. Specifically, "o" should not complete to
594 if {$variant == "require-delimiter"} {
595 res_test_gdb_complete_none \
596 "1 [expect_flag "o"]" \
599 gdb_test "$cmd -flag o" [expect_none "-flag o"]
601 res_test_gdb_complete_none "0 o" "$cmd -flag o"
603 gdb_test "$cmd -flag o" [expect_flag "o"]
607 # Boolean option tests.
608 proc_with_prefix test-boolean {variant} {
611 set cmd [make_cmd $variant]
613 # Boolean option's values are optional -- "on" is implied. Check
616 # - For require-delimiter commands, completing after a boolean
617 # option lists all other options, plus "on/off". This is
618 # because operands won't be processed until we see a "--"
621 # - For !require-delimiter commands, completing after a boolean
622 # option completes as an operand, since that will tend to be
623 # more common than typing "on/off".
624 # E.g., "frame apply all -past-main COMMAND".
626 if {$variant == "require-delimiter"} {
627 res_test_gdb_complete_multiple \
628 "1 [expect_none ""]" \
629 "$cmd -bool " "" "" {
636 "-zuinteger-unlimited"
641 res_test_gdb_complete_none "0 " "$cmd -bool "
644 # Add another dash, and "on/off" are no longer offered:
645 res_test_gdb_complete_multiple \
646 "1 [expect_bool "-"]" \
647 "$cmd -bool " "-" "" $all_options
649 # Basic smoke tests of accepted / not accepted values.
651 # The command accepts all of "1/0/enable/disable/yes/no" too, even
652 # though like the "set" command, we don't offer those as
653 # completion candidates if you complete right after the boolean
654 # command's name, like:
656 # (gdb) maint test-options require-delimiter -bool [TAB]
659 # However, the completer does recognize them if you start typing
661 foreach value {"0" "1"} {
662 test_completer_recognizes \
663 "1 [expect_none ""]" \
666 foreach value {"of" "off"} {
667 res_test_gdb_complete_unique \
668 "1 [expect_none ""]" \
669 "$cmd -bool $value" \
672 foreach value {"y" "ye" "yes"} {
673 res_test_gdb_complete_unique \
674 "1 [expect_none ""]" \
675 "$cmd -bool $value" \
678 foreach value {"n" "no"} {
679 res_test_gdb_complete_unique \
680 "1 [expect_none ""]" \
681 "$cmd -bool $value" \
692 res_test_gdb_complete_unique \
693 "1 [expect_none ""]" \
694 "$cmd -bool $value" \
706 res_test_gdb_complete_unique \
707 "1 [expect_none ""]" \
708 "$cmd -bool $value" \
712 if {$variant == "require-delimiter"} {
713 res_test_gdb_complete_none \
714 "1 [expect_none "xxx"]" \
717 res_test_gdb_complete_none "0 xxx" "$cmd -bool xxx"
720 # The command accepts abbreviations of "enable/disable/yes/no",
721 # even though we don't offer those for completion.
731 gdb_test "$cmd -bool $value --" [expect_bool ""]
744 gdb_test "$cmd -bool $value --" [expect_none ""]
747 if {$variant == "require-delimiter"} {
748 gdb_test "$cmd -bool 999" [expect_none "-bool 999"]
750 gdb_test "$cmd -bool 999" [expect_bool "999"]
752 gdb_test "$cmd -bool -- 999" [expect_bool "999"]
754 # Since "on" is implied after a boolean option, for
755 # !require-delimiter commands, anything that is not
756 # yes/no/1/0/on/off/enable/disable should be considered as the raw
757 # input after the last option. Also check "o", which might look
758 # like "on" or "off", but it's treated the same.
760 foreach arg {"xxx" "o"} {
761 if {$variant == "require-delimiter"} {
762 gdb_test "$cmd -bool $arg" [expect_none "-bool $arg"]
764 gdb_test "$cmd -bool $arg" [expect_bool "$arg"]
767 # Also try -1. "unknown-is-error" commands error out saying that
768 # that's not a valid option.
769 if {$variant == "require-delimiter"} {
770 gdb_test "$cmd -bool -1" \
771 [expect_none "-bool -1"]
772 } elseif {$variant == "unknown-is-error"} {
773 gdb_test "$cmd -bool -1" \
774 "Unrecognized option at: -1"
776 gdb_test "$cmd -bool -1" [expect_bool "-1"]
779 # OTOH, if the "--" separator is present, then GDB errors out if
780 # the boolean option is passed an invalid value -- check that too.
781 gdb_test "$cmd -bool -1 999 --" \
782 "Unrecognized option at: -1 999 --"
783 gdb_test "$cmd -bool xxx 999 --" \
784 "Value given for `-bool' is not a boolean: xxx"
785 gdb_test "$cmd -bool o 999 --" \
786 "Value given for `-bool' is not a boolean: o"
788 # Completing after a boolean option + "o" does list "on/off",
790 if {$variant == "require-delimiter"} {
791 res_test_gdb_complete_multiple \
792 "1 [expect_none "o"]" \
793 "$cmd -bool " "o" "" {
798 res_test_gdb_complete_multiple "0 o" "$cmd -bool " "o" "" {
805 # Uinteger option tests. OPTION is which integer option we're
806 # testing. Can be "uinteger" or "zuinteger-unlimited".
807 proc_with_prefix test-uinteger {variant option} {
810 set cmd "[make_cmd $variant] -$option"
812 # Test completing a uinteger option:
813 res_test_gdb_complete_multiple \
814 "1 [expect_none ""]" \
820 # NUMBER above is just a placeholder, make sure we don't complete
821 # it as a valid option.
822 res_test_gdb_complete_none \
823 "1 [expect_none "NU"]" \
826 # "unlimited" is valid though.
827 res_test_gdb_complete_unique \
828 "1 [expect_none "u"]" \
832 # Basic smoke test of accepted / not accepted values.
833 gdb_test "$cmd 1 -- 999" [expect_integer $option "1" "999"]
834 gdb_test "$cmd unlimited -- 999" \
835 [expect_integer $option "unlimited" "999"]
836 if {$option == "zuinteger-unlimited"} {
837 gdb_test "$cmd -1 --" [expect_integer $option "unlimited" ""]
838 gdb_test "$cmd 0 --" [expect_integer $option "0" ""]
840 gdb_test "$cmd -1 --" "integer -1 out of range"
841 gdb_test "$cmd 0 --" [expect_integer $option "unlimited" ""]
843 gdb_test "$cmd xxx --" \
844 "Expected integer at: xxx --"
845 gdb_test "$cmd unlimitedx --" \
846 "Expected integer at: unlimitedx --"
848 # Don't offer completions until we're past the
849 # -uinteger/-zuinteger-unlimited argument.
850 res_test_gdb_complete_none \
851 "1 [expect_none ""]" \
854 # A number of invalid values.
855 foreach value {"x" "x " "1a" "1a " "1-" "1- " "unlimitedx"} {
856 res_test_gdb_complete_none \
857 "1 [expect_none $value]" \
862 if {$option == "uinteger"} {
863 # -1 is invalid uinteger.
864 foreach value {"-1" "-1 "} {
865 res_test_gdb_complete_none \
866 "1 [expect_none ""]" \
870 # -1 is valid for zuinteger-unlimited.
871 res_test_gdb_complete_none \
872 "1 [expect_none ""]" \
874 if {$variant == "require-delimiter"} {
875 res_test_gdb_complete_multiple \
876 "1 [expect_integer $option "unlimited" ""]" \
877 "$cmd -1 " "" "-" $all_options
879 res_test_gdb_complete_none "0 " "$cmd -1 "
883 # Check that after a fully parsed option:
885 # - for require-delimiter commands, completion offers all
888 # - for !require-delimiter commands, completion offers nothing
890 if {$variant == "require-delimiter"} {
891 res_test_gdb_complete_multiple \
892 "1 [expect_integer $option 1 ""]" \
893 "$cmd 1 " "" "-" $all_options
895 res_test_gdb_complete_none "0 " "$cmd 1 "
898 # Test completing non-option arguments after "-uinteger 1 ".
899 foreach operand {"x" "x " "1a" "1a " "1-" "1- "} {
900 if {$variant == "require-delimiter"} {
901 res_test_gdb_complete_none \
902 "1 [expect_integer $option 1 $operand]" \
905 res_test_gdb_complete_none "0 $operand" "$cmd 1 $operand"
908 # These look like options, but they aren't.
909 foreach operand {"-1" "-1 "} {
910 if {$variant == "unknown-is-operand"} {
911 res_test_gdb_complete_none "0 $operand" "$cmd 1 $operand"
913 res_test_gdb_complete_none \
914 "1 [expect_integer $option 1 $operand]" \
921 proc_with_prefix test-enum {variant} {
922 set cmd [make_cmd $variant]
924 res_test_gdb_complete_multiple \
925 "1 [expect_none ""]" \
926 "$cmd -enum " "" "" {
932 # Check that "-" where a value is expected does not show the
933 # command's options. I.e., an enum's value is not optional.
934 # Check both completion and running the command.
935 res_test_gdb_complete_none \
936 "1 [expect_none "-"]" \
938 gdb_test "$cmd -enum --"\
939 "Requires an argument. Valid arguments are xxx, yyy, zzz\\."
941 # Try passing an undefined item to an enum option.
942 gdb_test "$cmd -enum www --" "Undefined item: \"www\"."
945 # Run the options framework tests first.
946 foreach_with_prefix cmd {
954 foreach subcmd {"uinteger" "zuinteger-unlimited" } {
955 test-uinteger $cmd $subcmd
960 # Run the print integration tests, both as "standalone", and under
961 # "frame/thread apply". The latter checks that the "frame/thread
962 # apply ... COMMAND" commands recurse the completion machinery for
963 # COMMAND completion correctly.
968 "frame apply level 0 "
971 "thread apply 1 frame apply 1 "
976 # Same for "compile print". Not really a wrapper prefix command like
977 # "frame apply", but similar enough that we test pretty much the same
979 if ![skip_compile_feature_tests] {
980 test-print "compile "
983 # Basic "backtrace" integration tests.
986 # Basic "frame apply" integration tests.
989 # Basic "thread apply" integration tests.
992 # Basic "info threads" integration tests.