From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16695 invoked by alias); 23 Jan 2015 00:21:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16663 invoked by uid 89); 23 Jan 2015 00:20:58 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT autolearn=no version=3.3.2 X-HELO: mailhost.u-strasbg.fr Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.222.216) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Jan 2015 00:20:54 +0000 Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antispam (Postfix) with ESMTP id C43B514140F; Fri, 23 Jan 2015 01:20:51 +0100 (CET) Received: from mailhost.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id B345F141418; Fri, 23 Jan 2015 01:20:51 +0100 (CET) Received: from lmr.u-strasbg.fr (lmr1.u-strasbg.fr [172.30.21.1]) by mr6.u-strasbg.fr (Postfix) with ESMTP id 929D614140F; Fri, 23 Jan 2015 01:20:49 +0100 (CET) Received: from lmr.u-strasbg.fr (localhost [127.0.0.1]) by antivirus (Postfix) with ESMTP id 55821F1; Fri, 23 Jan 2015 01:20:49 +0100 (CET) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (Authenticated sender: mullerp) by lmr1.u-strasbg.fr (Postfix) with ESMTPSA id 9FEACEE; Fri, 23 Jan 2015 01:20:46 +0100 (CET) From: "Pierre Muller" To: "'Pedro Alves'" Cc: "'gdb-patches'" References: <54ae4586.01e3440a.7b06.fffff844SMTPIN_ADDED_BROKEN@mx.google.com> <54AE605A.8050308@redhat.com> <54ae7f9f.c323460a.36ed.ffffff30SMTPIN_ADDED_BROKEN@mx.google.com> <54AE8914.4010507@redhat.com> <54ae911b.85e3440a.1d96.5ffdSMTPIN_ADDED_BROKEN@mx.google.com> <54AFB2E5.5080307@redhat.com> <54afff6b.ee8d440a.16ee.ffffb424SMTPIN_ADDED_BROKEN@mx.google.com> <54C0F10E.60402@redhat.com> In-Reply-To: <54C0F10E.60402@redhat.com> Subject: [RFA PATCH 3/3 V3] Testcase for pascal/17815 Date: Fri, 23 Jan 2015 07:16:00 -0000 Message-ID: <002c01d036a2$7015e7b0$5041b710$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-01/txt/msg00630.txt.bz2 Hi Pedro, > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pedro Alves > Envoy=E9=A0: jeudi 22 janvier 2015 13:46 > =C0=A0: Pierre Muller > Cc=A0: 'gdb-patches' > Objet=A0: Re: [RFA PATCH 3/3] Testcase for pascal/17815 >=20 > Thanks for adding the test case. >=20 > On 01/09/2015 04:18 PM, Pierre Muller wrote: > > This adds the testcase for pascal/17815 bug report. > > > > > > gdb/testsuite/Changelog entry: > > > > 2015-01-09 Pierre Muller > > > > gdb.pascal/gdb17815.pas: New file. > > gdb.pascal/gdb17815.exp: New file. >=20 > Missing '*'.=20 Fixed below. > Can you please pick a more descriptive name for the file? > One that suggests what's being tested, rather than a bug > number is ideal. E.g., gdb.pascal/case-insensitive.{exp|pas}. =20 I used your suggestion, but this is not really a general case insensitiveness test... =20 > > +load_lib "pascal.exp" > > + > > +standard_testfile .pas > > + > > +if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" > "${binfile}" > > executable [list debug class]] !=3D "" } { > > + untested $testfile.exp > > + return -1 > > +} > > + > > +clean_restart ${testfile} > > +set bp_location [gdb_get_line_number "set breakpoint here"] > > + > > +if { [gdb_breakpoint ${srcfile}:${bp_location}] } { > > + pass "setting breakpoint" > > +} > > + > > +# Verify that "start" lands inside the right procedure. > > +if { [gdb_start_cmd] < 0 } { > > + untested start > > + return -1 > > +} > > + > > +gdb_test "" ".* at .*${srcfile}.*" "start" > > +gdb_test "continue" "" >=20 > I won't object to this, given that it seems like all > pascal tests do it, but I'll note that it's best to avoid > gdb_start_cmd unless we're really testing the "start" command, > as otherwise the test won't run against gdbserver > (try --target_board=3Dnative-gdbserver). Doesn't runto_main > work? No, I tried and using runto_main, I got only failures, because it apparently did not stop at all on the breakpoint set earlier... Is there some code inside runto_main that deleted previously installed breakpoints? Why is that so? I kept gdb_start_cmd for now. > > +# We are now inside CHECK method >=20 > Could you add a period at end of sentences? Here and throughout. Tried to do it below. > > +gdb_test "p X" " =3D 67" > > +gdb_test "p B.X" " =3D -1" > > +# As A is global, we can also check it global value > ^^ > Should be "its". >=20 > Or, "check its value"? What's a _global_ value? Comment adapted.=20 > > +gdb_test "p A.X" " =3D 67" > > +gdb_test "p Y" " =3D 33" > > +gdb_test "p Y" " =3D 33" >=20 > Duplicate test here. Please try the recipe at: > https://sourceware.org/gdb/wiki/GDBTestcaseCookbook#Make_sure_test_mess > ages_are_unique I used this, and got no duplicate in the new version below. > Thanks, Thank you for the review, here is an updated RFA. Pierre Muller gdb/testsuite/ChangeLog entry: 2015-01-23 Pierre Muller PR pascal/17815 * gdb.pascal/case-insensitive.pas: New file. * gdb.pascal/case-insensitive.exp: New file. --- gdb/testsuite/gdb.pascal/case-insensitive.exp | 62 +++++++++++++++++++++++++++ gdb/testsuite/gdb.pascal/case-insensitive.pas | 61 ++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 gdb/testsuite/gdb.pascal/case-insensitive.exp create mode 100644 gdb/testsuite/gdb.pascal/case-insensitive.pas diff --git a/gdb/testsuite/gdb.pascal/case-insensitive.exp b/gdb/testsuite/gdb.pascal/case-insensitive.exp new file mode 100644 index 0000000..cbeae90 --- /dev/null +++ b/gdb/testsuite/gdb.pascal/case-insensitive.exp @@ -0,0 +1,62 @@ +# Copyright 2015 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 . + +load_lib "pascal.exp" + +standard_testfile .pas + +if {[gdb_compile_pascal "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug class]] !=3D "" } { + untested $testfile.exp + return -1 +} + +clean_restart ${testfile} +set bp_location [gdb_get_line_number "set breakpoint here"] + +if { [gdb_breakpoint ${srcfile}:${bp_location}] } { + pass "setting breakpoint" +} + +# Verify that "start" lands inside the right procedure. +if { [gdb_start_cmd] < 0 } { + untested start + return -1 +} + +gdb_test "continue" "" +# We are now inside CHECK method. +gdb_test "p X" " =3D 67" +gdb_test "p B.X" " =3D -1" +# As A is global, we can also check its value. +gdb_test "p A.X" " =3D 67" +gdb_test "p Y" " =3D 33" +gdb_test "p B.Y" " =3D -1" +gdb_test "p A.Y" " =3D 33" +# Now test lowercase version. +gdb_test "p x" " =3D 67" +gdb_test "p B.x" " =3D -1" +# As A is global, we can also check its value, with lowercase. +gdb_test "p A.x" " =3D 67" +gdb_test "p y" " =3D 33" +gdb_test "p B.y" " =3D -1" +gdb_test "p A.y" " =3D 33" +# Also test lowercase class names. +gdb_test "p b.X" " =3D -1" +gdb_test "p b.x" " =3D -1" +gdb_test "p a.Y" " =3D 33" +gdb_test "p a.y" " =3D 33" + +gdb_exit + diff --git a/gdb/testsuite/gdb.pascal/case-insensitive.pas b/gdb/testsuite/gdb.pascal/case-insensitive.pas new file mode 100644 index 0000000..870bd34 --- /dev/null +++ b/gdb/testsuite/gdb.pascal/case-insensitive.pas @@ -0,0 +1,61 @@ +{ + Copyright 2015 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 . +} + + +program test_gdb_17815; + + +type + TA =3D class + public + x, y : integer; + constructor Create; + function check(b : TA) : boolean; + destructor Done; virtual; +end; + +constructor TA.Create; +begin + x:=3D-1; + y:=3D-1; +end; + +destructor TA.Done; +begin +end; + +function TA.check (b : TA) : boolean; +begin + check:=3D(x < b.x); { set breakpoint here } +end; + + + +var + a, b : TA; + +begin + a:=3DTA.Create; + b:=3DTA.Create; + a.x :=3D 67; + a.y :=3D 33; + if a.check (b) then + writeln('Error in check') + else + writeln('check OK'); +end. + --=20 2.1.4