Skip to content

Commit

Permalink
Improve sendfd/recvfd test
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
  • Loading branch information
sustrik committed Nov 18, 2018
1 parent 46ef146 commit c1cf349
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/ipc.c
Expand Up @@ -223,10 +223,20 @@ int main() {
int sp[2];
rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp);
errno_assert(rc == 0);
rc = bsend(s[0], "ABC", 3, -1);
errno_assert(rc == 0);
rc = ipc_sendfd(s[0], sp[0], -1);
errno_assert(rc == 0);
rc = bsend(s[0], "DEF", 3, -1);
errno_assert(rc == 0);
rc = brecv(s[1], buf, 3, -1);
errno_assert(rc == 0);
assert(buf[0] == 'A' && buf[1] == 'B' && buf[2] == 'C');
int rfd = ipc_recvfd(s[1], -1);
errno_assert(rfd >= 0);
rc = brecv(s[1], buf, 3, -1);
errno_assert(rc == 0);
assert(buf[0] == 'D' && buf[1] == 'E' && buf[2] == 'F');
uint8_t c = 0x55;
sz = send(rfd, &c, sizeof(c), 0);
errno_assert(sz > 0);
Expand Down

0 comments on commit c1cf349

Please sign in to comment.