LCOV - code coverage report
Current view: top level - basic_component/package_manager/inc - aicpu_thread_package_worker.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 11 11
Test Date: 2026-07-28 10:52:48 Functions: 66.7 % 6 4

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #ifndef TSD_AICPU_THREAD_PACKAGE_WORKER_H
      12              : #define TSD_AICPU_THREAD_PACKAGE_WORKER_H
      13              : 
      14              : #include "base_package_worker.h"
      15              : 
      16              : namespace tsd {
      17              : const std::string VERIFY_FILE_NAME = "aicpu_package_install.info";
      18              : const std::string EXTEND_VERIFY_FILE_NAME = "extend_aicpu_package_install.info";
      19              : 
      20              : class AicpuThreadPackageWorker : public BasePackageWorker {
      21              : public:
      22           20 :     explicit AicpuThreadPackageWorker(const PackageWorkerParas paras)
      23          120 :         : BasePackageWorker(paras), verifyFileName_(""), verifyFilePath_(""), soInstallRootPath_(""), fd_(-1)
      24              :     {
      25           20 :         TSD_RUN_INFO("Start init %s. %s", __func__, paras.DebugString().c_str());
      26           20 :         verifyFileName_ = VERIFY_FILE_NAME;
      27           20 :     };
      28           20 :     virtual ~AicpuThreadPackageWorker() override = default;
      29              : 
      30              :     TSD_StatusT LoadPackage(const std::string& packagePath, const std::string& packageName) override;
      31              :     TSD_StatusT UnloadPackage() override;
      32              : 
      33              : private:
      34              :     void PreProcessPackage(const std::string& packagePath, const std::string& packageName) override;
      35              :     void SetDecompressPackagePath() override;
      36              :     TSD_StatusT OpenVerifyFile();
      37              :     bool IsNeedLoadPackage() override;
      38              :     TSD_StatusT GetSavedCheckCodeShared(uint64_t& savedCheckCode) const;
      39              :     TSD_StatusT GetSavedCheckCodeUnshared(uint64_t& savedCheckCode) const;
      40              :     TSD_StatusT ReadCheckCode(uint64_t& savedCheckCode) const;
      41              :     std::string GetMovePackageToDecompressDirCmd() const override;
      42              :     std::string GetDecompressPackageCmd() const override;
      43              :     TSD_StatusT PostProcessPackage() override;
      44              :     TSD_StatusT ResetExtendVerifyFile() const;
      45              : 
      46              : protected:
      47              :     TSD_StatusT WriteCheckCode(const int32_t fd, const uint64_t checkCode) const;
      48              : 
      49              :     std::string verifyFileName_;
      50              :     std::string verifyFilePath_;
      51              :     std::string soInstallRootPath_;
      52              :     int32_t fd_;
      53              : };
      54              : 
      55              : class ExtendThreadPackageWorker final : public AicpuThreadPackageWorker {
      56              : public:
      57            3 :     explicit ExtendThreadPackageWorker(const PackageWorkerParas paras) : AicpuThreadPackageWorker(paras)
      58              :     {
      59            3 :         TSD_RUN_INFO("Start init %s. %s", __func__, paras.DebugString().c_str());
      60            3 :         verifyFileName_ = EXTEND_VERIFY_FILE_NAME;
      61            3 :     };
      62            3 :     ~ExtendThreadPackageWorker() override = default;
      63              : 
      64              : private:
      65              :     TSD_StatusT PostProcessPackage() override;
      66              : };
      67              : } // namespace tsd
      68              : 
      69              : #endif // TSD_AICPU_THREAD_PACKAGE_WORKER_H
        

Generated by: LCOV version 2.0-1