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 <cstdlib> 18 #include "ffrt_inner.h" 19 #include "../common.h" 20 21 using namespace testing; 22 #ifdef HWTEST_TESTING_EXT_ENABLE 23 using namespace testing::ext; 24 #endif 25 26 class InitTest : public testing::Test { 27 protected: SetUpTestCase()28 static void SetUpTestCase() 29 { 30 } 31 TearDownTestCase()32 static void TearDownTestCase() 33 { 34 } 35 SetUp()36 void SetUp() override 37 { 38 } 39 TearDown()40 void TearDown() override 41 { 42 } 43 }; 44 45 class Env { 46 public: Env()47 Env() 48 { 49 char envVar[] = "FFRT_PATH_HARDWARE=1"; 50 putenv(envVar); 51 } ~Env()52 ~Env() 53 { 54 char envVar[] = "FFRT_PATH_HARDWARE=0"; 55 putenv(envVar); 56 } 57 }; 58 59 Env g_env __attribute__ ((init_priority(102))); 60