Commit 140bb0d8 by Jan Voung

Remove memcpy test workaround for name mangling substitutions.

Now that the name mangling is a bit smarter (from commit: 217dc082), we don't need to avoid having the same type twice in the function signature. BUG=none R=stichnot@chromium.org Review URL: https://codereview.chromium.org/389683003
parent a3a01a2f
...@@ -48,29 +48,29 @@ int memcpy_test_fixed_len(uint8_t init) { ...@@ -48,29 +48,29 @@ int memcpy_test_fixed_len(uint8_t init) {
elem_t buf2[NWORDS]; elem_t buf2[NWORDS];
reset_buf((uint8_t *)buf, init, BYTE_LENGTH); reset_buf((uint8_t *)buf, init, BYTE_LENGTH);
memcpy((void *)buf2, (void *)buf, BYTE_LENGTH); memcpy((void *)buf2, (void *)buf, BYTE_LENGTH);
return fletcher_checksum((uint8_t*)buf2, BYTE_LENGTH); return fletcher_checksum((uint8_t *)buf2, BYTE_LENGTH);
} }
int memmove_test_fixed_len(uint8_t init) { int memmove_test_fixed_len(uint8_t init) {
elem_t buf[NWORDS]; elem_t buf[NWORDS];
reset_buf((uint8_t *)buf, init, BYTE_LENGTH); reset_buf((uint8_t *)buf, init, BYTE_LENGTH);
memmove((void *)(buf + 4), (void *)buf, BYTE_LENGTH - (4 * sizeof(elem_t))); memmove((void *)(buf + 4), (void *)buf, BYTE_LENGTH - (4 * sizeof(elem_t)));
return fletcher_checksum((uint8_t*)buf + 4, BYTE_LENGTH - 4); return fletcher_checksum((uint8_t *)buf + 4, BYTE_LENGTH - 4);
} }
int memset_test_fixed_len(uint8_t init) { int memset_test_fixed_len(uint8_t init) {
elem_t buf[NWORDS]; elem_t buf[NWORDS];
memset((void *)buf, init, BYTE_LENGTH); memset((void *)buf, init, BYTE_LENGTH);
return fletcher_checksum((uint8_t*)buf, BYTE_LENGTH); return fletcher_checksum((uint8_t *)buf, BYTE_LENGTH);
} }
int memcpy_test(uint8_t *buf, void *buf2, uint8_t init, size_t length) { int memcpy_test(uint8_t *buf, uint8_t *buf2, uint8_t init, size_t length) {
reset_buf(buf, init, length); reset_buf(buf, init, length);
memcpy(buf2, (void *)buf, length); memcpy((void *)buf2, (void *)buf, length);
return fletcher_checksum((uint8_t *)buf2, length); return fletcher_checksum(buf2, length);
} }
int memmove_test(uint8_t *buf, void *buf2, uint8_t init, size_t length) { int memmove_test(uint8_t *buf, uint8_t *buf2, uint8_t init, size_t length) {
int sum1; int sum1;
int sum2; int sum2;
const int overlap_bytes = 4 * sizeof(elem_t); const int overlap_bytes = 4 * sizeof(elem_t);
...@@ -84,14 +84,13 @@ int memmove_test(uint8_t *buf, void *buf2, uint8_t init, size_t length) { ...@@ -84,14 +84,13 @@ int memmove_test(uint8_t *buf, void *buf2, uint8_t init, size_t length) {
memmove((void *)overlap_buf, (void *)buf, reduced_length); memmove((void *)overlap_buf, (void *)buf, reduced_length);
sum1 = fletcher_checksum(overlap_buf, reduced_length); sum1 = fletcher_checksum(overlap_buf, reduced_length);
/* Test w/out overlap. */ /* Test w/out overlap. */
memmove(buf2, (void *)buf, length); memmove((void *)buf2, (void *)buf, length);
sum2 = fletcher_checksum((uint8_t *)buf2, length); sum2 = fletcher_checksum(buf2, length);
return sum1 + sum2; return sum1 + sum2;
} }
int memset_test(uint8_t *buf, void *buf2, uint8_t init, size_t length) { int memset_test(uint8_t *buf, uint8_t *buf2, uint8_t init, size_t length) {
memset((void *)buf, init, length); memset((void *)buf, init, length);
memset(buf2, init + 4, length); memset((void *)buf2, init + 4, length);
return fletcher_checksum(buf, length) + return fletcher_checksum(buf, length) + fletcher_checksum(buf2, length);
fletcher_checksum((uint8_t *)buf2, length);
} }
...@@ -5,14 +5,9 @@ ...@@ -5,14 +5,9 @@
* under different namespaces. * under different namespaces.
*/ */
/* Declare first buf as uint8_t * and second as void *, to avoid C++ int memcpy_test(uint8_t *buf, uint8_t *buf2, uint8_t init, size_t length);
* name mangling's use of substitutions. Otherwise Subzero's name int memmove_test(uint8_t *buf, uint8_t *buf2, uint8_t init, size_t length);
* mangling injection will need to bump each substitution sequence ID int memset_test(uint8_t *buf, uint8_t *buf2, uint8_t init, size_t length);
* up by one (e.g., from S_ to S0_ and S1_ to S2_).
*/
int memcpy_test(uint8_t *buf, void *buf2, uint8_t init, size_t length);
int memmove_test(uint8_t *buf, void *buf2, uint8_t init, size_t length);
int memset_test(uint8_t *buf, void *buf2, uint8_t init, size_t length);
int memcpy_test_fixed_len(uint8_t init); int memcpy_test_fixed_len(uint8_t init);
int memmove_test_fixed_len(uint8_t init); int memmove_test_fixed_len(uint8_t init);
......
...@@ -40,8 +40,8 @@ void testVariableLen(size_t &TotalTests, size_t &Passes, size_t &Failures) { ...@@ -40,8 +40,8 @@ void testVariableLen(size_t &TotalTests, size_t &Passes, size_t &Failures) {
for (size_t len = 4; len < 128; ++len) { \ for (size_t len = 4; len < 128; ++len) { \
for (uint8_t init_val = 0; init_val < 100; ++init_val) { \ for (uint8_t init_val = 0; init_val < 100; ++init_val) { \
++TotalTests; \ ++TotalTests; \
int llc_result = test_func(buf, (void *)buf2, init_val, len); \ int llc_result = test_func(buf, buf2, init_val, len); \
int sz_result = Subzero_::test_func(buf, (void *)buf2, init_val, len); \ int sz_result = Subzero_::test_func(buf, buf2, init_val, len); \
if (llc_result == sz_result) { \ if (llc_result == sz_result) { \
++Passes; \ ++Passes; \
} else { \ } else { \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment