1192908Szml# Copyright 2011 Free Software Foundation, Inc. 2192908Szml 3192908Szml# This program is free software; you can redistribute it and/or modify 4192908Szml# it under the terms of the GNU General Public License as published by 5192908Szml# the Free Software Foundation; either version 3 of the License, or 6192908Szml# (at your option) any later version. 7192908Szml# 8192908Szml# This program is distributed in the hope that it will be useful, 9192908Szml# but WITHOUT ANY WARRANTY; without even the implied warranty of 10192908Szml# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11192908Szml# GNU General Public License for more details. 12192908Szml# 13192908Szml# You should have received a copy of the GNU General Public License 14192908Szml# along with this program. If not, see <http://www.gnu.org/licenses/>. 15192908Szml 16192908Szml# Create a GDB script that we can source. The script needs to generate 17192908Szml# some output, to allow us to verify that it is executed properly. 18192908Szmlset fd [open "zzz-gdbscript" "w"] 19192908Szmlputs $fd "print 1" 20192908Szmlputs $fd "print 2" 21192908Szmlclose $fd 22192908Szml 23192908Szml# The expected output from the script... 24192908Szmlset script_output "\\$\[0-9\]+ = 1\[\r\n\]+\\$\[0-9\]+ = 2.*" 25192908Szml 26192908Szml# Start a fresh GDB. We don't need an executable for this test, so 27192908Szml# nothing else to do in terms of testcase setup. 28192908Szmlgdb_exit 29296929Scemgdb_start 30192908Szml 31192908Szml# Test sourcing of the script with interactive mode `auto'. 32192908Szml# Verify that evaluating the script does not cause an unexpected 33192908Szml# change of the interactive-mode setting. 34296927Scemgdb_test_no_output "set interactive-mode auto" 35296927Scemgdb_test "source zzz-gdbscript" "$script_output" \ 36192908Szml "source script with interactive-mode auto" 37192908Szmlgdb_test "print 3" "= 3" "sanity check with interactive-mode auto" 38192908Szmlgdb_test "show interactive-mode" \ 39192908Szml "Debugger's interactive mode is auto \\(currently .*\\)\\." \ 40296927Scem "show interactive-mode (auto)" 41192908Szml 42192908Szml# Test sourcing of the script with interactive mode `on'. 43192908Szml# Verify that evaluating the script does not cause an unexpected 44192908Szml# change of the interactive-mode setting. 45192908Szmlgdb_test_no_output "set interactive-mode on" 46192908Szmlgdb_test "source zzz-gdbscript" "$script_output" \ 47296927Scem "source script with interactive-mode on" 48296927Scemgdb_test "print 4" "= 4" "sanity check with interactive-mode on" 49192908Szmlgdb_test "show interactive-mode" \ 50192908Szml "Debugger's interactive mode is on\\." \ 51192908Szml "show interactive-mode (on)" 52192908Szml 53296927Scem# Test sourcing of the script with interactive mode `off'. 54192908Szml# Verify that evaluating the script does not cause an unexpected 55192908Szml# change of the interactive-mode setting. 56192978Szmlgdb_test_no_output "set interactive-mode off" 57192978Szmlgdb_test "source zzz-gdbscript" "$script_output" \ 58192978Szml "source script with interactive-mode off" 59192978Szmlgdb_test "print 5" "= 5" "sanity check with interactive-mode off" 60192978Szmlgdb_test "show interactive-mode" \ 61192908Szml "Debugger's interactive mode is off\\." \ 62192908Szml "show interactive-mode (off)" 63192908Szml 64192908Szml