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 : psiginfo_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 */ 26void psiginfo_0100(void) 27{ 28 errno = 0; 29 siginfo_t info; 30 memset(&info, 0x0, sizeof(siginfo_t)); 31 info.si_signo = SIGUSR1; 32 psiginfo(&info, "SIGUSR1"); 33 EXPECT_EQ("psiginfo_0100", errno, CMPFLAG); 34} 35 36/** 37 * @tc.name : psiginfo_0200 38 * @tc.desc : Invalid parameters are passed in, the function call succeeds, 39 * and a message is output to the console 40 * @tc.level : Level 0 41 */ 42void psiginfo_0200(void) 43{ 44 errno = 0; 45 siginfo_t info; 46 memset(&info, 0x0, sizeof(siginfo_t)); 47 info.si_signo = SIGUSR1; 48 psiginfo(&info, NULL); 49 EXPECT_EQ("psiginfo_0200", errno, CMPFLAG); 50} 51 52/** 53 * @tc.name : psiginfo_0300 54 * @tc.desc : Invalid parameters are passed in, the function call succeeds, 55 * and a message is output to the console 56 * @tc.level : Level 2 57 */ 58void psiginfo_0300(void) 59{ 60 errno = 0; 61 siginfo_t info; 62 memset(&info, 0x0, sizeof(siginfo_t)); 63 info.si_signo = -1; 64 psiginfo(&info, NULL); 65 EXPECT_EQ("psiginfo_0300", errno, CMPFLAG); 66} 67 68int main(void) 69{ 70 psiginfo_0100(); 71 psiginfo_0200(); 72 psiginfo_0300(); 73 return t_status; 74}