[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/4] ptsname_r-tests: new test module
From: |
Bruno Haible |
Subject: |
Re: [PATCH 2/4] ptsname_r-tests: new test module |
Date: |
Thu, 10 Nov 2011 13:57:19 +0100 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
> * tests/test-ptsname_r.c: New file.
You are testing that the return value in case of failure is == errno.
This is not documented, neither in the glibc documentation, nor in the
Linux man page. Why should people write
if (result == EINVAL)
when they can just as well write
if (errno == EINVAL)
? The latter code is more future-proof.
Here's a suggested patch:
--- tests/test-ptsname_r.c.orig Thu Nov 10 13:52:13 2011
+++ tests/test-ptsname_r.c Thu Nov 10 12:38:25 2011
@@ -79,7 +79,6 @@
else
{
ASSERT (result != 0);
- ASSERT (result == errno);
ASSERT (errno == ERANGE);
ASSERT (buffer[0] == 'X');
}
@@ -88,7 +87,6 @@
errno = 0;
result = ptsname_r (fd, NULL, 0);
ASSERT (result != 0);
- ASSERT (result == errno);
ASSERT (errno == EINVAL);
}
@@ -109,7 +107,6 @@
errno = 0;
result = ptsname_r (-1, buffer, sizeof buffer);
ASSERT (result != 0);
- ASSERT (result == errno);
ASSERT (errno == EBADF || errno == ENOTTY);
}
--
In memoriam Cornstalk <http://en.wikipedia.org/wiki/Cornstalk>
- [PATCH 0/4] add ptsname_r, Eric Blake, 2011/11/07
- [PATCH 2/4] ptsname_r-tests: new test module, Eric Blake, 2011/11/07
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Bruno Haible, 2011/11/08
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Eric Blake, 2011/11/09
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Bruno Haible, 2011/11/09
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Bruno Haible, 2011/11/09
- ptsname_r testing, Bruno Haible, 2011/11/10
- Re: ptsname_r on OSF/1, Bruno Haible, 2011/11/10
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Bruno Haible, 2011/11/10
- Re: [PATCH 2/4] ptsname_r-tests: new test module,
Bruno Haible <=
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Eric Blake, 2011/11/10
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Bruno Haible, 2011/11/10
- Re: [PATCH 2/4] ptsname_r-tests: new test module, Eric Blake, 2011/11/10
[PATCH 4/4] ptsname_r: work around FreeBSD issue, Eric Blake, 2011/11/07
[PATCH 3/4] ptsname_r: port to Solaris, Eric Blake, 2011/11/07
[PATCH 1/4] ptsname_r: new module, Eric Blake, 2011/11/07