• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "ffrt_inner.h"
18 #include "../common.h"
19 
20 extern "C" int ffrt_set_task_io_qos(int service, uint64_t id, int qos, void* payload);
21 
22 using namespace std;
23 using namespace testing;
24 #ifdef HWTEST_TESTING_EXT_ENABLE
25 using namespace testing::ext;
26 #endif
27 
28 class ResourceMngrTest : public testing::Test {
29 protected:
SetUpTestCase()30     static void SetUpTestCase()
31     {
32     }
33 
TearDownTestCase()34     static void TearDownTestCase()
35     {
36     }
37 
SetUp()38     void SetUp() override
39     {
40     }
41 
TearDown()42     void TearDown() override
43     {
44     }
45 };
46 
47 /*
48  * 测试用例名称 : ffrt_set_task_io_qos_succ
49  * 测试用例描述:设置任务的IO QoS成功
50  * 操作步骤    :1、设置qos为0
51  * 预期结果    :执行成功
52  */
53 HWTEST_F(ResourceMngrTest, ffrt_set_task_io_qos_succ, TestSize.Level1)
54 {
55     int ret = ffrt_set_task_io_qos(0, 0, 0, nullptr);
56     EXPECT_EQ(ret, 0);
57 }
58 
59 /*
60  * 测试用例名称 : ffrt_set_task_io_qos_fail
61  * 测试用例描述:设置任务的IO QoS失败
62  * 操作步骤    :1、设置qos为-1
63  * 预期结果    :执行失败
64  */
65 HWTEST_F(ResourceMngrTest, ffrt_set_task_io_qos_fail, TestSize.Level1)
66 {
67     int ret = ffrt_set_task_io_qos(0, 0, -1, nullptr);
68     EXPECT_EQ(ret, 1);
69 }