This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell. [MinGW question]


On Tue, Aug 16, 2011 at 11:00 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> On Tue, 16 Aug 2011 19:25:21 +0200, Abhijit Halder wrote:
>> --- src/gdb/testsuite/gdb.base/pipe.c 2011-08-16 22:37:37.785351001 +0530
>> +++ dst/gdb/testsuite/gdb.base/pipe.c 2011-08-16 22:32:40.213350709 +0530
>
> There isn't needed any .c file.
>
>> diff -rup src/gdb/testsuite/gdb.base/pipe.exp dst/gdb/testsuite/gdb.base/pipe.exp
>> --- src/gdb/testsuite/gdb.base/pipe.exp ? ? ? 2011-08-16 22:37:45.969351119 +0530
>> +++ dst/gdb/testsuite/gdb.base/pipe.exp ? ? ? 2011-08-16 22:35:34.117356781 +0530
>> @@ -0,0 +1,49 @@
>> +# ? Copyright 2011 Free Software Foundation, Inc.
>> +
>> +# This program is free software; you can redistribute it and/or modify
>> +# it under the terms of the GNU General Public License as published by
>> +# the Free Software Foundation; either version 3 of the License, or
>> +# (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ?See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program. ?If not, see <http://www.gnu.org/licenses/>.
>> +
>> +#
>> +# test gdb pipe commands
>> +#
>> +
>> +if $tracelevel then {
>> + ? ?strace $tracelevel
>> +}
>
> This is rather redundant, please see:
> ? ? ? ?http://sourceware.org/gdb/wiki/GDBTestcaseCookbook
>
>
>> +
>> +set testfile "pipe"
>> +set srcfile ${testfile}.c
>> +set binfile ${objdir}/${subdir}/${testfile}
>> +if ?{ [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
>> + ? ?untested pipe.exp
>> + ? ?return -1
>> +}
>> +
>> +if [get_compiler_info ${binfile}] {
>> + ? ?return -1
>> +}
>> +
>> +gdb_exit
>> +gdb_start
>> +gdb_reinitialize_dir ${srcdir}/${subdir}
>> +gdb_load ${binfile}
>> +
>> +set end_main [gdb_get_line_number " end main " $srcfile]
>> +
>> +if ![runto_main] then {
>> + ? ?fail "Can't run to main"
>> + ? ?return 0
>> +}
>
> Just keep gdb_exit and gdb_start from all of this.
>
>
>> +
>> +gdb_test "pipe | bt | grep \"main\"" "\#0.*main.*().*at.*${srcfile}:${end_main}"
>> +
>
> I would not use `bt' which is very complicated and for the `pipe'
> functionality arbitrary command - such as `print' - is enough.
>
> But it is more important to test various many cases of pipe, such as various
> non-standard delimiters besides "|", also the redirection of shell output,
> using pipe in the shell part (double/triple pipe), testing the error cases
> that they are caught correctly etc.
>
>
> Thanks,
> Jan
>

Here is the correction.
diff -rup src/gdb/testsuite/gdb.base/pipe.exp dst/gdb/testsuite/gdb.base/pipe.exp
--- src/gdb/testsuite/gdb.base/pipe.exp	2011-08-16 22:37:45.969351119 +0530
+++ dst/gdb/testsuite/gdb.base/pipe.exp	2011-08-17 13:49:26.195383001 +0530
@@ -0,0 +1,37 @@
+#   Copyright 2011 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+#
+# test gdb pipe commands
+#
+
+set testfile "pipe"
+set tempfile "temp.xxx"
+
+gdb_exit
+gdb_start
+
+gdb_test "pipe" "No argument is specified"
+gdb_test "pipe |" "No gdb-command is specified"
+gdb_test "pipe -x" "Delimiter pattern should not start with '-'"
+gdb_test "pipe | print 'x'" "No shell-command is specified"
+gdb_test "pipe | print 'x' |< cat" "No shell-command is specified"
+gdb_test "pipe |< print 'x' | cat" "No shell-command is specified"
+gdb_test "pipe | print 'x' >| cat" "No shell-command is specified"
+gdb_test "pipe >| print 'x' | cat" "No shell-command is specified"
+gdb_test "pipe | print 'x' | cat" " = 120 'x'"
+gdb_test "pipe | print 'x' | cat | cat" " = 120 'x'"
+gdb_test "pipe | p 'x' | cat >$tempfile ; if \[ -f $tempfile \] ; \
+          then echo \"SUCCESS\" ; rm -f $tempfile ; fi" "SUCCESS"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]