1/* 2 * Copyright (c) 2024 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 <unistd.h> 19#include <sys/wait.h> 20#include <csignal> 21#include <cerrno> 22#include <cstring> 23#include <sys/prctl.h> 24#include <sys/types.h> 25#include <sys/stat.h> 26#include <fcntl.h> 27#include <sys/syscall.h> 28#include <asm/unistd.h> 29#include <syscall.h> 30#include <climits> 31#include <sched.h> 32 33using namespace std; 34using namespace testing::ext; 35 36namespace init_ut { 37class TokenUnitTest : public testing::Test { 38public: 39 static void SetUpTestCase(void) {}; 40 static void TearDownTestCase(void) {}; 41 void SetUp(void) {}; 42 void TearDown(void) {}; 43}; 44 45HWTEST_F(TokenUnitTest, Init_HalReadToken_001, TestSize.Level0) 46{ 47 char *token; 48 unsigned int len; 49 int ret = HalReadToken(token, len); 50 EXPECT_EQ(ret, 0); 51} 52 53HWTEST_F(TokenUnitTest, Init_HalWriteToken_001, TestSize.Level0) 54{ 55 const char *token; 56 unsigned int len; 57 int ret = HalWriteToken(token, len); 58 EXPECT_EQ(ret, 0); 59} 60 61HWTEST_F(TokenUnitTest, Init_HalGetAcKey_001, TestSize.Level0) 62{ 63 char *acKey; 64 unsigned int len; 65 int ret = HalGetAcKey(acKey, len); 66 EXPECT_EQ(ret, 0); 67} 68 69HWTEST_F(TokenUnitTest, Init_HalGetProdId_001, TestSize.Level0) 70{ 71 char *productId; 72 unsigned int len; 73 int ret = HalGetProdId(productId, len); 74 EXPECT_EQ(ret, 0); 75} 76 77HWTEST_F(TokenUnitTest, Init_FsHvbGetValueFromCmdLine_001, TestSize.Level0) 78{ 79 char *productKey; 80 unsigned int len; 81 int ret = HalGetProdKey(productKey, len); 82 EXPECT_EQ(ret, 0); 83} 84} 85