[PATCH v5 3/3] Add tests for the -l/--syscall-limit option
Sahil Siddiq
icegambit91 at gmail.com
Sun Mar 26 10:42:01 UTC 2023
On Sunday, 26 March 2023 01:28:02 IST Dmitry V. Levin wrote:
> On Mon, Mar 20, 2023 at 11:10:58AM +0530, Sahil Siddiq wrote:
> [...]
> > + FILE *f = fopen("dummy.file", "w");
> > + fclose(f);
> > +
> > + return WEXITSTATUS(status);
> > +}
>
> There is a problem with this approach: it's racy, because the expected
> output is partially printed asynchronously. For the same reason, the exit
> status is ignored. I suggest writing the exit status into a file, and in
> the test script wait for this file, check the exit status, and then
> compare the expected and the actual output.
Sorry, I am still a little unfamiliar with this. Could you please explain the racy
part. While the parent is in the following loop:
while ((waitpid(child, &status, 0)) != child) {
if (errno == EINTR)
continue;
perror_msg_and_fail("waitpid: %d", child);
}
the child process will be busy printing output. After the child terminates, the
parent process will resume. The "dummy.file" is created after that. I didn't
understand which part runs asynchronously and why.
Regards,
Sahil
More information about the Strace-devel
mailing list