From: Paul Floyd Date: Fri, 26 Jun 2026 19:04:39 +0000 (+0200) Subject: DHAT regtest: add wcpncpy and wcsncpy to copy test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=62e17fac14cb977b2bfbf9288efea66cb3d64a19;p=thirdparty%2Fvalgrind.git DHAT regtest: add wcpncpy and wcsncpy to copy test --- diff --git a/dhat/tests/copy.c b/dhat/tests/copy.c index 18479d782..5f3f8ed4b 100644 --- a/dhat/tests/copy.c +++ b/dhat/tests/copy.c @@ -38,8 +38,9 @@ int main(void) { } void f(char* a, char* b, wchar_t* wa, wchar_t* wb) { - // The memcpy is duplicated so we have 10 calls, which makes for nice round - // numbers in the totals. + // The memcpy is duplicated so we have 10 calls + // which was a nice round 100,000 until wcpncpy + // and wcsncpy were added memcpy (a, b, 1000); // Redirects to memmove memcpy (a, b, 1000); // Redirects to memmove memmove(a, b, 1000); @@ -54,6 +55,16 @@ void f(char* a, char* b, wchar_t* wa, wchar_t* wb) { stpcpy (a, b); // Redirects to strcpy stpncpy(a, b, 1000); wcscpy (wa, wb); +#if defined(HAVE_WCPNCPY) + wcpncpy(wa, wb, 1000/sizeof(*wa)); +#else + memcpy(a, b, 1000); +#endif +#if defined(HAVE_WCSNCPY) + wcsncpy(wa, wb, 1000/sizeof(*wa)); +#else + memcpy(a, b, 1000); +#endif } void test_malloc() { diff --git a/dhat/tests/copy.stderr.exp b/dhat/tests/copy.stderr.exp index 2e35f697e..9955a8b28 100644 --- a/dhat/tests/copy.stderr.exp +++ b/dhat/tests/copy.stderr.exp @@ -1 +1 @@ -Total: 1,000,... bytes in 1,0.. blocks +Total: 1,200,... bytes in 1,2.. blocks diff --git a/dhat/tests/filter_copy b/dhat/tests/filter_copy index 57b6536c6..6b5827e4a 100755 --- a/dhat/tests/filter_copy +++ b/dhat/tests/filter_copy @@ -2,8 +2,8 @@ # It's impossible to get exact matches for copy counts because even trivial C # programs do a few memcpy/strcpy calls. So we allow some fuzzy matching. -# So we allow 1,000,000..1,009,999 bytes and 1,000..1,099 blocks. +# So we allow 1,200,000..1,209,999 bytes and 1,200..1,299 blocks. ./filter_stderr "$@" | -sed -e "s/1,00.,... bytes in 1,0.. blocks/1,000,... bytes in 1,0.. blocks/" +sed -e "s/1,20.,... bytes in 1,2.. blocks/1,200,... bytes in 1,2.. blocks/"