static void do_one_test (impl_t *impl, CHAR *dst, const CHAR *src, size_t len __attribute__((unused))) { size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; if (CALL (impl, dst, src) != STRCPY_RESULT (dst, len)) { error (0, 0, "Wrong result in function %s %p %p", impl->name, CALL (impl, dst, src), STRCPY_RESULT (dst, len)); ret = 1; return; } if (STRCMP (dst, src) != 0) { error (0, 0, "Wrong result in function %s dst \"%" sfmt "\" src \"%" sfmt "\"", impl->name, dst, src); ret = 1; return; } TIMING_NOW (start); for (i = 0; i < iters; ++i) { CALL (impl, dst, src); } TIMING_NOW (stop); TIMING_DIFF (cur, start, stop); TIMING_PRINT_MEAN ((double) cur, (double) iters); }
static void do_one_test (impl_t *impl, char *dst, const char *src, size_t len, size_t dlen) { char *res; size_t i, iters = INNER_LOOP_ITERS; timing_t start, stop, cur; if (dlen <= len) { if (impl->test == 1) return; chk_fail_ok = 1; if (setjmp (chk_fail_buf) == 0) { res = CALL (impl, dst, src, dlen); printf ("*** Function %s (%zd; %zd) did not __chk_fail\n", impl->name, len, dlen); chk_fail_ok = 0; ret = 1; } return; } else res = CALL (impl, dst, src, dlen); if (res != STRCPY_RESULT (dst, len)) { printf ("Wrong result in function %s %p %p\n", impl->name, res, STRCPY_RESULT (dst, len)); ret = 1; return; } if (strcmp (dst, src) != 0) { printf ("Wrong result in function %s dst \"%s\" src \"%s\"\n", impl->name, dst, src); ret = 1; return; } TIMING_NOW (start); for (i = 0; i < iters; ++i) { CALL (impl, dst, src, dlen); } TIMING_NOW (stop); TIMING_DIFF (cur, start, stop); TIMING_PRINT_MEAN ((double) cur, (double) iters); }