kernel32/tests: Fixed the pipe test for MacOS.

This commit is contained in:
Alexandre Julliard 2006-11-09 15:40:36 +01:00
parent 4769950d66
commit 91bb29ca4d
1 changed files with 34 additions and 19 deletions

View File

@ -129,22 +129,25 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf2), "write file len 3b\n"); ok(written == sizeof(obuf2), "write file len 3b\n");
ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek3\n"); ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek3\n");
if (pipemode == PIPE_TYPE_BYTE) { if (pipemode == PIPE_TYPE_BYTE) {
todo_wine { if (readden != sizeof(obuf)) /* Linux only returns the first message */
/* should return all 23 bytes */
ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden); ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden);
} else
todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes\n", readden);
} }
else else
ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden); {
if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both messages */
ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden);
else
todo_wine ok(readden == sizeof(obuf), "peek3 got %d bytes\n", readden);
}
if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes available\n", avail); ok(avail == sizeof(obuf) + sizeof(obuf2), "peek3 got %d bytes available\n", avail);
pbuf = ibuf; pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 3a check\n"); ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 3a check\n");
if (pipemode == PIPE_TYPE_BYTE) { if (pipemode == PIPE_TYPE_BYTE && readden >= sizeof(obuf)+sizeof(obuf2)) {
todo_wine { pbuf += sizeof(obuf);
pbuf += sizeof(obuf); ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "pipe content 3b check\n");
ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "pipe content 3b check\n");
}
} }
ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n");
ok(readden == sizeof(obuf) + sizeof(obuf2), "read 3 got %d bytes\n", readden); ok(readden == sizeof(obuf) + sizeof(obuf2), "read 3 got %d bytes\n", readden);
@ -161,22 +164,26 @@ static void test_CreateNamedPipe(int pipemode)
ok(written == sizeof(obuf2), "write file len 4b\n"); ok(written == sizeof(obuf2), "write file len 4b\n");
ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek4\n"); ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek4\n");
if (pipemode == PIPE_TYPE_BYTE) { if (pipemode == PIPE_TYPE_BYTE) {
todo_wine { if (readden != sizeof(obuf)) /* Linux only returns the first message */
/* should return all 23 bytes */ /* should return all 23 bytes */
ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden); ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden);
} else
todo_wine ok(readden == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes\n", readden);
} }
else else
ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden); {
if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both messages */
ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden);
else
todo_wine ok(readden == sizeof(obuf), "peek4 got %d bytes\n", readden);
}
if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes available\n", avail); ok(avail == sizeof(obuf) + sizeof(obuf2), "peek4 got %d bytes available\n", avail);
pbuf = ibuf; pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 4a check\n"); ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "pipe content 4a check\n");
if (pipemode == PIPE_TYPE_BYTE) { if (pipemode == PIPE_TYPE_BYTE && readden >= sizeof(obuf)+sizeof(obuf2)) {
todo_wine { pbuf += sizeof(obuf);
pbuf += sizeof(obuf); ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "pipe content 4b check\n");
ok(memcmp(obuf2, pbuf, sizeof(obuf2)) == 0, "pipe content 4b check\n");
}
} }
ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); ok(ReadFile(hnp, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n");
if (pipemode == PIPE_TYPE_BYTE) { if (pipemode == PIPE_TYPE_BYTE) {
@ -212,9 +219,14 @@ static void test_CreateNamedPipe(int pipemode)
ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), " WriteFile5b\n"); ok(WriteFile(hnp, obuf2, sizeof(obuf2), &written, NULL), " WriteFile5b\n");
ok(written == sizeof(obuf2), "write file len 3b\n"); ok(written == sizeof(obuf2), "write file len 3b\n");
ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek5\n"); ok(PeekNamedPipe(hFile, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek5\n");
ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden); if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both writes */
ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden);
else
todo_wine ok(readden == sizeof(obuf), "peek5 got %d bytes\n", readden);
if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail); ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail);
else
todo_wine ok(avail == sizeof(obuf) + sizeof(obuf2), "peek5 got %d bytes available\n", avail);
pbuf = ibuf; pbuf = ibuf;
ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 5a check\n"); ok(memcmp(obuf, pbuf, sizeof(obuf)) == 0, "content 5a check\n");
ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n"); ok(ReadFile(hFile, ibuf, sizeof(ibuf), &readden, NULL), "ReadFile\n");
@ -243,7 +255,10 @@ static void test_CreateNamedPipe(int pipemode)
ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), " WriteFile6b\n"); ok(WriteFile(hFile, obuf2, sizeof(obuf2), &written, NULL), " WriteFile6b\n");
ok(written == sizeof(obuf2), "write file len 6b\n"); ok(written == sizeof(obuf2), "write file len 6b\n");
ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6\n"); ok(PeekNamedPipe(hnp, ibuf, sizeof(ibuf), &readden, &avail, NULL), "Peek6\n");
ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden); if (readden != sizeof(obuf) + sizeof(obuf2)) /* MacOS returns both writes */
ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden);
else
todo_wine ok(readden == sizeof(obuf), "peek6 got %d bytes\n", readden);
if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */ if (avail != sizeof(obuf)) /* older Linux kernels only return the first write here */
ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %d bytes available\n", avail); ok(avail == sizeof(obuf) + sizeof(obuf2), "peek6b got %d bytes available\n", avail);
pbuf = ibuf; pbuf = ibuf;