[PATCH v7 1/4] tests: replace read by xread
Joseph Myers
joseph@codesourcery.com
Mon Jun 12 16:57:41 GMT 2023
On Mon, 12 Jun 2023, Frédéric Bérat via Libc-alpha wrote:
> @@ -56,7 +58,7 @@ tf (void *arg)
>
> /* This call should block and be cancelable. */
> char buf[20];
> - read (fd[0], buf, sizeof (buf));
> + xread (fd[0], buf, sizeof (buf));
Since the comment suggests this code is actually testing a property of the
read function, it seems doubtful whether it's appropriate to change it to
call xread - which would impose an API requirement on xread that it calls
read in exactly the way under test. Calling x* functions is fine in
testcases when the function in question is not under test - for example,
when the point of calling xread is just to read some data, with the
details of how that's done being irrelevant - but questionable when the
test is a test of read itself.
> @@ -32,7 +34,7 @@ tf (void *arg)
> }
>
> char buf[10];
> - read (fds[0], buf, sizeof (buf));
> + xread (fds[0], buf, sizeof (buf));
>
> puts ("read returned");
The same might apply here.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list