Home | History | Annotate | Line # | Download | only in gdb.base
      1 # Copyright 2024 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 
     16 # Test doing a "run" that fails, and then another "run".
     17 
     18 require target_can_use_run_cmd
     19 
     20 standard_testfile
     21 
     22 if {[build_executable "failed to build" $testfile $srcfile {debug}]} {
     23     return -1
     24 }
     25 
     26 proc test_run {testname} {
     27     gdb_test_multiple "run" $testname {
     28 	-re -wrap "During startup program exited with code 126\\." {
     29 	    # What we get on GNU/Linux.
     30 	    pass $gdb_test_name
     31 	}
     32 	-re -wrap "Error creating process.*" {
     33 	    # What we get on Windows.
     34 	    pass $gdb_test_name
     35 	}
     36 	-re -wrap "Running .* on the remote target failed" {
     37 	    # What we get with remote targets.
     38 	    pass $gdb_test_name
     39 	}
     40     }
     41 }
     42 
     43 proc_with_prefix test {} {
     44     global gdb_prompt binfile
     45 
     46     clean_restart $binfile
     47 
     48     gdb_test_no_output "set confirm off"
     49 
     50     gdb_remote_download host $binfile $binfile.nox
     51     remote_exec target "chmod \"a-x\" $binfile.nox"
     52     gdb_test_no_output \
     53 	"exec-file $binfile.nox" \
     54 	"exec-file \$binfile.nox"
     55     gdb_test_no_output \
     56 	"set remote exec-file $binfile.nox" \
     57 	"set remote exec-file \$binfile.nox"
     58 
     59     test_run "bad run 1"
     60     test_run "bad run 2"
     61 }
     62 
     63 test
     64