test: Increase size of crc tests and simplify output

Change-Id: Ia0418b7889e591a0164c335e273caff263cdf640
Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
Greg Tucker 2019-09-11 13:54:44 -07:00
parent ae3c91ab85
commit 7a28c83879
3 changed files with 23 additions and 23 deletions

View File

@ -39,7 +39,7 @@
# define TEST_SEED 0x1234
#endif
#define MAX_BUF 512
#define MAX_BUF 4096
#define TEST_SIZE 20
typedef uint32_t u32;
@ -65,7 +65,7 @@ int main(int argc, char *argv[])
unsigned char *buf;
printf("Test crc16_t10dif_test ");
if (posix_memalign(&buf_raw, MAX_BUF, MAX_BUF * TEST_SIZE)) {
if (posix_memalign(&buf_raw, 32, MAX_BUF * TEST_SIZE)) {
printf("alloc error: Fail");
return -1;
}
@ -109,7 +109,7 @@ int main(int argc, char *argv[])
fail++;
if (verbose)
printf("crc rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, crc_base, crc);
else
else if (i % (TEST_SIZE / 8) == 0)
printf(".");
buf += MAX_BUF;
}
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
fail++;
printf("fail random size%i 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base,
crc);
} else
} else if (i % (MAX_BUF / 8) == 0)
printf(".");
}
@ -149,7 +149,7 @@ int main(int argc, char *argv[])
if (verbose)
printf("crc rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref,
crc_base, crc);
else
else if (i % (TEST_SIZE * 20 / 8) == 0)
printf(".");
buf += MAX_BUF;
}

View File

@ -39,7 +39,7 @@
# define TEST_SEED 0x1234
#endif
#define MAX_BUF 512
#define MAX_BUF 4096
#define TEST_SIZE 32
typedef uint32_t(*crc32_func_t) (uint32_t, const uint8_t *, uint64_t);
@ -107,8 +107,8 @@ int main(int argc, char *argv[])
verbose = argc - 1;
// Align to MAX_BUF boundary
ret = posix_memalign(&buf_alloc, MAX_BUF, MAX_BUF * TEST_SIZE);
// Align to TEST_SIZE boundary
ret = posix_memalign(&buf_alloc, TEST_SIZE, MAX_BUF * TEST_SIZE);
if (ret) {
printf("alloc error: Fail");
return -1;
@ -120,13 +120,13 @@ int main(int argc, char *argv[])
fail_case = 0;
test_func = &test_funcs[i];
printf("Test %s ", test_func->note);
printf("Test %s\t", test_func->note);
fail_case += zeros_test(test_func);
fail_case += simple_pattern_test(test_func);
fail_case += seeds_sizes_test(test_func);
fail_case += eob_test(test_func);
fail_case += update_test(test_func);
printf("Test %s done: %s\n", test_func->note, fail_case ? "Fail" : "Pass");
printf(" done: %s\n", fail_case ? "Fail" : "Pass");
if (fail_case) {
printf("\n%s Failed %d tests\n", test_func->note, fail_case);
@ -208,7 +208,7 @@ int seeds_sizes_test(func_case_t * test_func)
fail++;
if (verbose)
printf("crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, crc);
else
else if (i % (TEST_SIZE / 8) == 0)
printf(".");
buf += MAX_BUF;
}
@ -226,7 +226,7 @@ int seeds_sizes_test(func_case_t * test_func)
fail++;
printf("fail random size%i 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base,
crc);
} else
} else if (i % (MAX_BUF / 8) == 0)
printf(".");
}
@ -250,7 +250,7 @@ int seeds_sizes_test(func_case_t * test_func)
if (verbose)
printf("crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref,
crc_base, crc);
else
else if (i % (TEST_SIZE * 20 / 8) == 0)
printf(".");
buf += MAX_BUF;
}
@ -285,7 +285,7 @@ int eob_test(func_case_t * test_func)
if (verbose)
printf("crc eob rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base,
crc);
else
else if (i % (TEST_SIZE / 8) == 0)
printf(".");
}

View File

@ -39,7 +39,7 @@
# define TEST_SEED 0x1234
#endif
#define MAX_BUF 512
#define MAX_BUF 4096
#define TEST_SIZE 32
typedef uint64_t u64;
@ -97,8 +97,8 @@ int main(int argc, char *argv[])
verbose = argc - 1;
// Align to MAX_BUF boundary
ret = posix_memalign(&buf_alloc, MAX_BUF, MAX_BUF * TEST_SIZE);
// Align to 32B boundary
ret = posix_memalign(&buf_alloc, TEST_SIZE, MAX_BUF * TEST_SIZE);
if (ret) {
printf("alloc error: Fail");
return -1;
@ -110,13 +110,13 @@ int main(int argc, char *argv[])
fail_case = 0;
test_func = &test_funcs[i];
printf("Test %s ", test_func->note);
printf("Test %s\t", test_func->note);
fail_case += zeros_test(test_func);
fail_case += simple_pattern_test(test_func);
fail_case += seeds_sizes_test(test_func);
fail_case += eob_test(test_func);
fail_case += update_test(test_func);
printf("Test %s done: %s\n", test_func->note, fail_case ? "Fail" : "Pass");
printf(" done: %s\n", fail_case ? "Fail" : "Pass");
if (fail_case) {
printf("\n%s Failed %d tests\n", test_func->note, fail_case);
@ -199,7 +199,7 @@ int seeds_sizes_test(func_case_t * test_func)
if (verbose)
printf("crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, crc_base,
crc);
else
else if (i % (TEST_SIZE / 8) == 0)
printf(".");
buf += MAX_BUF;
}
@ -217,7 +217,7 @@ int seeds_sizes_test(func_case_t * test_func)
fail++;
printf("fail random size%i 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref,
crc_base, crc);
} else
} else if (i % (MAX_BUF / 8) == 0)
printf(".");
}
@ -241,7 +241,7 @@ int seeds_sizes_test(func_case_t * test_func)
if (verbose)
printf("crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref,
crc_base, crc);
else
else if (i % (TEST_SIZE * 20 / 8) == 0)
printf(".");
buf += MAX_BUF;
}
@ -276,7 +276,7 @@ int eob_test(func_case_t * test_func)
if (verbose)
printf("crc eob rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref,
crc_base, crc);
else
else if (i % (TEST_SIZE / 8) == 0)
printf(".");
}