Skip to content

Commit

Permalink
ON-15724: change method of reading fd in zfstackdump test
Browse files Browse the repository at this point in the history
Previously, we would redirect fd 1000 into egrep to get the output
of our stackdump, however, this didn't work on newer Ubuntu's and
perhaps others. Instead, we now rely on sysfs to correctly link
to our opened fds.

As supplementary changes, this now uses cat so the output is kept
for the sake of test logs, and grep -E to replace egrep as egrep
is becoming deprecated on some newer OSes.
  • Loading branch information
jfeather-amd committed May 31, 2024
1 parent a61dbe4 commit ace0b69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tests/zf_unit/zfstackdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ static void test_stack_version(struct zf_stack* stack, struct zf_attr* attr)
zf_stack_dump(stack);
fflush(stdout);
dup2(stdout_fd, STDOUT_FILENO);
fclose(f);
lseek(1000, 0, SEEK_SET);
int rc = system("egrep 'version=.*' <&1000");
int rc = system("cat /proc/self/fd/1000 | grep -E 'version=.*'");
fclose(f);

cmp_ok(rc, "==", 0, "Version found.");
}
Expand Down

0 comments on commit ace0b69

Please sign in to comment.