Skip to content

Commit

Permalink
tests: posix: uname: add test
Browse files Browse the repository at this point in the history
add ztest for uname api

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
  • Loading branch information
ycsin committed Jul 4, 2023
1 parent 5a8019c commit 02597f8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/posix/common/src/uname.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2023 meta
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/ztest.h>
#include <sys/utsname.h>

ZTEST(posix_apis, test_posix_uname)
{
int rc;

rc = uname(NULL);
zassert_equal(rc, -1, "rc expected to be -1, but got %d", rc);

struct utsname info;

zassert_ok(uname(&info));
zassert_ok(strncmp(info.sysname, "Zephyr", sizeof(info.sysname)));
zassert_ok(strncmp(info.machine, CONFIG_ARCH, sizeof(info.machine)));
}

0 comments on commit 02597f8

Please sign in to comment.