From 2ca781df19598766427435a011f263680d9e8faa Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Wed, 29 Nov 2023 13:30:54 +0000 Subject: [PATCH] lib: reduce verbosity by default in tests Signed-off-by: Pablo de Lara --- crc/crc16_t10dif_copy_test.c | 8 +++ crc/crc16_t10dif_test.c | 52 ++++++++++++------ crc/crc32_funcs_test.c | 63 +++++++++++++-------- crc/crc64_funcs_test.c | 67 ++++++++++++++--------- erasure_code/erasure_code_base_test.c | 4 ++ erasure_code/erasure_code_test.c | 4 ++ erasure_code/erasure_code_update_test.c | 12 ++++ erasure_code/gf_inverse_test.c | 4 ++ erasure_code/gf_vect_dot_prod_base_test.c | 2 + erasure_code/gf_vect_dot_prod_test.c | 15 ++++- erasure_code/gf_vect_mad_test.c | 12 ++++ erasure_code/gf_vect_mul_base_test.c | 4 ++ erasure_code/gf_vect_mul_test.c | 7 ++- igzip/checksum32_funcs_test.c | 63 +++++++++++++-------- igzip/igzip_rand_test.c | 44 ++++++++------- igzip/igzip_wrapper_hdr_test.c | 4 ++ mem/mem_zero_detect_test.c | 20 +++++++ raid/pq_check_test.c | 10 ++++ raid/pq_gen_test.c | 23 +++++--- raid/xor_check_test.c | 10 ++++ raid/xor_gen_test.c | 23 +++++--- 21 files changed, 325 insertions(+), 126 deletions(-) diff --git a/crc/crc16_t10dif_copy_test.c b/crc/crc16_t10dif_copy_test.c index 4c398c4..7d0e92a 100644 --- a/crc/crc16_t10dif_copy_test.c +++ b/crc/crc16_t10dif_copy_test.c @@ -145,20 +145,26 @@ int main(int argc, char *argv[]) for (i = 0; i < MAX_BUF; i++) { r |= crc_copy_check("short len", dst, src, rand(), i, MAX_BUF); } +#ifdef TEST_VERBOSE printf("."); +#endif // Do a few longer tests, random data for (i = TEST_LEN; i >= (TEST_LEN - TEST_SIZE); i--) { r |= crc_copy_check("long len", dst, src, rand(), i, TEST_LEN); } +#ifdef TEST_VERBOSE printf("."); +#endif // Do random size, random data for (i = 0; i < RANDOMS; i++) { len = rand() % TEST_LEN; r |= crc_copy_check("rand len", dst, src, rand(), len, TEST_LEN); } +#ifdef TEST_VERBOSE printf("."); +#endif // Run tests at end of buffer for (i = 0; i < RANDOMS; i++) { @@ -168,7 +174,9 @@ int main(int argc, char *argv[]) tot = len; r |= crc_copy_check("end of buffer", dst, src, rand(), len, tot); } +#ifdef TEST_VERBOSE printf("."); +#endif printf("Test done: %s\n", r ? "Fail" : "Pass"); return r; diff --git a/crc/crc16_t10dif_test.c b/crc/crc16_t10dif_test.c index e0027de..2a1631c 100644 --- a/crc/crc16_t10dif_test.c +++ b/crc/crc16_t10dif_test.c @@ -59,7 +59,6 @@ int main(int argc, char *argv[]) { int fail = 0; u32 r = 0; - int verbose = argc - 1; int i, s; void *buf_raw; unsigned char *buf; @@ -82,9 +81,12 @@ int main(int argc, char *argv[]) fail++; printf("\n opt ref\n"); printf(" ------ ------\n"); - printf("crc zero = 0x%4x 0x%4x 0x%4x \n", crc_ref, crc_base, crc); - } else + printf("fail crc zero = 0x%4x 0x%4x 0x%4x \n", crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE + else printf("."); +#endif // Another simple test pattern memset(buf, 0x8a, MAX_BUF); @@ -93,9 +95,12 @@ int main(int argc, char *argv[]) crc = crc16_t10dif(TEST_SEED, buf, MAX_BUF); if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - printf("crc all 8a = 0x%4x 0x%4x 0x%4x\n", crc_ref, crc_base, crc); - } else + printf("fail crc all 8a = 0x%4x 0x%4x 0x%4x\n", crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE + else printf("."); +#endif // Do a few random tests @@ -105,12 +110,15 @@ int main(int argc, char *argv[]) crc_ref = crc16_t10dif_ref(TEST_SEED, buf, MAX_BUF); crc_base = crc16_t10dif_base(TEST_SEED, buf, MAX_BUF); crc = crc16_t10dif(TEST_SEED, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, crc_base, crc); + printf("fail crc rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, crc_base, + crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE / 8) == 0) printf("."); +#endif buf += MAX_BUF; } @@ -126,8 +134,11 @@ 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 if (i % (MAX_BUF / 8) == 0) + } +#ifdef TEST_VERBOSE + else if (i % (MAX_BUF / 8) == 0) printf("."); +#endif } // Try different seeds @@ -137,20 +148,23 @@ int main(int argc, char *argv[]) r = rand(); // just to get a new seed rand_buffer(buf, MAX_BUF * TEST_SIZE); // new pseudo-rand data - if (verbose) - printf("seed = 0x%x\n", r); +#ifdef TEST_VERBOSE + printf("seed = 0x%x\n", r); +#endif for (i = 0; i < TEST_SIZE; i++) { crc_ref = crc16_t10dif_ref(r, buf, MAX_BUF); crc_base = crc16_t10dif_base(r, buf, MAX_BUF); crc = crc16_t10dif(r, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, + printf("fail crc rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE * 20 / 8) == 0) printf("."); +#endif buf += MAX_BUF; } } @@ -162,13 +176,15 @@ int main(int argc, char *argv[]) crc_ref = crc16_t10dif_ref(TEST_SEED, buf + i, TEST_SIZE - i); crc_base = crc16_t10dif_base(TEST_SEED, buf + i, TEST_SIZE - i); crc = crc16_t10dif(TEST_SEED, buf + i, TEST_SIZE - i); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc eob rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, crc_base, - crc); + printf("fail crc eob rand%3d = 0x%4x 0x%4x 0x%4x\n", i, crc_ref, + crc_base, crc); + } +#ifdef TEST_VERBOSE else printf("."); +#endif } printf("Test done: %s\n", fail ? "Fail" : "Pass"); diff --git a/crc/crc32_funcs_test.c b/crc/crc32_funcs_test.c index 17f8f53..f8fe775 100644 --- a/crc/crc32_funcs_test.c +++ b/crc/crc32_funcs_test.c @@ -96,7 +96,6 @@ int eob_test(func_case_t * test_func); int update_test(func_case_t * test_func); -int verbose = 0; void *buf_alloc = NULL; int main(int argc, char *argv[]) @@ -105,8 +104,6 @@ int main(int argc, char *argv[]) int i, ret; func_case_t *test_func; - verbose = argc - 1; - // Align to TEST_SIZE boundary ret = posix_memalign(&buf_alloc, TEST_SIZE, MAX_BUF * TEST_SIZE); if (ret) { @@ -156,9 +153,12 @@ int zeros_test(func_case_t * test_func) fail++; printf("\n opt ref\n"); printf(" ------ ------\n"); - printf("crc zero = 0x%8x 0x%8x 0x%8x\n", crc_ref, crc_base, crc); - } else + printf("fail crc zero = 0x%8x 0x%8x 0x%8x\n", crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE + else printf("."); +#endif return fail; } @@ -176,12 +176,14 @@ int simple_pattern_test(func_case_t * test_func) crc_base = test_func->crc32_base_call(TEST_SEED, buf, MAX_BUF); crc = test_func->crc32_func_call(TEST_SEED, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc all 8a = 0x%8x 0x%8x 0x%8x\n", crc_ref, crc_base, crc); + printf("fail crc all 8a = 0x%8x 0x%8x 0x%8x\n", crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else printf("."); +#endif return fail; } @@ -204,12 +206,15 @@ int seeds_sizes_test(func_case_t * test_func) crc_base = test_func->crc32_base_call(r, buf, MAX_BUF); crc = test_func->crc32_func_call(r, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, crc); + printf("fail crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, + crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE / 8) == 0) printf("."); +#endif buf += MAX_BUF; } @@ -226,8 +231,11 @@ 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 if (i % (MAX_BUF / 8) == 0) + } +#ifdef TEST_VERBOSE + else if (i % (MAX_BUF / 8) == 0) printf("."); +#endif } // Try different seeds @@ -237,21 +245,24 @@ int seeds_sizes_test(func_case_t * test_func) r = rand(); // just to get a new seed rand_buffer(buf, MAX_BUF * TEST_SIZE); // new pseudo-rand data - if (verbose) - printf("seed = 0x%lx\n", r); +#ifdef TEST_VERBOSE + printf("seed = 0x%lx\n", r); +#endif for (i = 0; i < TEST_SIZE; i++) { crc_ref = test_func->crc32_ref_call(r, buf, MAX_BUF); crc_base = test_func->crc32_base_call(r, buf, MAX_BUF); crc = test_func->crc32_func_call(r, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, + printf("fail crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE * 20 / 8) == 0) printf("."); +#endif buf += MAX_BUF; } } @@ -280,13 +291,15 @@ int eob_test(func_case_t * test_func) crc_base = test_func->crc32_base_call(TEST_SEED, buf + i, TEST_SIZE - i); crc = test_func->crc32_func_call(TEST_SEED, buf + i, TEST_SIZE - i); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc eob rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, - crc); + printf("fail crc eob rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, + crc_base, crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE / 8) == 0) printf("."); +#endif } return fail; @@ -313,12 +326,14 @@ int update_test(func_case_t * test_func) buf += MAX_BUF; } - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, crc); + printf("fail crc rand%3d = 0x%8x 0x%8x 0x%8x\n", i, crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else printf("."); +#endif return fail; } diff --git a/crc/crc64_funcs_test.c b/crc/crc64_funcs_test.c index 72c24eb..9c06e13 100644 --- a/crc/crc64_funcs_test.c +++ b/crc/crc64_funcs_test.c @@ -90,7 +90,6 @@ int eob_test(func_case_t * test_func); int update_test(func_case_t * test_func); -int verbose = 0; void *buf_alloc = NULL; int main(int argc, char *argv[]) @@ -99,8 +98,6 @@ int main(int argc, char *argv[]) int i, ret; func_case_t *test_func; - verbose = argc - 1; - // Align to 32B boundary ret = posix_memalign(&buf_alloc, TEST_SIZE, MAX_BUF * TEST_SIZE); if (ret) { @@ -150,9 +147,13 @@ int zeros_test(func_case_t * test_func) fail++; printf("\n opt ref\n"); printf(" ------ ------\n"); - printf("crc zero = 0x%16lx 0x%16lx 0x%16lx \n", crc_ref, crc_base, crc); - } else + printf("fail crc zero = 0x%16lx 0x%16lx 0x%16lx \n", crc_ref, crc_base, + crc); + } +#ifdef TEST_VERBOSE + else printf("."); +#endif return fail; } @@ -170,13 +171,14 @@ int simple_pattern_test(func_case_t * test_func) crc_base = test_func->crc64_base_call(TEST_SEED, buf, MAX_BUF); crc = test_func->crc64_func_call(TEST_SEED, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc all 8a = 0x%16lx 0x%16lx 0x%16lx\n", crc_ref, crc_base, crc); + printf("fail crc all 8a = 0x%16lx 0x%16lx 0x%16lx\n", crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else printf("."); - +#endif return fail; } @@ -198,13 +200,15 @@ int seeds_sizes_test(func_case_t * test_func) crc_base = test_func->crc64_base_call(r, buf, MAX_BUF); crc = test_func->crc64_func_call(r, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, crc_base, - crc); + printf("fail crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, + crc_base, crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE / 8) == 0) printf("."); +#endif buf += MAX_BUF; } @@ -221,8 +225,11 @@ 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 if (i % (MAX_BUF / 8) == 0) + } +#ifdef TEST_VERBOSE + else if (i % (MAX_BUF / 8) == 0) printf("."); +#endif } // Try different seeds @@ -232,21 +239,24 @@ int seeds_sizes_test(func_case_t * test_func) r = rand(); // just to get a new seed rand_buffer(buf, MAX_BUF * TEST_SIZE); // new pseudo-rand data - if (verbose) - printf("seed = 0x%lx\n", r); +#ifdef TEST_VERBOSE + printf("seed = 0x%lx\n", r); +#endif for (i = 0; i < TEST_SIZE; i++) { crc_ref = test_func->crc64_ref_call(r, buf, MAX_BUF); crc_base = test_func->crc64_base_call(r, buf, MAX_BUF); crc = test_func->crc64_func_call(r, buf, MAX_BUF); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, - crc_base, crc); + printf("fail crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, + crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE * 20 / 8) == 0) printf("."); +#endif buf += MAX_BUF; } } @@ -275,13 +285,15 @@ int eob_test(func_case_t * test_func) crc_base = test_func->crc64_base_call(TEST_SEED, buf + i, TEST_SIZE - i); crc = test_func->crc64_func_call(TEST_SEED, buf + i, TEST_SIZE - i); - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc eob rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, + printf("fail crc eob rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, crc_base, crc); + } +#ifdef TEST_VERBOSE else if (i % (TEST_SIZE / 8) == 0) printf("."); +#endif } return fail; @@ -308,12 +320,15 @@ int update_test(func_case_t * test_func) buf += MAX_BUF; } - if ((crc_base != crc_ref) || (crc != crc_ref)) + if ((crc_base != crc_ref) || (crc != crc_ref)) { fail++; - if (verbose) - printf("crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, crc_base, crc); + printf("fail crc rand%3d = 0x%16lx 0x%16lx 0x%16lx\n", i, crc_ref, crc_base, + crc); + } +#ifdef TEST_VERBOSE else printf("."); +#endif return fail; } diff --git a/erasure_code/erasure_code_base_test.c b/erasure_code/erasure_code_base_test.c index d85f07a..1c02d72 100644 --- a/erasure_code/erasure_code_base_test.c +++ b/erasure_code/erasure_code_base_test.c @@ -470,7 +470,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Run tests at end of buffer for Electric Fence @@ -681,7 +683,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test size alignment diff --git a/erasure_code/erasure_code_test.c b/erasure_code/erasure_code_test.c index b831abb..63ae37b 100644 --- a/erasure_code/erasure_code_test.c +++ b/erasure_code/erasure_code_test.c @@ -471,7 +471,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Run tests at end of buffer for Electric Fence @@ -681,7 +683,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test size alignment diff --git a/erasure_code/erasure_code_update_test.c b/erasure_code/erasure_code_update_test.c index e48c536..b2ab9e7 100644 --- a/erasure_code/erasure_code_update_test.c +++ b/erasure_code/erasure_code_update_test.c @@ -370,7 +370,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Pick a first test m = 7; @@ -465,7 +467,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Do more random tests for (rtest = 0; rtest < RANDOMS; rtest++) { @@ -568,7 +572,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Run tests at end of buffer for Electric Fence @@ -692,7 +698,9 @@ int main(int argc, char *argv[]) } } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } @@ -846,7 +854,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test size alignment @@ -951,7 +961,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } printf("done EC tests: Pass\n"); diff --git a/erasure_code/gf_inverse_test.c b/erasure_code/gf_inverse_test.c index 418d7c1..51f52e0 100644 --- a/erasure_code/gf_inverse_test.c +++ b/erasure_code/gf_inverse_test.c @@ -111,7 +111,9 @@ int inv_test(u8 * in, u8 * inv, u8 * sav, int n) print_matrix(in, n); return -1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif return 0; } @@ -216,8 +218,10 @@ int main(int argc, char *argv[]) print_matrix(test_mat, k); return -1; } +#ifdef TEST_VERBOSE if (0 == (t % 8)) putchar('.'); +#endif } printf(" Pass\n"); diff --git a/erasure_code/gf_vect_dot_prod_base_test.c b/erasure_code/gf_vect_dot_prod_base_test.c index 675734a..600946c 100644 --- a/erasure_code/gf_vect_dot_prod_base_test.c +++ b/erasure_code/gf_vect_dot_prod_base_test.c @@ -282,7 +282,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } printf("done all: Pass\n"); diff --git a/erasure_code/gf_vect_dot_prod_test.c b/erasure_code/gf_vect_dot_prod_test.c index 754455a..8300fbd 100644 --- a/erasure_code/gf_vect_dot_prod_test.c +++ b/erasure_code/gf_vect_dot_prod_test.c @@ -171,8 +171,11 @@ int main(int argc, char *argv[]) printf("dprod:"); dump(dest, 25); return -1; - } else + } +#ifdef TEST_VERBOSE + else putchar('.'); +#endif // Rand data test for (rtest = 0; rtest < RANDOMS; rtest++) { @@ -199,7 +202,9 @@ int main(int argc, char *argv[]) return -1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Rand data test with varied parameters @@ -228,7 +233,9 @@ int main(int argc, char *argv[]) return -1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } } @@ -396,7 +403,9 @@ int main(int argc, char *argv[]) return -1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Run tests at end of buffer for Electric Fence @@ -428,7 +437,9 @@ int main(int argc, char *argv[]) return -1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test rand ptr alignment if available @@ -485,7 +496,9 @@ int main(int argc, char *argv[]) return -1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test all size alignment diff --git a/erasure_code/gf_vect_mad_test.c b/erasure_code/gf_vect_mad_test.c index 1db38c2..3a552b2 100644 --- a/erasure_code/gf_vect_mad_test.c +++ b/erasure_code/gf_vect_mad_test.c @@ -249,7 +249,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Rand data test @@ -294,7 +296,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Rand data test with varied parameters @@ -340,7 +344,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } } @@ -390,7 +396,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test rand ptr alignment if available @@ -462,7 +470,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test all size alignment @@ -509,7 +519,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } diff --git a/erasure_code/gf_vect_mul_base_test.c b/erasure_code/gf_vect_mul_base_test.c index a895d1e..cce577e 100644 --- a/erasure_code/gf_vect_mul_base_test.c +++ b/erasure_code/gf_vect_mul_base_test.c @@ -105,7 +105,9 @@ int main(int argc, char *argv[]) i, a, buff1[i], buff2[i], gf_mul(2, buff1[i])); return 1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Run tests at end of buffer for Electric Fence @@ -133,7 +135,9 @@ int main(int argc, char *argv[]) return 1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } printf(" done: Pass\n"); diff --git a/erasure_code/gf_vect_mul_test.c b/erasure_code/gf_vect_mul_test.c index 5952c7a..cc7e1bd 100644 --- a/erasure_code/gf_vect_mul_test.c +++ b/erasure_code/gf_vect_mul_test.c @@ -104,7 +104,9 @@ int main(int argc, char *argv[]) i, a, buff1[i], buff2[i], gf_mul(2, buff1[i])); return -1; } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Check buffer len @@ -122,10 +124,12 @@ int main(int argc, char *argv[]) i, a, buff1[i], buff2[i], gf_mul(2, buff1[i])); return -1; } +#ifdef TEST_VERBOSE if (0 == tsize % (32 * 8)) { putchar('.'); fflush(0); } +#endif } // Run tests at end of buffer for Electric Fence @@ -162,8 +166,9 @@ int main(int argc, char *argv[]) gf_mul(2, efence_buff1[i])); return 1; } - +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test all unsupported sizes up to TEST_SIZE diff --git a/igzip/checksum32_funcs_test.c b/igzip/checksum32_funcs_test.c index c017288..4801b15 100644 --- a/igzip/checksum32_funcs_test.c +++ b/igzip/checksum32_funcs_test.c @@ -71,7 +71,6 @@ int eob_test(func_case_t * test_func); int update_test(func_case_t * test_func); int update_over_mod_test(func_case_t * test_func); -int verbose = 0; void *buf_alloc = NULL; int main(int argc, char *argv[]) @@ -80,8 +79,6 @@ int main(int argc, char *argv[]) int i, ret; func_case_t *test_func; - verbose = argc - 1; - // Align to MAX_BUF boundary ret = posix_memalign(&buf_alloc, MAX_BUF, MAX_BUF * TEST_SIZE); if (ret) { @@ -132,8 +129,11 @@ int zeros_test(func_case_t * test_func) printf("\n opt ref\n"); printf(" ------ ------\n"); printf("checksum zero = 0x%8x 0x%8x \n", c_dut, c_ref); - } else + } +#ifdef TEST_VERBOSE + else printf("."); +#endif return fail; } @@ -149,12 +149,14 @@ int simple_pattern_test(func_case_t * test_func) memset(buf, 0x8a, MAX_BUF); c_dut = test_func->checksum32_func_call(TEST_SEED, buf, MAX_BUF); c_ref = test_func->checksum32_ref_call(TEST_SEED, buf, MAX_BUF); - if (c_dut != c_ref) + if (c_dut != c_ref) { fail++; - if (verbose) - printf("checksum all 8a = 0x%8x 0x%8x\n", c_dut, c_ref); + printf("fail checksum all 8a = 0x%8x 0x%8x\n", c_dut, c_ref); + } +#ifdef TEST_VERBOSE else printf("."); +#endif return fail; } @@ -175,12 +177,14 @@ int seeds_sizes_test(func_case_t * test_func) for (i = 0; i < TEST_SIZE; i++) { c_dut = test_func->checksum32_func_call(r, buf, MAX_BUF); c_ref = test_func->checksum32_ref_call(r, buf, MAX_BUF); - if (c_dut != c_ref) + if (c_dut != c_ref) { fail++; - if (verbose) - printf("checksum rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + printf("fail checksum rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + } +#ifdef TEST_VERBOSE else printf("."); +#endif buf += MAX_BUF; } @@ -194,8 +198,11 @@ int seeds_sizes_test(func_case_t * test_func) if (c_dut != c_ref) { fail++; printf("fail random size%i 0x%8x 0x%8x\n", i, c_dut, c_ref); - } else + } +#ifdef TEST_VERBOSE + else printf("."); +#endif } // Try different seeds @@ -205,18 +212,22 @@ int seeds_sizes_test(func_case_t * test_func) r = rand(); // just to get a new seed rand_buffer(buf, MAX_BUF * TEST_SIZE); // new pseudo-rand data - if (verbose) - printf("seed = 0x%x\n", r); +#ifdef TEST_VERBOSE + printf("seed = 0x%x\n", r); +#endif for (i = 0; i < TEST_SIZE; i++) { c_dut = test_func->checksum32_func_call(r, buf, MAX_BUF); c_ref = test_func->checksum32_ref_call(r, buf, MAX_BUF); - if (c_dut != c_ref) + if (c_dut != c_ref) { fail++; - if (verbose) - printf("checksum rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + printf("fail checksum rand%3d = 0x%8x 0x%8x\n", i, c_dut, + c_ref); + } +#ifdef TEST_VERBOSE else printf("."); +#endif buf += MAX_BUF; } } @@ -237,12 +248,14 @@ int eob_test(func_case_t * test_func) for (i = 0; i < TEST_SIZE; i++) { c_dut = test_func->checksum32_func_call(TEST_SEED, buf + i, TEST_SIZE - i); c_ref = test_func->checksum32_ref_call(TEST_SEED, buf + i, TEST_SIZE - i); - if (c_dut != c_ref) + if (c_dut != c_ref) { fail++; - if (verbose) - printf("checksum eob rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + printf("fail checksum eob rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + } +#ifdef TEST_VERBOSE else printf("."); +#endif } return fail; @@ -268,12 +281,14 @@ int update_test(func_case_t * test_func) buf += MAX_BUF; } - if (c_dut != c_ref) + if (c_dut != c_ref) { fail++; - if (verbose) printf("checksum rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + } +#ifdef TEST_VERBOSE else printf("."); +#endif return fail; } @@ -296,12 +311,14 @@ int update_over_mod_test(func_case_t * test_func) c_dut = test_func->checksum32_func_call(c_dut, buf, ADLER_MOD - 64); } - if (c_dut != c_ref) + if (c_dut != c_ref) { fail++; - if (verbose) printf("checksum rand%3d = 0x%8x 0x%8x\n", i, c_dut, c_ref); + } +#ifdef TEST_VERBOSE else printf("."); +#endif free(buf); return fail; diff --git a/igzip/igzip_rand_test.c b/igzip/igzip_rand_test.c index cd90dad..5b734a1 100644 --- a/igzip/igzip_rand_test.c +++ b/igzip/igzip_rand_test.c @@ -141,7 +141,7 @@ void init_options(void) options.test_seed = TEST_SEED; options.randoms = RANDOMS; options.do_large_test = 1; -#ifdef VERBOSE +#ifdef TEST_VERBOSE options.verbose = 1; #else options.verbose = 0; @@ -2762,12 +2762,13 @@ int main(int argc, char *argv[]) input_files = &argv[argv_index]; file_count = argc - argv_index; - if (options.verbose) + if (options.verbose) { setbuf(stdout, NULL); - printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024); - printf("Test Seed : %d\n", options.test_seed); - printf("Randoms : %d\n", options.randoms); + printf("Window Size: %d K\n", IGZIP_HIST_SIZE / 1024); + printf("Test Seed : %d\n", options.test_seed); + printf("Randoms : %d\n", options.randoms); + } srand(options.test_seed); hufftables_subset = &hufftables_sub; @@ -2798,7 +2799,8 @@ int main(int argc, char *argv[]) return ret; } - printf("................"); + if (options.verbose) + printf("................"); printf("%s\n", ret ? "Fail" : "Pass"); fin_ret |= ret; } @@ -2824,7 +2826,7 @@ int main(int argc, char *argv[]) in_buf -= offset; - if (i % (options.randoms / 16) == 0) + if (options.verbose && (i % (options.randoms / 16) == 0)) printf("."); if (ret) @@ -2888,7 +2890,7 @@ int main(int argc, char *argv[]) in_buf -= offset; - if (i % (options.randoms / 16) == 0) + if (options.verbose && (i % (options.randoms / 16) == 0)) printf("."); if (ret) @@ -2927,9 +2929,9 @@ int main(int argc, char *argv[]) ret |= test_compress(in_buf, in_size, NO_FLUSH); in_buf -= offset; - - if (i % (options.randoms / 16) == 0) + if (options.verbose && (i % (options.randoms / 16) == 0)) printf("."); + if (ret) return ret; } @@ -2961,7 +2963,7 @@ int main(int argc, char *argv[]) in_buf -= offset; - if (i % (options.randoms / 16) == 0) + if (options.verbose && (i % (options.randoms / 16) == 0)) printf("."); if (ret) return ret; @@ -2994,7 +2996,7 @@ int main(int argc, char *argv[]) in_buf -= offset; - if (i % (options.randoms / 16) == 0) + if (options.verbose && (i % (options.randoms / 16) == 0)) printf("."); if (ret) return ret; @@ -3040,7 +3042,7 @@ int main(int argc, char *argv[]) in_buf -= offset; - if (i % ((options.randoms / 4) / 16) == 0) + if (options.verbose && (i % ((options.randoms / 4) / 16) == 0)) printf("."); if (ret) return ret; @@ -3071,15 +3073,17 @@ int main(int argc, char *argv[]) in_buf -= offset; - if (iterations < 16) { - for (j = 0; j < 16 / iterations; j++) + if (options.verbose) { + if (iterations < 16) { + for (j = 0; j < 16 / iterations; j++) + printf("."); + } else if (i % (iterations / 16) == 0) printf("."); - } else if (i % (iterations / 16) == 0) - printf("."); + } } - if (iterations < 16) { + if (options.verbose && iterations < 16) { for (j = (16 / iterations) * iterations; j < 16; j++) printf("."); } @@ -3094,7 +3098,9 @@ int main(int argc, char *argv[]) if (ret) return ret; } - printf("................"); + + if (options.verbose) + printf("................"); printf("%s\n", ret ? "Fail" : "Pass"); printf("igzip rand test finished: %s\n", diff --git a/igzip/igzip_wrapper_hdr_test.c b/igzip/igzip_wrapper_hdr_test.c index 57e099f..6481483 100644 --- a/igzip/igzip_wrapper_hdr_test.c +++ b/igzip/igzip_wrapper_hdr_test.c @@ -843,8 +843,10 @@ int main(int argc, char *argv[]) if (hdr_buf != NULL) free(hdr_buf); +#ifdef TEST_VERBOSE if (i % (RANDOMS / 16) == 0) printf("."); +#endif } printf("Pass \n"); @@ -878,8 +880,10 @@ int main(int argc, char *argv[]) if (hdr_buf != NULL) free(hdr_buf); +#ifdef TEST_VERBOSE if (i % (RANDOMS / 16) == 0) printf("."); +#endif } printf("Pass \n"); diff --git a/mem/mem_zero_detect_test.c b/mem/mem_zero_detect_test.c index ea3207c..52b2e4a 100644 --- a/mem/mem_zero_detect_test.c +++ b/mem/mem_zero_detect_test.c @@ -71,7 +71,9 @@ int main(int argc, char *argv[]) printf("Fail large buf test\n"); return failures; } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Test to help memory checkers for (i = 1; i < 2345; i++) { @@ -94,7 +96,9 @@ int main(int argc, char *argv[]) return failures; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Test small buffers near end of alloc region a = buf; @@ -105,7 +109,9 @@ int main(int argc, char *argv[]) printf("Fail:\n"); return failures; } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Test for detect non zero a[TEST_MEM / 2] = 1; @@ -115,7 +121,9 @@ int main(int argc, char *argv[]) return -1; } a[TEST_MEM / 2] = 0; +#ifdef TEST_VERBOSE putchar('.'); +#endif // Test various non-zero offsets for (i = 0; i < BORDER_BYTES; i++) { @@ -129,7 +137,9 @@ int main(int argc, char *argv[]) a[i] = 0; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); // Test random non-zero offsets @@ -147,7 +157,9 @@ int main(int argc, char *argv[]) } a[r] = 0; } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); // Test putting non-zero byte at end of buffer @@ -162,7 +174,9 @@ int main(int argc, char *argv[]) a[TEST_MEM - i] = 0; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Test various size buffers and non-zero offsets for (l = 1; l < TEST_LEN; l++) { @@ -188,7 +202,9 @@ int main(int argc, char *argv[]) a[i] = 0; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif // Test random test size and non-zero error offsets for (i = 0; i < RANDOMS; i++) { @@ -203,7 +219,9 @@ int main(int argc, char *argv[]) } a[r] = 0; } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); // Test combinations of zero and non-zero buffers @@ -231,7 +249,9 @@ int main(int argc, char *argv[]) a[r] = 0; } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); aligned_free(buf); diff --git a/raid/pq_check_test.c b/raid/pq_check_test.c index 71c29b5..78a1f6c 100644 --- a/raid/pq_check_test.c +++ b/raid/pq_check_test.c @@ -123,7 +123,9 @@ int main(int argc, char *argv[]) } ((char *)buffs[j])[i] = 0; // un-corrupt buffer } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test rand1 @@ -168,7 +170,9 @@ int main(int argc, char *argv[]) } ((char *)buffs[j])[i] = c; // un-corrupt buffer } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test various number of sources, full length @@ -205,7 +209,9 @@ int main(int argc, char *argv[]) ((char *)buffs[i])[k] = c; // un-corrupt buffer } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } fflush(0); @@ -250,7 +256,9 @@ int main(int argc, char *argv[]) ((char *)buffs[serr])[lerr] = c; // un-corrupt buffer } } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); } k += 16; @@ -292,7 +300,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); } diff --git a/raid/pq_gen_test.c b/raid/pq_gen_test.c index 7b97ebf..a320d5c 100644 --- a/raid/pq_gen_test.c +++ b/raid/pq_gen_test.c @@ -103,8 +103,10 @@ int main(int argc, char *argv[]) if (fail > 0) { printf("fail zero test %d\n", fail); return 1; - } else - putchar('.'); + } +#ifdef TEST_VERBOSE + putchar('.'); +#endif // Test rand1 for (i = 0; i < TEST_SOURCES + 2; i++) @@ -125,8 +127,10 @@ int main(int argc, char *argv[]) dump(buffs[t], 15); return 1; - } else - putchar('.'); + } +#ifdef TEST_VERBOSE + putchar('.'); +#endif // Test various number of sources for (j = 4; j <= TEST_SOURCES + 2; j++) { @@ -139,8 +143,10 @@ int main(int argc, char *argv[]) if (fail > 0) { printf("fail rand test %d sources\n", j); return 1; - } else - putchar('.'); + } +#ifdef TEST_VERBOSE + putchar('.'); +#endif } fflush(0); @@ -161,7 +167,9 @@ int main(int argc, char *argv[]) return 1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif k += 32; } @@ -181,9 +189,10 @@ int main(int argc, char *argv[]) "ret: %d\n", k, TEST_LEN - k, fail, ret); return 1; } - +#ifdef TEST_VERBOSE putchar('.'); fflush(0); +#endif k += 32; } diff --git a/raid/xor_check_test.c b/raid/xor_check_test.c index b0397d5..b60db8c 100644 --- a/raid/xor_check_test.c +++ b/raid/xor_check_test.c @@ -103,7 +103,9 @@ int main(int argc, char *argv[]) } ((char *)buffs[j])[i] = 0; // un-corrupt buffer } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test rand1 @@ -148,7 +150,9 @@ int main(int argc, char *argv[]) } ((char *)buffs[j])[i] = c; // un-corrupt buffer } +#ifdef TEST_VERBOSE putchar('.'); +#endif } // Test various number of sources, full length @@ -185,7 +189,9 @@ int main(int argc, char *argv[]) ((char *)buffs[i])[k] = c; // un-corrupt buffer } } +#ifdef TEST_VERBOSE putchar('.'); +#endif } fflush(0); @@ -227,7 +233,9 @@ int main(int argc, char *argv[]) } } } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); k += 1; } @@ -268,7 +276,9 @@ int main(int argc, char *argv[]) } } +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); } diff --git a/raid/xor_gen_test.c b/raid/xor_gen_test.c index b624ba1..0897cae 100644 --- a/raid/xor_gen_test.c +++ b/raid/xor_gen_test.c @@ -85,8 +85,10 @@ int main(int argc, char *argv[]) if (fail > 0) { printf("fail zero test"); return 1; - } else - putchar('.'); + } +#ifdef TEST_VERBOSE + putchar('.'); +#endif // Test rand1 for (i = 0; i < TEST_SOURCES + 1; i++) @@ -99,8 +101,10 @@ int main(int argc, char *argv[]) if (fail > 0) { printf("fail rand test %d\n", fail); return 1; - } else - putchar('.'); + } +#ifdef TEST_VERBOSE + putchar('.'); +#endif // Test various number of sources for (j = 3; j <= TEST_SOURCES + 1; j++) { @@ -113,8 +117,10 @@ int main(int argc, char *argv[]) if (fail > 0) { printf("fail rand test %d sources\n", j); return 1; - } else - putchar('.'); + } +#ifdef TEST_VERBOSE + putchar('.'); +#endif } fflush(0); @@ -135,7 +141,9 @@ int main(int argc, char *argv[]) return 1; } } +#ifdef TEST_VERBOSE putchar('.'); +#endif k += 1; } @@ -153,8 +161,9 @@ int main(int argc, char *argv[]) printf("fail end test - offset: %d, len: %d\n", i, TEST_LEN - i); return 1; } - +#ifdef TEST_VERBOSE putchar('.'); +#endif fflush(0); }