This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PING 2][PATCH v3] Add pretty printers for the NPTL lock types
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Martin Galvan <martin dot galvan at tallertechnologies dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, Siddhesh Poyarekar <sid at reserved-bit dot com>, libc-alpha at sourceware dot org, Tom Tromey <tom at tromey dot com>, Torvald Riegel <triegel at redhat dot com>, Pedro Alves <palves at redhat dot com>, vapier at gentoo dot org, Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- Date: Thu, 10 Mar 2016 23:30:33 -0500
- Subject: Re: [PING 2][PATCH v3] Add pretty printers for the NPTL lock types
- Authentication-results: sourceware.org; auth=none
- References: <1447768994-5368-1-git-send-email-martin dot galvan at tallertechnologies dot com> <20160209155450 dot GE1904 at devel dot intra dot reserved-bit dot com> <CAOKbPbYPtn5mMpwGGD-HccXnhNz+eymiJ7Xwe_4WOnesYkw5=A at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1602091743430 dot 29757 at digraph dot polyomino dot org dot uk> <CAOKbPba5MGw8XCXRSvapfADD1v_0FoVYhUeJUp01YBXyELLMkg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1602101301131 dot 23420 at digraph dot polyomino dot org dot uk> <56BCB9C7 dot 6000100 at redhat dot com> <CAOKbPbZMt+ozv8dPbC8hpZr6yw2d2HcV4OskRP+Pk-i3oYu=nQ at mail dot gmail dot com> <56D5DFE3 dot 5010401 at redhat dot com> <CAOKbPbY_TPXBuFWT_eZCOBKiF-uSWZndAT3cuL3ZvZF+htbCRQ at mail dot gmail dot com> <CAOKbPbY0QW-KvhegDbs3NCuv-hHKyf-peuL1aBon+YTCt2SfEg at mail dot gmail dot com>
On 03/09/2016 03:01 PM, Martin Galvan wrote:
> As requested, I've written a series of test cases for the pretty
> printers. Each lock type (mutex, condvar and rwlock) has two test
> programs, one for itself and other for its related 'attributes'
> object. Each test program in turn has a PExpect-based Python script
> that drives gdb and compares its output to the expected printer's. I'm
> attaching the test cases so you guys can start reviewing them; in the
> meanwhile I'll dwell further into the build system stuff.
This is really awesome.
>From a high level I think the testing is coming along very nicely.
Things I really like:
* PExpect looks very cool. It looks like you can just drive the
test easily by hand if you detect it's failing which is an
important part of re-running the test with local changes
while debugging.
* I like one *.c and one *.py file tied together for testing
purposes. It makes it easy to see how they work together.
We should keep this 1:1 relationship as much as we can.
I really like how easy glibc's tests are to hack on.
One things I'd like to see:
* Test timeouts? What if the tests get stuck?
- I don't see how you control the timeouts or time them to
the existing TIMEOUTFACTOR or define default timeouts.
> A few things to consider while reviewing this:
>
> * I use the 'GCC optimize' pargma to disable compiler optimizations.
> This is necessary because I rely on the C code structure being
> preserved when stepping through the programs. Things like aggressive
> instruction reordering or optimizing variables out will complicate the
> test scripts beyond my reach.
That's fine.
> * Each call to the pthread_* functions should be kept on a separate
> line. This is done so I can easily advance through the programs using
> the gdb 'next' command.
OK.
> * If you want to run the unit tests, I've included a small Makefile
> that will compile each program and run its corresponding script. You
> should have my printers (and its constants file) set to be loaded when
> gdb starts, e.g. by adding something like the following to .gdbinit:
OK.
> python
> import sys
> sys.path.insert(0, '/home/martin')
> end
>
> source /home/martin/nptl-printers.py
>
> I've also attached the newest version of the pretty printers and their
> constants. The last version I sent defined a Printer class which works
> exactly as gdb.RegexpCollectionPrettyPrinter except it could read
> through typedefs. I needed this because of a bug in the Python API
> which is fixed in the latest gdb. I also corrected a couple of
> mistakes and added the corresponding constants for the condvar's clock
> ID attribute.
Awesome. I haven't tried these yet, but I looked through the tests and
they all look pretty OK. I'm not going to nit pick the details right now,
but I think you're getting close to ready for a detailed review.
I think you need to answer the test timeout question though since it
becomes very important, particularly if your model in the PyExpect
gets out of sync with the test program.
--
Cheers,
Carlos.