Skip to content

Commit

Permalink
posix: Add tests for putpmsg
Browse files Browse the repository at this point in the history
Add implementaiton and header tests for putpmsg

Signed-off-by: Abhinav Srivastava <[email protected]>
  • Loading branch information
AbhinavMir committed Mar 22, 2024
1 parent ed3cb0a commit c7b5bea
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/zephyr/posix/stropts.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ struct strbuf {

int putmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int flags);

int putpmsg(int fildes, const struct strbuf *ctlptr,
const struct strbuf *dataptr, int band, int flags);
int putpmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int band,
int flags);

#ifdef __cplusplus
}
Expand Down
4 changes: 2 additions & 2 deletions lib/posix/options/stropts.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ int putmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr
return -1;
}

int putpmsg(int fildes, const struct strbuf *ctlptr,
const struct strbuf *dataptr, int band, int flags)
int putpmsg(int fildes, const struct strbuf *ctlptr, const struct strbuf *dataptr, int band,
int flags)
{
ARG_UNUSED(fildes);
ARG_UNUSED(ctlptr);
Expand Down
13 changes: 13 additions & 0 deletions tests/posix/common/src/stropts.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,17 @@ ZTEST(stropts, test_putmsg)
zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno);
}

ZTEST(stropts, test_putpmsg)
{
const struct strbuf *ctrl = NULL;
const struct strbuf *data = NULL;
int fd = -1;
int band = 0;
int flags = 0;
int ret = putpmsg(fd, ctrl, data, band, flags);

zassert_equal(ret, -1, "Expected return value -1, got %d", ret);
zassert_equal(errno, ENOSYS, "Expected errno ENOSYS, got %d", errno);
}

ZTEST_SUITE(stropts, NULL, NULL, NULL, NULL, NULL);
7 changes: 7 additions & 0 deletions tests/posix/headers/src/stropts_h.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ ZTEST(posix_headers, test_stropts_h)
zassert_not_equal(RS_HIPRI, ~RS_HIPRI);
#endif
}

ZTEST(posix_headers, test_stropts_putpmsg)
{
#ifdef CONFIG_POSIX_API
zassert_not_null((void *)putpmsg, "putpmsg is null");
#endif
}

0 comments on commit c7b5bea

Please sign in to comment.