• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 <sys/eventfd.h>
17 #include "functionalext.h"
18 
19 /**
20  * @tc.name      : eventfd_0100
21  * @tc.desc      : The flags parameter is equal to EFD_SEMAPHORE, which creates an eventfd object.
22  * @tc.level     : Level 0
23  */
eventfd_0100(void)24 void eventfd_0100(void)
25 {
26     int ret = eventfd(0, EFD_SEMAPHORE);
27     EXPECT_TRUE("eventfd_0100", ret > 0);
28 }
29 
30 /**
31  * @tc.name      : eventfd_0200
32  * @tc.desc      : The flags parameter is equal to EFD_CLOEXEC, which creates an eventfd object.
33  * @tc.level     : Level 1
34  */
eventfd_0200(void)35 void eventfd_0200(void)
36 {
37     int ret = eventfd(0, EFD_CLOEXEC);
38     EXPECT_TRUE("eventfd_0200", ret > 0);
39 }
40 
41 /**
42  * @tc.name      : eventfd_0300
43  * @tc.desc      : The flags parameter is equal to EFD_NONBLOCK, which creates an eventfd object.
44  * @tc.level     : Level 1
45  */
eventfd_0300(void)46 void eventfd_0300(void)
47 {
48     int ret = eventfd(0, EFD_NONBLOCK);
49     EXPECT_TRUE("eventfd_0300", ret > 0);
50 }
51 
main(int argc,char * argv[])52 int main(int argc, char *argv[])
53 {
54     eventfd_0100();
55     eventfd_0200();
56     eventfd_0300();
57     return t_status;
58 }