mbox series

[v4,0/4] string: Add tests for strdup and strndup (BZ #30266)

Message ID 20230410155934.3503627-1-josimmon@redhat.com
Headers show
Series string: Add tests for strdup and strndup (BZ #30266) | expand

Message

Joe Simmons-Talbott April 10, 2023, 3:59 p.m. UTC
Copy strcpy and strncpy tests to strdup and strndup repectively.  Remove
tests that checked the surrounding bytes of the result as they are not needed.

Changes to v3:
  * string/test-strdup.c - Style cleanup.  Make sure we're using CHAR
    rather than char for wide character support.
  * string/test-strndup.c - Remove unneeded wide character support since
    there is no wcsndup().  Use TEST_COMPARE_BLOB rather than memcmp().
  * wcsmbs - Enable wcsdup() testcases.

Changes to v2: Remove the rest of the ifunc bits.  Mark two variables as
unused so that we can use string/test-string.h for functions that aren't
ifuncs.

Changes to v1: Since strdup and strndup are not ifuncs and likely won't
be, call them directly.  Use TEST_COMPARE_BLOB() rather than memcmp().
Clear up wording in a comment.

Joe Simmons-Talbott (3):
  string: Allow use of test-string.h for non-ifunc implementations.
  string: Add tests for strdup (BZ #30266)
  string: Add tests for strndup (BZ #30266)

 string/Makefile       |   2 +
 string/test-strdup.c  | 203 ++++++++++++++++++++++++++++++++++++++
 string/test-string.h  |   4 +-
 string/test-strndup.c | 222 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 429 insertions(+), 2 deletions(-)
 create mode 100644 string/test-strdup.c
 create mode 100644 string/test-strndup.c