diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2016-05-18 05:48:56 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2016-05-18 05:51:59 -0700 |
commit | 447720b03b4ac37cbc1367bf3aad56711a30a307 (patch) | |
tree | 2666c0567dfddb5d4dec23c9516635e707415b71 /benchtests | |
parent | 0014680d6a5bdeb4fe17682450105ebed19f35da (diff) | |
download | glibc-447720b03b4ac37cbc1367bf3aad56711a30a307.tar glibc-447720b03b4ac37cbc1367bf3aad56711a30a307.tar.gz glibc-447720b03b4ac37cbc1367bf3aad56711a30a307.tar.bz2 glibc-447720b03b4ac37cbc1367bf3aad56711a30a307.zip |
Clear destination buffer updated by the previous run
Clear the destination buffer updated by the previous run in bench-memcpy.c
and test-memcpy.c to catch the error when the following implementations do
not copy anything.
[BZ #19907]
* benchtests/bench-memcpy.c (do_one_test): Clear the destination
buffer updated by the previous run.
* string/test-memcpy.c (do_one_test): Likewise.
* benchtests/bench-memmove.c (do_one_test): Add a comment.
* string/test-memmove.c (do_one_test): Likewise.
Diffstat (limited to 'benchtests')
-rw-r--r-- | benchtests/bench-memcpy.c | 4 | ||||
-rw-r--r-- | benchtests/bench-memmove.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/benchtests/bench-memcpy.c b/benchtests/bench-memcpy.c index c5a71925be..9d9e7b6879 100644 --- a/benchtests/bench-memcpy.c +++ b/benchtests/bench-memcpy.c @@ -55,6 +55,10 @@ do_one_test (impl_t *impl, char *dst, const char *src, size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; + /* Must clear the destination buffer set by the previous run. */ + for (i = 0; i < len; i++) + dst[i] = 0; + if (CALL (impl, dst, src, len) != MEMCPY_RESULT (dst, len)) { error (0, 0, "Wrong result in function %s %p %p", impl->name, diff --git a/benchtests/bench-memmove.c b/benchtests/bench-memmove.c index c38596b41e..3858f2ac52 100644 --- a/benchtests/bench-memmove.c +++ b/benchtests/bench-memmove.c @@ -70,6 +70,7 @@ do_one_test (impl_t *impl, char *dst, char *src, const char *orig_src, size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; + /* This also clears the destination buffer set by the previous run. */ memcpy (src, orig_src, len); #ifdef TEST_BCOPY CALL (impl, src, dst, len); |