]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.guile/guile.exp
Update copyright year range in all GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.guile / guile.exp
CommitLineData
42a4f53d 1# Copyright (C) 2008-2019 Free Software Foundation, Inc.
ed3ef339
DE
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# This file is part of the GDB testsuite.
17# It tests basic Guile features.
18
19load_lib gdb-guile.exp
20
21# Start with a fresh gdb.
22gdb_exit
23gdb_start
24gdb_reinitialize_dir $srcdir/$subdir
25
26# Do this instead of the skip_guile_check.
27# We want to do some tests when Guile is not present.
28gdb_test_multiple "guile (display 23) (newline)" "verify guile support" {
29 -re "Undefined command.*$gdb_prompt $" {
bc6c7af4 30 unsupported "guile not supported."
ed3ef339
DE
31 return
32 }
33 -re "not supported.*$gdb_prompt $" {
34 unsupported "guile support is disabled"
35
36 # If Guile is not supported, verify that sourcing a guile script
37 # causes an error.
38 gdb_test "source $srcdir/$subdir/source2.scm" \
39 "Error in sourced command file:.*" \
40 "source source2.scm when guile disabled"
51b8d20c
DE
41
42 # Verify multi-line guile commands cause an error.
43 gdb_test_multiline "multi-line guile command" \
44 "guile" "" \
45 "(print 23)" "" \
46 "end" "not supported.*"
47
ed3ef339
DE
48 return
49 }
50 -re "$gdb_prompt $" {}
51}
52
53gdb_install_guile_utils
54gdb_install_guile_module
55
56gdb_test_multiline "multi-line guile command" \
57 "guile" "" \
58 "(print 23)" "" \
59 "end" "= 23"
60
61gdb_test_multiline "show guile command" \
62 "define zzq" "Type commands for definition of .* just \"end\"\\.*" \
63 "guile" "" \
64 "(print 23)" "" \
65 "end" "" \
66 "end" "" \
67 "show user zzq" "User command \"zzq\":.* guile.*\\(print 23\\).* end"
68
69gdb_test "source $srcdir/$subdir/source2.scm" "yes" "source source2.scm"
70
71gdb_test "source -s source2.scm" "yes" "source -s source2.scm"
72
73gdb_test "guile (print (current-objfile))" "= #f"
74gdb_test "guile (print (objfiles))" "= \\(\\)"
75
76gdb_test_no_output \
77 {guile (define x (execute "printf \"%d\", 23" #:to-string #t))}
78gdb_test "guile (print x)" "= 23"
79
80gdb_test_no_output "guile (define a (execute \"help\" #:to-string #t))" \
81 "collect help from uiout"
82
83gdb_test "guile (print a)" "= .*aliases -- Aliases of other commands.*" \
84 "verify help to uiout"