Blame SOURCES/gdb-6.5-readline-long-line-crash-test.patch

01917d
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
01917d
01917d
01917d
Index: ./gdb/testsuite/gdb.base/readline-overflow.exp
01917d
===================================================================
01917d
RCS file: ./gdb/testsuite/gdb.base/readline-overflow.exp
01917d
diff -N ./gdb/testsuite/gdb.base/readline-overflow.exp
01917d
--- /dev/null	1 Jan 1970 00:00:00 -0000
01917d
+++ ./gdb/testsuite/gdb.base/readline-overflow.exp	13 Nov 2006 23:42:50 -0000
01917d
@@ -0,0 +1,125 @@
01917d
+# Copyright 2006 Free Software Foundation, Inc.
01917d
+
01917d
+# This program is free software; you can redistribute it and/or modify
01917d
+# it under the terms of the GNU General Public License as published by
01917d
+# the Free Software Foundation; either version 2 of the License, or
01917d
+# (at your option) any later version.
01917d
+# 
01917d
+# This program is distributed in the hope that it will be useful,
01917d
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
01917d
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
01917d
+# GNU General Public License for more details.
01917d
+# 
01917d
+# You should have received a copy of the GNU General Public License
01917d
+# along with this program; if not, write to the Free Software
01917d
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
01917d
+
01917d
+# Please email any bugs, comments, and/or additions to this file to:
01917d
+# bug-gdb@prep.ai.mit.edu
01917d
+
01917d
+# This file was written by Jan Kratochvil <jan.kratochvil@redhat.com>
01917d
+
01917d
+# This file is part of the gdb testsuite.
01917d
+
01917d
+#
01917d
+# Tests for readline buffer overflow.
01917d
+#
01917d
+
01917d
+if $tracelevel {
01917d
+  strace $tracelevel
01917d
+}
01917d
+
01917d
+# Don't let a .inputrc file or an existing setting of INPUTRC mess up
01917d
+# the test results.  Even if /dev/null doesn't exist on the particular
01917d
+# platform, the readline library will use the default setting just by
01917d
+# failing to open the file.  OTOH, opening /dev/null successfully will
01917d
+# also result in the default settings being used since nothing will be
01917d
+# read from this file.
01917d
+global env
01917d
+if [info exists env(INPUTRC)] {
01917d
+    set old_inputrc $env(INPUTRC)
01917d
+}
01917d
+set env(INPUTRC) "/dev/null"
01917d
+
01917d
+set oldtimeout1 $timeout
01917d
+set timeout 600
01917d
+
01917d
+if [info exists env(GDBHISTFILE)] {
01917d
+    set old_gdbhistfile $env(GDBHISTFILE)
01917d
+}
01917d
+if [info exists env(HISTSIZE)] {
01917d
+    set old_histsize $env(HISTSIZE)
01917d
+}
01917d
+set env(GDBHISTFILE) "${srcdir}/${subdir}/gdb_history"
01917d
+set env(HISTSIZE) "10"
01917d
+
01917d
+gdb_exit
01917d
+gdb_start
01917d
+gdb_reinitialize_dir $srcdir/$subdir
01917d
+
01917d
+
01917d
+set width 11
01917d
+gdb_test "set width $width" \
01917d
+         "" \
01917d
+         "Setting width to $width."
01917d
+#gdb_test "set height 1" \
01917d
+#         "" \
01917d
+#         "Setting height to 1."
01917d
+send_gdb "run X"
01917d
+set i 0
01917d
+# It crashes using `set width 7' on `set total 3560'.
01917d
+# Sometimes it corrupts screen on `set width 7'.
01917d
+# Bugreport used `set total 130001':
01917d
+# 	https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196
01917d
+# Check also `timeout' above.
01917d
+set total 4200
01917d
+gdb_expect {
01917d
+	-re X {
01917d
+		incr i
01917d
+		if {$i <= $total} {
01917d
+			send_gdb "X"
01917d
+			exp_continue
01917d
+		}
01917d
+	}
01917d
+	-re "\[ \b\r\n\]" {
01917d
+		exp_continue
01917d
+	}
01917d
+	eof {
01917d
+		fail "gdb sending total $total characters"
01917d
+		note "Failed after sending $i characters, reason: EOF"
01917d
+		gdb_clear_suppressed
01917d
+	}
01917d
+	timeout {
01917d
+		fail "gdb sending total $total characters"
01917d
+		note "Failed after sending $i characters (timeout $timeout), reason: TIMEOUT"
01917d
+		gdb_clear_suppressed
01917d
+	}
01917d
+	default {
01917d
+		fail "gdb sending total $total characters"
01917d
+		note "Failed after sending $i characters, reason: 0=\[$expect_out(0,string)\] buffer=\[$expect_out(buffer)\]"
01917d
+		gdb_clear_suppressed
01917d
+	}
01917d
+}
01917d
+gdb_test "\r" \
01917d
+         "No executable file specified..*" \
01917d
+         "All the characters transferred"
01917d
+
01917d
+
01917d
+# Restore globals modified in this test...
01917d
+if [info exists old_inputrc] {
01917d
+    set env(INPUTRC) $old_inputrc
01917d
+} else {
01917d
+    unset env(INPUTRC)
01917d
+}
01917d
+if [info exists old_gdbhistfile] {
01917d
+    set env(GDBHISTFILE) $old_gdbhistfile
01917d
+} else {
01917d
+    unset env(GDBHISTFILE)
01917d
+}
01917d
+if [info exists old_histsize] {
01917d
+    set env(HISTSIZE) $old_histsize
01917d
+} else {
01917d
+    unset env(HISTSIZE)
01917d
+}
01917d
+set timeout $oldtimeout1
01917d
+
01917d
+return 0