1# Copyright 2016-2020 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# The -trace-save command is already tested in other files (e.g. 17# mi-trace-frame-collected.exp), so this file currently only tests the error 18# cases of -trace-save. 19 20load_lib mi-support.exp 21 22mi_gdb_start 23 24# Test with the wrong number of arguments. 25 26proc test_trace_save_wrong_num_args { } { 27 set err_re [string_to_regexp "^error,msg=\"Exactly one argument required (file in which to save trace data)\""] 28 29 mi_gdb_test "-trace-save" "$err_re" "-trace-save with missing argument" 30 mi_gdb_test "-trace-save a b" "$err_re" "-trace-save with too many arguments" 31} 32 33# Test with an unrecognized option. 34 35proc test_trace_save_wrong_opt { } { 36 set err_re [string_to_regexp "^error,msg=\"-trace-save: Unknown option ``hey''\""] 37 38 mi_gdb_test "-trace-save -hey" "$err_re" "-trace-save with wrong option" 39} 40 41test_trace_save_wrong_num_args 42test_trace_save_wrong_opt 43