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 <signal.h>
17 #include <string.h>
18 #include "functionalext.h"
19
20 /**
21 * @tc.name : psignal_0100
22 * @tc.desc : Pass the normal parameters, the function call is successful,
23 * and the message is output in the console
24 * @tc.level : Level 0
25 */
psignal_0100(void)26 void psignal_0100(void)
27 {
28 errno = 0;
29 psignal(SIGUSR1, "SIGUSR1");
30 EXPECT_EQ("psignal_0100", errno, CMPFLAG);
31 }
32
33 /**
34 * @tc.name : psignal_0200
35 * @tc.desc : Invalid parameters are passed in, the function call succeeds,
36 * and a message is output to the console
37 * @tc.level : Level 0
38 */
psignal_0200(void)39 void psignal_0200(void)
40 {
41 errno = 0;
42 psignal(SIGUSR1, NULL);
43 EXPECT_EQ("psignal_0200", errno, CMPFLAG);
44 }
45
46 /**
47 * @tc.name : psignal_0300
48 * @tc.desc : Invalid parameters are passed in, the function call succeeds,
49 * and a message is output to the console
50 * @tc.level : Level 2
51 */
psignal_0300(void)52 void psignal_0300(void)
53 {
54 errno = 0;
55 psignal(-1, NULL);
56 EXPECT_EQ("psignal_0300", errno, CMPFLAG);
57 }
58
main(void)59 int main(void)
60 {
61 psignal_0100();
62 psignal_0200();
63 psignal_0300();
64 return t_status;
65 }