From 43ae4f365df8bbb533aa1c8910b51e27b724255e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Sch=C3=B6fegger?= Date: Mon, 2 May 2022 20:39:38 +0200 Subject: [PATCH 1/3] move stack address mask test into test loop to allow masking out --- memtester.c | 10 ++-------- tests.c | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/memtester.c b/memtester.c index e59b037..186c3c9 100644 --- a/memtester.c +++ b/memtester.c @@ -35,6 +35,7 @@ #define EXIT_FAIL_OTHERTEST 0x04 struct test tests[] = { + { "Stuck Address", test_stuck_address }, { "Random Value", test_random_value }, { "Compare XOR", test_xor_comparison }, { "Compare SUB", test_sub_comparison }, @@ -103,7 +104,7 @@ off_t physaddrbase = 0; /* Function definitions */ void usage(char *me) { fprintf(stderr, "\n" - "Usage: %s [-p physaddrbase [-d device] [-u]] [B|K|M|G] [loops]\n", + "Usage: [MEMTESTER_TEST_MASK=0x] %s [-p physaddrbase [-d device] [-u]] [B|K|M|G] [loops]\n", me); exit(EXIT_FAIL_NONSTARTER); } @@ -390,13 +391,6 @@ int main(int argc, char **argv) { printf("/%lu", loops); } printf(":\n"); - printf(" %-20s: ", "Stuck Address"); - fflush(stdout); - if (!test_stuck_address(aligned, bufsize / sizeof(ul))) { - printf("ok\n"); - } else { - exit_code |= EXIT_FAIL_ADDRESSLINES; - } for (i=0;;i++) { if (!tests[i].name) break; /* If using a custom testmask, only run this test if the diff --git a/tests.c b/tests.c index 735c3d7..0f1e446 100644 --- a/tests.c +++ b/tests.c @@ -64,7 +64,7 @@ int compare_regions(ulv *bufa, ulv *bufb, size_t count) { return r; } -int test_stuck_address(ulv *bufa, size_t count) { +int test_stuck_address(ulv *bufa, ulv *bufb, size_t count) { ulv *p1 = bufa; unsigned int j; size_t i; From c2d2bbf88c061b5891b5c5af2dc9bd43dbd514c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Sch=C3=B6fegger?= Date: Mon, 2 May 2022 20:49:44 +0200 Subject: [PATCH 2/3] add error counter --- memtester.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/memtester.c b/memtester.c index 186c3c9..13c624b 100644 --- a/memtester.c +++ b/memtester.c @@ -110,7 +110,7 @@ void usage(char *me) { } int main(int argc, char **argv) { - ul loops, loop, i; + ul loops, loop, i, errorcnt = 0; size_t pagesize, wantraw, wantmb, wantbytes, wantbytes_orig, bufsize, halflen, count; char *memsuffix, *addrsuffix, *loopsuffix; @@ -199,8 +199,8 @@ int main(int argc, char **argv) { } break; case 'u': - o_flags &= ~O_SYNC; - break; + o_flags &= ~O_SYNC; + break; default: /* '?' */ usage(argv[0]); /* doesn't return */ } @@ -386,7 +386,8 @@ int main(int argc, char **argv) { bufb = (ulv *) ((size_t) aligned + halflen); for(loop=1; ((!loops) || loop <= loops); loop++) { - printf("Loop %lu", loop); + printf("Loop %lu\n", loop); + printf("total errors = %lu", errorcnt); if (loops) { printf("/%lu", loops); } @@ -405,6 +406,7 @@ int main(int argc, char **argv) { printf("ok\n"); } else { exit_code |= EXIT_FAIL_OTHERTEST; + errorcnt++; } fflush(stdout); /* clear buffer */ From ac4e5251da57f089919ed6613ba7985d8d60d820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Sch=C3=B6fegger?= Date: Tue, 3 May 2022 17:15:55 +0200 Subject: [PATCH 3/3] fix loop count output --- memtester.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/memtester.c b/memtester.c index 13c624b..da3fd80 100644 --- a/memtester.c +++ b/memtester.c @@ -386,12 +386,12 @@ int main(int argc, char **argv) { bufb = (ulv *) ((size_t) aligned + halflen); for(loop=1; ((!loops) || loop <= loops); loop++) { - printf("Loop %lu\n", loop); - printf("total errors = %lu", errorcnt); + printf("Loop %lu", loop); if (loops) { printf("/%lu", loops); } printf(":\n"); + printf("total errors = %lu\n", errorcnt); for (i=0;;i++) { if (!tests[i].name) break; /* If using a custom testmask, only run this test if the