[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-finance-apps
Subject:    Re: GSoc GDB pretty printers: Automatic testing and printing class pointers
From:       Ralf Habacker <ralf.habacker () freenet ! de>
Date:       2021-07-05 8:23:25
Message-ID: a84163be-4968-1e65-c7d6-13a1452416f0 () freenet ! de
[Download RAW message or body]

	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






[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic