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 <fcntl.h>
17 #include <sys/klog.h>
18 #include "functionalext.h"
19
20 #define SYSLOG_ACTION_SIZE_BUFFER (10)
21
22 /**
23 * @tc.name : klogctl_0100
24 * @tc.desc : Verify klogctl process success.
25 * @tc.level : Level 0
26 */
klogctl_0100(void)27 void klogctl_0100(void)
28 {
29 int ret = klogctl(SYSLOG_ACTION_SIZE_BUFFER, 0, 0);
30 EXPECT_MT("klogctl_0200", ret, 0);
31 }
32
33 /**
34 * @tc.name : klogctl_0200
35 * @tc.desc : Verify klogctl process fail bacause param type is invalid.
36 * @tc.level : Level 0
37 */
klogctl_0200(void)38 void klogctl_0200(void)
39 {
40 int ret = klogctl(-1, 0, 0);
41 EXPECT_EQ("klogctl_0200", ret, -1);
42 }
43
main(void)44 int main(void)
45 {
46 klogctl_0100();
47 klogctl_0200();
48 return t_status;
49 }
50