git: 13ca1f11d6ff - stable/13 - libc/sys: add errno test
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 03 Mar 2024 04:00:26 UTC
The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=13ca1f11d6ff96a5a1363ff954091ab9e0407e1d commit 13ca1f11d6ff96a5a1363ff954091ab9e0407e1d Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-02-24 23:39:02 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-03-02 05:04:50 +0000 libc/sys: add errno test (cherry picked from commit 32fdcff8703da6f2795193acc77ec3c1fb8b723d) --- lib/libc/tests/sys/Makefile | 1 + lib/libc/tests/sys/errno_test.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile index f44cec11225d..380b3b511049 100644 --- a/lib/libc/tests/sys/Makefile +++ b/lib/libc/tests/sys/Makefile @@ -7,6 +7,7 @@ PACKAGE= tests ATF_TESTS_C+= brk_test .endif ATF_TESTS_C+= cpuset_test +ATF_TESTS_C+= errno_test ATF_TESTS_C+= queue_test ATF_TESTS_C+= sendfile_test diff --git a/lib/libc/tests/sys/errno_test.c b/lib/libc/tests/sys/errno_test.c new file mode 100644 index 000000000000..27d0548fc29d --- /dev/null +++ b/lib/libc/tests/sys/errno_test.c @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2024 The FreeBSD Foundation + * + * SPDX-License-Identifier: BSD-2-Clause + * + * This software were developed by Konstantin Belousov <kib@FreeBSD.org> + * under sponsorship from the FreeBSD Foundation. + */ + +#include <errno.h> +#include <unistd.h> + +#include <atf-c.h> + +ATF_TC(errno_basic); +ATF_TC_HEAD(errno_basic, tc) +{ + atf_tc_set_md_var(tc, "descr", + "Verify basic functionality of errno"); +} + +ATF_TC_BODY(errno_basic, tc) +{ + int res; + + res = unlink("/non/existent/file"); + ATF_REQUIRE(res == -1); + ATF_REQUIRE(errno == ENOENT); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, errno_basic); + + return (atf_no_error()); +}