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 20extern "C" int ffrt_set_task_io_qos(int service, uint64_t id, int qos, void* payload); 21 22using namespace std; 23using namespace testing; 24#ifdef HWTEST_TESTING_EXT_ENABLE 25using namespace testing::ext; 26#endif 27 28class ResourceMngrTest : public testing::Test { 29protected: 30 static void SetUpTestCase() 31 { 32 } 33 34 static void TearDownTestCase() 35 { 36 } 37 38 virtual void SetUp() 39 { 40 } 41 42 virtual void TearDown() 43 { 44 } 45}; 46 47/* 48 * 测试用例名称 : ffrt_set_task_io_qos_succ 49 * 测试用例描述:设置任务的IO QoS成功 50 * 操作步骤 :1、设置qos为0 51 * 预期结果 :执行成功 52 */ 53HWTEST_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 */ 65HWTEST_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}