Re: Test code is worth the space - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Test code is worth the space
Date
Msg-id 20150812182036.GK3040@postgresql.org
Whole thread Raw
In response to Re: Test code is worth the space  (Peter Geoghegan <pg@heroku.com>)
List pgsql-hackers
One trouble I face when adding tests is that sometimes they require
hooks in the code, to test for race conditions.  In BRIN I cannot test
some code paths without resorting to adding breakpoints in GDB, for
instance.  If there's no support for such in the core code, it's
essentially impossible to add meaningful test for certain code paths.  I
toyed with the notion of adding hook points (such that a test module can
put the backend to sleep until the other backend acknowledges hitting
the race condition window); I decided not to because it seems a more
general discussion is necessary first about the desirability of such.

As I recall we needed this in SKIP LOCKED and of course for multixacts
also.

I agree with the general idea that it's worthwhile to add lots more
tests than we currently have, both for the current code and for future
patches.  Surely we don't need to reach the point where every single
nuance of every single user interface is verified to the point that
tests are such a large burden to maintain as is being suggested.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Test code is worth the space
Next
From: Qingqing Zhou
Date:
Subject: Re: fix oversight converting buf_id to Buffer