[PATCH v2:libXt] Add test framework similar to xserver and use it to test XtAsprintf

Alan Coopersmith alan.coopersmith at oracle.com
Thu Mar 10 14:18:18 PST 2011


On 03/10/11 06:19 AM, Gaetan Nadon wrote:
> On Thu, 2011-03-10 at 10:47 +0100, Julien Cristau wrote:
>> > On Wed, Mar  9, 2011 at 20:19:16 -0800, Alan Coopersmith wrote:
>> >
>> > > +# Memory checking support
>> > > +case $host_os in
>> > > +     solaris*)
>> > > +        AC_CHECK_LIB([umem], [umem_alloc],
>> > > +            [MALLOC_DEBUG_ENV='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
>> > > +        ;;
>> > > +     *bsd*|darwin*)
>> > > +        MALLOC_DEBUG_ENV='MallocPreScribble=1 MallocScribble=1'
>> > > +        ;;
>> > > +     *) # Assume glibc
>> > > +        MALLOC_DEBUG_ENV='MALLOC_PERTURB_=255'
>> > > +        ;;
>> >
>> > I think this won't work for gnu/kfreebsd.  Maybe use *-gnu for the glibc
>> > case, and put it before the *bsd* one?
>> >
>> Make that *-gnu* so it can handle linux-gnueabi (used on arm)...
> 
> On my list, I also have:
> 
>     *dragonfly*
>     kfreebsd*-gnu
>     gnu*    	for GNU/Hurd
> 
> In the XORG_GNU_LIB macro under review, there is an AM_CONDITIONAL named HAVE_GLIB
> which can be used in the makefile to set appropriate options. Checking by feature is
> preferable to checking by host as glib may or may not be present and can be
> turned off
> by the configure option.

This check is for glibc though, not glib.   (Yes, it's wonderful to have two
widely used system-level libraries whose names differ only by a single
character, and you're far from the first to make that mistake.   I've done it
plenty of times when the context is unclear.)   libc is very much required and
non-optional, and on Linux systems, glibc or a fork of it are the only practical
libc options I'm aware of these days.

I suppose we could do something like
	AC_CHECK_DECL([__GLIBC__])

but I hadn't bothered since this just enables additional runtime checks in
malloc() and free() in the various libc's to strengthen our testing to hopefully
catch more errors, and there is only really one libc per OS that we care about.
If we set it wrong, nothing should break, we just may not catch as many bugs
with the test cases.


-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System



More information about the xorg-devel mailing list