Testing of memcmp(). Possible patch to tester.c

Mats Erik Andersson ynglingatal at comhem.se
Sat Oct 27 18:41:27 UTC 2007


Hello there,

the attached difference file addresses the problem of
better detecting a malfunctioning memcmp() call. It concerns
the file

	uClibc-0.9.29/test/string/tester.c

in the test suite. Where possible the old test cases were
rebuilt to avoid the return values (from memcmp) +1 and -1,
but still only positivity and negativity are tested for.
This was done in order to better disclose problems with
the optimized and architecture specific implementations.
In addition, there are some new test cases gleaned from
Dropbear, and which conduct tests with shifting alignment.
Of course, not all of these twenty test cases are independent,
but in more verbose forms they were instrumental when I
debugged architecture specific assembly code for an embedded
system (not yet incorporated into the code base of uClibc).
It was also essential to use a flag "-fno-builtin" to detect the
failures, both for the old test cases and these new ones.

Based I on this recent experience, I have begun developing
a modified testing machinery that better would issue warnings
for false positives. The effort to avoid return values +1 and -1
is an afterglow of this methodology. Since the present test
suite is somewhat awkward to use in cross compiled settings,
I might come back to that issue another time.

Best regards for now

Ynglingatal


-------------- next part --------------
A non-text attachment was scrubbed...
Name: uClibc-0.9.29-libc_string_tester_memcmp.diff
Type: text/x-patch
Size: 1760 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20071027/7de489d6/attachment-0002.bin 


More information about the uClibc mailing list