19762338dSopenharmony_ci/*
29762338dSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
39762338dSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
49762338dSopenharmony_ci * you may not use this file except in compliance with the License.
59762338dSopenharmony_ci * You may obtain a copy of the License at
69762338dSopenharmony_ci *
79762338dSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
89762338dSopenharmony_ci *
99762338dSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
109762338dSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
119762338dSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
129762338dSopenharmony_ci * See the License for the specific language governing permissions and
139762338dSopenharmony_ci * limitations under the License.
149762338dSopenharmony_ci */
159762338dSopenharmony_ci
169762338dSopenharmony_ci#include "hdf_log.h"
179762338dSopenharmony_ci#include "idevmgr_hdi.h"
189762338dSopenharmony_ci#include "v1_0/ipartition_slot.h"
199762338dSopenharmony_ci#include <gtest/gtest.h>
209762338dSopenharmony_ci#include <osal_mem.h>
219762338dSopenharmony_ci#include <unistd.h>
229762338dSopenharmony_ci
239762338dSopenharmony_ciusing namespace testing;
249762338dSopenharmony_ciusing namespace testing::ext;
259762338dSopenharmony_ciusing namespace OHOS::HDI::Partitionslot::V1_0;
269762338dSopenharmony_ciusing OHOS::HDI::DeviceManager::V1_0::IDeviceManager;
279762338dSopenharmony_ci
289762338dSopenharmony_ciclass StartupPartitionSlotTestAdditional : public testing::Test {
299762338dSopenharmony_cipublic:
309762338dSopenharmony_ci    static void SetUpTestCase()
319762338dSopenharmony_ci    {
329762338dSopenharmony_ci        auto devmgr = IDeviceManager::Get();
339762338dSopenharmony_ci        if (devmgr != nullptr) {
349762338dSopenharmony_ci            devmgr->LoadDevice("partition_slot_service");
359762338dSopenharmony_ci        } else {
369762338dSopenharmony_ci            std::cout << "Get devmgr failed" << std::endl;
379762338dSopenharmony_ci        }
389762338dSopenharmony_ci    }
399762338dSopenharmony_ci    static void TearDownTestCase()
409762338dSopenharmony_ci    {
419762338dSopenharmony_ci        auto devmgr = IDeviceManager::Get();
429762338dSopenharmony_ci        if (devmgr != nullptr) {
439762338dSopenharmony_ci            devmgr->UnloadDevice("partition_slot_service");
449762338dSopenharmony_ci        } else {
459762338dSopenharmony_ci            std::cout << "Get devmgr failed" << std::endl;
469762338dSopenharmony_ci        }
479762338dSopenharmony_ci    }
489762338dSopenharmony_ci    void SetUp() {}
499762338dSopenharmony_ci    void TearDown() {}
509762338dSopenharmony_ci};
519762338dSopenharmony_ci
529762338dSopenharmony_ci/**
539762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0100
549762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot001
559762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 1, currentSlo is 0
569762338dSopenharmony_ci */
579762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot001, Function | MediumTest | Level1)
589762338dSopenharmony_ci{
599762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
609762338dSopenharmony_ci    int numOfSlots = 1;
619762338dSopenharmony_ci    int currentSlot = 0;
629762338dSopenharmony_ci    for (int i = 0; i < 100; i++) {
639762338dSopenharmony_ci        sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
649762338dSopenharmony_ci        ASSERT_TRUE(partitionslot != nullptr);
659762338dSopenharmony_ci        ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
669762338dSopenharmony_ci    }
679762338dSopenharmony_ci}
689762338dSopenharmony_ci
699762338dSopenharmony_ci/**
709762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0200
719762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot002
729762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 0, currentSlo is 1
739762338dSopenharmony_ci */
749762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot002, Function | MediumTest | Level1)
759762338dSopenharmony_ci{
769762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
779762338dSopenharmony_ci    int numOfSlots = 0;
789762338dSopenharmony_ci    int currentSlot = 1;
799762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
809762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
819762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
829762338dSopenharmony_ci}
839762338dSopenharmony_ci
849762338dSopenharmony_ci/**
859762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0300
869762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot003
879762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 1, currentSlo is -1
889762338dSopenharmony_ci */
899762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot003, Function | MediumTest | Level1)
909762338dSopenharmony_ci{
919762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
929762338dSopenharmony_ci    int numOfSlots = 1;
939762338dSopenharmony_ci    int currentSlot = -1;
949762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
959762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
969762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
979762338dSopenharmony_ci}
989762338dSopenharmony_ci
999762338dSopenharmony_ci/**
1009762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0400
1019762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot004
1029762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 2, currentSlo is -1
1039762338dSopenharmony_ci */
1049762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot004, Function | MediumTest | Level1)
1059762338dSopenharmony_ci{
1069762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
1079762338dSopenharmony_ci    int numOfSlots = 2;
1089762338dSopenharmony_ci    int currentSlot = -1;
1099762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
1109762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
1119762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
1129762338dSopenharmony_ci}
1139762338dSopenharmony_ci
1149762338dSopenharmony_ci/**
1159762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0500
1169762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot005
1179762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 2, currentSlo is 1
1189762338dSopenharmony_ci */
1199762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot005, Function | MediumTest | Level1)
1209762338dSopenharmony_ci{
1219762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
1229762338dSopenharmony_ci    int numOfSlots = 2;
1239762338dSopenharmony_ci    int currentSlot = 1;
1249762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
1259762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
1269762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
1279762338dSopenharmony_ci}
1289762338dSopenharmony_ci
1299762338dSopenharmony_ci/**
1309762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0600
1319762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot006
1329762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 3, currentSlo is -1
1339762338dSopenharmony_ci */
1349762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot006, Function | MediumTest | Level1)
1359762338dSopenharmony_ci{
1369762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
1379762338dSopenharmony_ci    int numOfSlots = 3;
1389762338dSopenharmony_ci    int currentSlot = -1;
1399762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
1409762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
1419762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
1429762338dSopenharmony_ci}
1439762338dSopenharmony_ci
1449762338dSopenharmony_ci/**
1459762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0700
1469762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot007
1479762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 3, currentSlo is 1
1489762338dSopenharmony_ci */
1499762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot007, Function | MediumTest | Level1)
1509762338dSopenharmony_ci{
1519762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
1529762338dSopenharmony_ci    int numOfSlots = 3;
1539762338dSopenharmony_ci    int currentSlot = 1;
1549762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
1559762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
1569762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
1579762338dSopenharmony_ci}
1589762338dSopenharmony_ci
1599762338dSopenharmony_ci/**
1609762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0800
1619762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot008
1629762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 3, currentSlo is 2
1639762338dSopenharmony_ci */
1649762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot008, Function | MediumTest | Level1)
1659762338dSopenharmony_ci{
1669762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
1679762338dSopenharmony_ci    int numOfSlots = 3;
1689762338dSopenharmony_ci    int currentSlot = 2;
1699762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
1709762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
1719762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
1729762338dSopenharmony_ci}
1739762338dSopenharmony_ci
1749762338dSopenharmony_ci/**
1759762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0900
1769762338dSopenharmony_ci * @tc.name: testPartitionSlotGetCurrentSlot009
1779762338dSopenharmony_ci * @tc.desc: GetCurrentSlot, numOfSlots is 2, currentSlo is 3
1789762338dSopenharmony_ci */
1799762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot009, Function | MediumTest | Level1)
1809762338dSopenharmony_ci{
1819762338dSopenharmony_ci    std::cout << "begin get currentslot by service" << std::endl;
1829762338dSopenharmony_ci    int numOfSlots = 2;
1839762338dSopenharmony_ci    int currentSlot = 3;
1849762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
1859762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
1869762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
1879762338dSopenharmony_ci}
1889762338dSopenharmony_ci
1899762338dSopenharmony_ci/**
1909762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetSlotSuffix_0100
1919762338dSopenharmony_ci * @tc.name: testPartitionSlotGetSlotSuffix001
1929762338dSopenharmony_ci * @tc.desc: GetSlotSuffix, slot is 2147483647
1939762338dSopenharmony_ci */
1949762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetSlotSuffix001, Function | MediumTest | Level1)
1959762338dSopenharmony_ci{
1969762338dSopenharmony_ci    std::cout << "begin get suffix by service" << std::endl;
1979762338dSopenharmony_ci    std::string suffix = "";
1989762338dSopenharmony_ci    int slot = 2147483647;
1999762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2009762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
2019762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetSlotSuffix(slot, suffix) == 0);
2029762338dSopenharmony_ci}
2039762338dSopenharmony_ci
2049762338dSopenharmony_ci/**
2059762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetSlotSuffix_0200
2069762338dSopenharmony_ci * @tc.name: testPartitionSlotGetSlotSuffix002
2079762338dSopenharmony_ci * @tc.desc: GetSlotSuffix, slot is -2147483648
2089762338dSopenharmony_ci */
2099762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetSlotSuffix002, Function | MediumTest | Level1)
2109762338dSopenharmony_ci{
2119762338dSopenharmony_ci    std::cout << "begin get suffix by service" << std::endl;
2129762338dSopenharmony_ci    std::string suffix = "";
2139762338dSopenharmony_ci    int slot = -2147483648;
2149762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2159762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
2169762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->GetSlotSuffix(slot, suffix) == 0);
2179762338dSopenharmony_ci}
2189762338dSopenharmony_ci
2199762338dSopenharmony_ci/**
2209762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_GetSlotSuffix_0300
2219762338dSopenharmony_ci * @tc.name: testPartitionSlotGetSlotSuffix003
2229762338dSopenharmony_ci * @tc.desc: GetSlotSuffix, stability test
2239762338dSopenharmony_ci */
2249762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetSlotSuffix003, Function | MediumTest | Level1)
2259762338dSopenharmony_ci{
2269762338dSopenharmony_ci    std::cout << "begin get suffix by service" << std::endl;
2279762338dSopenharmony_ci    std::string suffix = "";
2289762338dSopenharmony_ci    int slot = 2;
2299762338dSopenharmony_ci    for (int i = 0; i < 100; i++) {
2309762338dSopenharmony_ci        sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2319762338dSopenharmony_ci        ASSERT_TRUE(partitionslot != nullptr);
2329762338dSopenharmony_ci        ASSERT_TRUE(partitionslot->GetSlotSuffix(slot, suffix) == 0);
2339762338dSopenharmony_ci    }
2349762338dSopenharmony_ci}
2359762338dSopenharmony_ci
2369762338dSopenharmony_ci/**
2379762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_SetActiveSlot_0100
2389762338dSopenharmony_ci * @tc.name: testPartitionSlotSetActiveSlot001
2399762338dSopenharmony_ci * @tc.desc: SetActiveSlot, slot is 2147483647
2409762338dSopenharmony_ci */
2419762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetActiveSlot001, Function | MediumTest | Level1)
2429762338dSopenharmony_ci{
2439762338dSopenharmony_ci    std::cout << "begin set active slot by service" << std::endl;
2449762338dSopenharmony_ci    int numOfSlots = 2;
2459762338dSopenharmony_ci    int currentSlot = 0;
2469762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2479762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
2489762338dSopenharmony_ci    partitionslot->GetCurrentSlot(currentSlot, numOfSlots);
2499762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->SetActiveSlot(2147483647) == 0);
2509762338dSopenharmony_ci    partitionslot->SetActiveSlot(currentSlot);
2519762338dSopenharmony_ci}
2529762338dSopenharmony_ci
2539762338dSopenharmony_ci/**
2549762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_SetActiveSlot_0200
2559762338dSopenharmony_ci * @tc.name: testPartitionSlotSetActiveSlot002
2569762338dSopenharmony_ci * @tc.desc: SetActiveSlot, slot is -2147483648
2579762338dSopenharmony_ci */
2589762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetActiveSlot002, Function | MediumTest | Level1)
2599762338dSopenharmony_ci{
2609762338dSopenharmony_ci    std::cout << "begin set active slot by service" << std::endl;
2619762338dSopenharmony_ci    int numOfSlots = 2;
2629762338dSopenharmony_ci    int currentSlot = 0;
2639762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2649762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
2659762338dSopenharmony_ci    partitionslot->GetCurrentSlot(currentSlot, numOfSlots);
2669762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->SetActiveSlot(-2147483648) != 0);
2679762338dSopenharmony_ci    partitionslot->SetActiveSlot(currentSlot);
2689762338dSopenharmony_ci}
2699762338dSopenharmony_ci
2709762338dSopenharmony_ci/**
2719762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_SetActiveSlot_0300
2729762338dSopenharmony_ci * @tc.name: testPartitionSlotSetActiveSlot003
2739762338dSopenharmony_ci * @tc.desc: SetActiveSlot, stability test
2749762338dSopenharmony_ci */
2759762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetActiveSlot003, Function | MediumTest | Level1)
2769762338dSopenharmony_ci{
2779762338dSopenharmony_ci    int numOfSlots = 2;
2789762338dSopenharmony_ci    int currentSlot = 0;
2799762338dSopenharmony_ci    for (int i = 0; i < 100; i++) {
2809762338dSopenharmony_ci        std::cout << "begin set active slot by service" << std::endl;
2819762338dSopenharmony_ci        sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2829762338dSopenharmony_ci        ASSERT_TRUE(partitionslot != nullptr);
2839762338dSopenharmony_ci        partitionslot->GetCurrentSlot(currentSlot, numOfSlots);
2849762338dSopenharmony_ci        ASSERT_TRUE(partitionslot->SetActiveSlot(2) == 0);
2859762338dSopenharmony_ci        partitionslot->SetActiveSlot(currentSlot);
2869762338dSopenharmony_ci    }
2879762338dSopenharmony_ci}
2889762338dSopenharmony_ci
2899762338dSopenharmony_ci/**
2909762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_SetSlotUnbootable_0100
2919762338dSopenharmony_ci * @tc.name: testPartitionSlotSetSlotUnbootable001
2929762338dSopenharmony_ci * @tc.desc: SetSlotUnbootable, slot is 2147483647
2939762338dSopenharmony_ci */
2949762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetSlotUnbootable001, Function | MediumTest | Level1)
2959762338dSopenharmony_ci{
2969762338dSopenharmony_ci    std::cout << "begin set unbootable slot by service" << std::endl;
2979762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
2989762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
2999762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->SetSlotUnbootable(2147483647) == 0);
3009762338dSopenharmony_ci}
3019762338dSopenharmony_ci
3029762338dSopenharmony_ci/**
3039762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_SetSlotUnbootable_0200
3049762338dSopenharmony_ci * @tc.name: testPartitionSlotSetSlotUnbootable002
3059762338dSopenharmony_ci * @tc.desc: SetSlotUnbootable, slot is -2147483648
3069762338dSopenharmony_ci */
3079762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetSlotUnbootable002, Function | MediumTest | Level1)
3089762338dSopenharmony_ci{
3099762338dSopenharmony_ci    std::cout << "begin set unbootable slot by service" << std::endl;
3109762338dSopenharmony_ci    sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
3119762338dSopenharmony_ci    ASSERT_TRUE(partitionslot != nullptr);
3129762338dSopenharmony_ci    ASSERT_TRUE(partitionslot->SetSlotUnbootable(-2147483648) != 0);
3139762338dSopenharmony_ci}
3149762338dSopenharmony_ci
3159762338dSopenharmony_ci/**
3169762338dSopenharmony_ci * @tc.number: SUB_Startup_PartitionSlot_SetSlotUnbootable_0300
3179762338dSopenharmony_ci * @tc.name: testPartitionSlotSetSlotUnbootable003
3189762338dSopenharmony_ci * @tc.desc: SetSlotUnbootable, stability test
3199762338dSopenharmony_ci */
3209762338dSopenharmony_ciHWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetSlotUnbootable003, Function | MediumTest | Level1)
3219762338dSopenharmony_ci{
3229762338dSopenharmony_ci    for (int i = 0; i < 100; i++) {
3239762338dSopenharmony_ci        std::cout << "begin set unbootable slot by service" << std::endl;
3249762338dSopenharmony_ci        sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
3259762338dSopenharmony_ci        ASSERT_TRUE(partitionslot != nullptr);
3269762338dSopenharmony_ci        ASSERT_TRUE(partitionslot->SetSlotUnbootable(2) == 0);
3279762338dSopenharmony_ci    }
3289762338dSopenharmony_ci}