Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions memtester.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define EXIT_FAIL_OTHERTEST 0x04

struct test tests[] = {
{ "Stuck Address", test_stuck_address },
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you add Stuck Address at the end of the array instead of shift the indices of the other tests in the testmask?

{ "Random Value", test_random_value },
{ "Compare XOR", test_xor_comparison },
{ "Compare SUB", test_sub_comparison },
Expand Down Expand Up @@ -103,13 +104,13 @@ off_t physaddrbase = 0;
/* Function definitions */
void usage(char *me) {
fprintf(stderr, "\n"
"Usage: %s [-p physaddrbase [-d device] [-u]] <mem>[B|K|M|G] [loops]\n",
"Usage: [MEMTESTER_TEST_MASK=0x<mask>] %s [-p physaddrbase [-d device] [-u]] <mem>[B|K|M|G] [loops]\n",
me);
exit(EXIT_FAIL_NONSTARTER);
}

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;
Expand Down Expand Up @@ -198,8 +199,8 @@ int main(int argc, char **argv) {
}
break;
case 'u':
o_flags &= ~O_SYNC;
break;
o_flags &= ~O_SYNC;
break;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are mixing changes for different purposes here. Is it your editor changing the indentation?

default: /* '?' */
usage(argv[0]); /* doesn't return */
}
Expand Down Expand Up @@ -390,13 +391,7 @@ 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;
}
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
Expand All @@ -411,6 +406,7 @@ int main(int argc, char **argv) {
printf("ok\n");
} else {
exit_code |= EXIT_FAIL_OTHERTEST;
errorcnt++;
}
fflush(stdout);
/* clear buffer */
Expand Down
2 changes: 1 addition & 1 deletion tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bufb is not used; then add a "(void)bufb;" line to muffle the compiler.

ulv *p1 = bufa;
unsigned int j;
size_t i;
Expand Down