1 | //===-- Unittests for getsid ----------------------------------------------===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "src/unistd/getsid.h" |
10 | #include "test/UnitTest/ErrnoCheckingTest.h" |
11 | #include "test/UnitTest/Test.h" |
12 | |
13 | using LlvmLibcGetSidTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest; |
14 | |
15 | TEST_F(LlvmLibcGetSidTest, GetCurrSID) { |
16 | pid_t sid = LIBC_NAMESPACE::getsid(0); |
17 | ASSERT_NE(sid, -1); |
18 | ASSERT_ERRNO_SUCCESS(); |
19 | |
20 | pid_t nonexist_sid = LIBC_NAMESPACE::getsid(-1); |
21 | ASSERT_EQ(nonexist_sid, -1); |
22 | ASSERT_ERRNO_FAILURE(); |
23 | } |
24 | |