gdb/testsuite: Make test names unique in gdb.linespec tests
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.linespec / ls-errs.exp
index 1f78ca69230ab3ce55c7e3e6e19c4e8a5e04b375..0743d89bfafbb5688b303bac5013293d61d90f32 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2012-2017 Free Software Foundation, Inc.
+# Copyright 2012-2019 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -92,12 +92,18 @@ proc do_test {lang} {
 
        gdb_test "break $linespec" [string_to_regexp \
                                    [eval format \$error_messages($msg_id) \
-                                    $args]]
+                                    $args]] \
+           "'break $linespec'"
     }
 
     # Some commonly used whitespace tests around ':'.
-    set spaces [list ":" ": " " :" " : " "\t:  " "  :\t" "\t:\t" \
-                    " \t:\t " "\t  \t:\t  \t  \t"]
+    set spaces [list \
+                   ":" \
+                   ": " \
+                   " :" \
+                   " : " \
+                   "  :  " \
+                  ]
 
     # A list of invalid offsets.
     set invalid_offsets [list -100 +500 1000]
@@ -112,10 +118,10 @@ proc do_test {lang} {
     foreach x $invalid_offsets {
        set offset $x
 
-       # Relative offsets are relative to line 16.  Adjust
+       # Relative offsets are relative to the current line.  Adjust
        # expected offset from error message accordingly.
        if {[string index $x 0] == "+" || [string index $x 0] == "-"} {
-           incr offset 24
+           incr offset $bp_location
        }
        test_break $x invalid_offset $offset
        test_break "-line $x" invalid_offset $offset
@@ -167,11 +173,14 @@ proc do_test {lang} {
        test_break "-source $x -line 3" invalid_file [string trim $x \"']
     }
 
-    # Test that option lexing stops at whitespace boundaries
-    test_break "-source this file has spaces.c -line 3" invalid_file "this"
-    test_break "-function function whitespace" invalid_function "function"
-    test_break "-source $srcfile -function function whitespace" \
-              invalid_function_f "function" $srcfile
+    # Test that option lexing stops at whitespace boundaries, except
+    # when lexing function names, where we want to handle setting
+    # breakpoints on e.g., "int template_function<int>()".
+    test_break "-source this file has spaces.c -line 3" source_incomplete
+    test_break "-function ret_type tmpl_function" \
+       invalid_function "ret_type tmpl_function"
+    test_break "-source $srcfile -function ret_type tmpl_function" \
+              invalid_function_f "ret_type tmpl_function" $srcfile
 
     test_break "-function main -label label whitespace" \
               invalid_label "label" "main"
@@ -223,16 +232,18 @@ proc do_test {lang} {
 
     foreach x $spaces {
        test_break "main${x}there" invalid_label "there" "main"
-       if {[test_compiler_info {clang-*-*}]} {
-           setup_xfail clang/14500 *-*-*
-       }
        test_break "main:here${x}" unexpected "end of input"
     }
 
-    foreach x {"3" "+100" "-100" "foo"} {
+    foreach_with_prefix x {"3" "+100" "-100" "foo"} {
        test_break "main 3" invalid_function "main 3"
        test_break "-function \"main $x\"" invalid_function "main $x"
-       test_break "main:here $x" invalid_label "here $x" "main"
+       if {$x == "foo"} {
+           test_break "main:here $x" unexpected_opt "string" $x
+       } else {
+           test_break "main:here $x" unexpected_opt "number" $x
+       }
+
        test_break "-function main -label \"here $x\"" \
                   invalid_label "here $x" "main"
     }
@@ -254,6 +265,7 @@ proc do_test {lang} {
 
     # Explicit linespec-specific tests
     test_break "-source $srcfile" source_incomplete
+    test_break "-source $srcfile main" source_incomplete
 }
 
 foreach_with_prefix lang {"C" "C++"} {
This page took 0.026778 seconds and 4 git commands to generate.