[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 02:41:57 +0100 |
User-agent: |
KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; ) |
Eric Blake wrote:
> +static int
> +test_errors (int fd, const char *slave)
On Cygwin and mingw I'm seeing this warning:
test-ptsname_r.c: In function `test_errors':
test-ptsname_r.c:89: warning: control reaches end of non-void function
On MacOS X 10.5 I'm seeing this failure:
test-ptsname_r.c:72: assertion failed
FAIL: test-ptsname_r
Cause: ptsname_r failed with ERANGE.
Once this is fixed, I get:
$ ./test-ptsname_r
Alarm clock
Cause: There are too many ptsname_r calls.
I'm applying this fix. It reduces the runtime (on MacOS X 10.5) to ca. 1.2 sec.
2011-11-09 Bruno Haible <address@hidden>
ptsname_r tests: Fix bugs.
* tests/test-ptsname_r.c (test_errors): Change return type to 'void'.
Fix ptsname_r calls. Reduce loop rounds to a reasonable amount.
--- tests/test-ptsname_r.c.orig Thu Nov 10 02:38:37 2011
+++ tests/test-ptsname_r.c Thu Nov 10 02:37:24 2011
@@ -53,20 +53,24 @@
&& SAME_INODE (statbuf1, statbuf2)));
}
-static int
+static void
test_errors (int fd, const char *slave)
{
char buffer[256];
size_t len;
- int result;
+ size_t buflen_max;
size_t buflen;
+ int result;
len = strlen (slave);
- for (buflen = 0; buflen <= sizeof buffer; buflen++)
+ buflen_max = len + 5;
+ if (buflen_max > sizeof buffer)
+ buflen_max = sizeof buffer;
+ for (buflen = 0; buflen <= buflen_max; buflen++)
{
- errno = 0;
memset (buffer, 'X', sizeof buffer);
- result = ptsname_r (fd, buffer, len);
+ errno = 0;
+ result = ptsname_r (fd, buffer, buflen);
if (buflen > len)
{
ASSERT (result == 0);
--
In memoriam Robert Blum <http://en.wikipedia.org/wiki/Robert_Blum>
- [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, 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, 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