1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include <gtest/gtest.h>
17 #include <fcntl.h>
18 #include <sys/socket.h>
19 #include <sys/un.h>
20 #include <cstdlib>
21 #include <unistd.h>
22 #include <sys/wait.h>
23 #include <csignal>
24 #include <cerrno>
25 #include <cstring>
26 #include <sys/prctl.h>
27 #include <sys/types.h>
28 #include <sys/stat.h>
29 #include <fcntl.h>
30 #include <sys/syscall.h>
31 #include <asm/unistd.h>
32 #include <syscall.h>
33 #include <climits>
34 #include <sched.h>
35 #include "beget_ext.h"
36 #include "securec.h"
37
38 #include "init_socket.h"
39
40 using namespace std;
41 using namespace testing::ext;
42
43 namespace init_ut {
44 class SocketUnitTest : public testing::Test {
45 public:
SetUpTestCase(void)46 static void SetUpTestCase(void) {};
TearDownTestCase(void)47 static void TearDownTestCase(void) {};
SetUp()48 void SetUp() {};
TearDown()49 void TearDown() {};
50 }
51
HWTEST_F(SocketUnitTest, GetControlSocket_001, TestSize.Level1)52 HWTEST_F(SocketUnitTest, GetControlSocket_001, TestSize.Level1)
53 {
54 string serviceName = "test.Service";
55 int ret = GetControlSocket(serviceName);
56 EXPECT_EQ(ret, EC_SUCCESS);
57 }
58 }
59