[clang][bytecode][NFC] Only call getSource() when necessary (#125419)
[llvm-project.git] / libc / test / src / sys / socket / linux / socket_test.cpp
blobd1197fa3ef7c6158a9f5cf6b75f4fe6d38ceae35
1 //===-- Unittests for socket ----------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "src/sys/socket/socket.h"
11 #include "src/unistd/close.h"
13 #include "src/errno/libc_errno.h"
14 #include "test/UnitTest/Test.h"
16 #include <sys/socket.h> // For AF_UNIX and SOCK_DGRAM
18 TEST(LlvmLibcSocketTest, LocalSocket) {
19 int sock = LIBC_NAMESPACE::socket(AF_UNIX, SOCK_DGRAM, 0);
20 ASSERT_GE(sock, 0);
21 ASSERT_ERRNO_SUCCESS();
23 LIBC_NAMESPACE::close(sock);