GSoc GDB pretty printers: Automatic testing and printing class pointers

Da Viper yerimyah1 at gmail.com
Tue Jul 6 12:54:38 BST 2021


Hello thanks for the above way to auto test the printers, however it maybe
hard to only test what matters the variables as the diff may include texts
not related to the variables, and may need to rewrite test and the cpp file

I was looking at the way boost implement it printers [here](
https://github.com/ruediger/Boost-Pretty-Printer/blob/master/tests/testsuite.py
).
i would try to implement something of that sort if it does not work i will
fall back to creating the gdb  batch test

thanks

On Mon, 5 Jul 2021 at 09:23, Ralf Habacker <ralf.habacker at freenet.de> wrote:

>         Am 02.07.21 um 11:55 schrieb Thomas Baumgart:
> > On Mittwoch, 30. Juni 2021 20:09:27 CEST Da Viper wrote:
> >
> > [...]
> >
> >> The current problem i am facing now is how to automate the test cases,
> >> i am not sure how to go about that, it is to make sure that older
> classes
> >> are not affected when new printer classes are created
> >
> > I investigated this a bit and here's what I came up with: you can use
> > the gdb -batch mode feature to automate tests, collect the results in a
> > first run and store them as ground truth. When run again, compare the
> > current output against the ground truth and make sure it does not differ.
> >
> > Here's what I did in the tests subdir:
> >
> > a) I compiled your test program with
> >
> >    g++ -g -I /usr/include/qt5/QtCore/ -I /usr/include/qt5  -lstdc++
> -lQt5Core -o test qstring.cpp
> >
> > b) Next I wrote a file and called it 'autotest'. Its content is
> >
> > ---8<---
> > file test
> > break main
> > run
> > n
> > p str
> > n
> > p str
> > p flist
> > n
> > n
> > n
> > p flist
> > ---8<---
>
> To reduce the required number of steps here something like the
> following recipe may be useful:
>
> #include <signal.h>
>
> int main()
> {
>         // add test code
>         ...
>
>         // enter gdb
>         raise(SIGTRAP);
>
>         return 0;
> }
>
> then compile the code as mentioned by Thomas and create the mentioned
> `autotest` file as
>
> > ---8<---
> file test
> run
> frame 1
> info local
> > ---8<---
>
> then run
>
>     gdb -batch -x autotest
>
> to inspect the results manually or run
>
>     gdb -batch -x autotest  > ground.truth
>
> to create the mentioned reference file.
>
> Regards
> Ralf
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-finance-apps/attachments/20210706/087eed2f/attachment.htm>


More information about the Kde-finance-apps mailing list