2014-06-10 Luis Machado <lgustavo@codesourcery.com>
gdb/testsuite
* gdb.base/maint.exp: Prevent testing operations that involve
linux tools on targets that do not support them.
Make used space pattern optional.
@@ -46,6 +46,13 @@
#
+# Some targets do not support 'ls', 'grep' and 'rm', like Windows.
+# Set the flag here so we don't attempt to test things using those tools
+# later on.
+set linux_tools_supported 1
+if { [ishost *-*-*mingw*] } {
+ set linux_tools_supported 0
+}
standard_testfile break.c break1.c
@@ -132,8 +139,11 @@ gdb_test_no_output "maint check-symtabs"
gdb_test_no_output "maint set per-command on"
+# Information about space used is not available on some targets, like
+# Windows. Therefore that pattern is optional in the following regular
+# expression.
gdb_test "maint set per-command off" \
- "Command execution time: \[0-9.\]+ \\(cpu\\), \[0-9.\]+ \\(wall\\)\[\r\n\]+Space used: $decimal \\(\\+$decimal for this command\\)\[\r\n\]+#symtabs: $decimal \\(\\+$decimal\\), #primary symtabs: $decimal \\(\\+$decimal\\), #blocks: $decimal \\(\\+$decimal\\)"
+ "Command execution time: \[0-9.\]+ \\(cpu\\), \[0-9.\]+ \\(wall\\)\[\r\n\]+(Space used: $decimal \\(\\+$decimal for this command\\)\[\r\n\]+)?#symtabs: $decimal \\(\\+$decimal\\), #primary symtabs: $decimal \\(\\+$decimal\\), #blocks: $decimal \\(\\+$decimal\\)"
gdb_test "maint demangle" \
"\"maintenance demangle\" takes an argument to demangle\\."
@@ -218,7 +228,7 @@ gdb_test "maint print psymbols" \
"print-psymbols takes an output file name and optional symbol file name" \
"maint print psymbols w/o args"
-if { ! $have_gdb_index } {
+if { ! $have_gdb_index && $linux_tools_supported } {
set psymbols_output [standard_output_file psymbols_output]
send_gdb "maint print psymbols $psymbols_output ${srcdir}/${subdir}/${srcfile}\n"
gdb_expect {
@@ -259,6 +269,7 @@ gdb_test "maint print msymbols" \
"maint print msymbols w/o args"
+if { $linux_tools_supported } {
set msymbols_output [standard_output_file msymbols_output]
send_gdb "maint print msymbols $msymbols_output ${binfile}\n"
gdb_expect {
@@ -327,6 +338,7 @@ gdb_test_multiple "maint print msymbols msymbols_output2 ${testfile}" "maint pri
gdb_test "cd ${mydir}" \
"Working directory [string_to_regexp ${mydir}]\..*" \
"cd to mydir"
+}
gdb_test "maint print symbols" \
"Arguments missing: an output file name and an optional symbol file name" \
@@ -337,6 +349,7 @@ gdb_test "maint print symbols" \
# dump the symbol information for the entire C library - over 500MB nowadays
# for GNU libc.
+if { $linux_tools_supported } {
set symbols_output [standard_output_file symbols_output]
send_gdb "maint print symbols $symbols_output ${srcdir}/${subdir}/${srcfile}\n"
gdb_expect {
@@ -363,6 +376,7 @@ gdb_expect {
-re ".*$gdb_prompt $" { fail "maint print symbols" }
timeout { fail "(timeout) maint print symbols" }
}
+}
set msg "maint print type"
gdb_test_multiple "maint print type argc" $msg {