mirror of
https://gitee.com/openharmony/xts_hats
synced 2025-02-21 10:53:42 +00:00
!887 Add hdi test suites --RM.012
Merge pull request !887 from wangchao/RM.012
This commit is contained in:
commit
f2502f84fc
@ -14,20 +14,30 @@
|
||||
import("//build/ohos_var.gni")
|
||||
import("//build/test.gni")
|
||||
import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni")
|
||||
import("//test/xts/hats/build.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
group("HatsHdfUsbTest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
"autoFunctionTest:HatsHdfUsbAutoFunctionTest",
|
||||
# "deviceTest:HatsHdfUsbDeviceTest",
|
||||
# "functionTest:HatsHdfUsbFunctionTest",
|
||||
# "requestTest:HatsHdfUsbRequestTest",
|
||||
# "transferTest:HatsHdfUsbTransferTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkDeviceTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkFunctionTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkRequestTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkTransferTest",
|
||||
# "mtpTest:HatsHdfUsbFnMtpTest",
|
||||
]
|
||||
if (hats_rich == false) {
|
||||
deps = [
|
||||
"autoFunctionTest:HatsHdfUsbAutoFunctionTest",
|
||||
|
||||
# "deviceTest:HatsHdfUsbDeviceTest",
|
||||
# "functionTest:HatsHdfUsbFunctionTest",
|
||||
# "mtpTest:HatsHdfUsbFnMtpTest",
|
||||
# "requestTest:HatsHdfUsbRequestTest",
|
||||
"requestTest_additional:HatsHdfUsbRequestAdditionalTest",
|
||||
|
||||
# "transferTest:HatsHdfUsbTransferTest",
|
||||
"transferTest_additional:HatsHdfUsbTransferAdditionalTest",
|
||||
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkDeviceTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkFunctionTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkRequestTest",
|
||||
# "usbdBenchmarkTest:HatsHdfUsbBenchmarkTransferTest",
|
||||
]
|
||||
} else {
|
||||
deps = [ "autoFunctionTest:HatsHdfUsbAutoFunctionTest" ]
|
||||
}
|
||||
}
|
||||
|
54
hdf/usb/requestTest_additional/BUILD.gn
Normal file
54
hdf/usb/requestTest_additional/BUILD.gn
Normal file
@ -0,0 +1,54 @@
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "hdf/usb"
|
||||
|
||||
ohos_moduletest_suite("HatsHdfUsbRequestAdditionalTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"../UsbSubscriberTest/UsbSubscriberTest.cpp",
|
||||
"./common/usbd_interface_test.cpp",
|
||||
"./common/usbd_request_test.cpp",
|
||||
]
|
||||
configs = [ ":hdf_usb_additional" ]
|
||||
|
||||
deps = [ "//third_party/googletest:gtest_main" ]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"drivers_interface_usb:libusb_proxy_1.0",
|
||||
"eventhandler:libeventhandler",
|
||||
"hdf_core:libhdf_host",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_single",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
subsystem_name = "xts"
|
||||
part_name = "hats"
|
||||
}
|
||||
|
||||
config("hdf_usb_additional") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"../UsbSubscriberTest",
|
||||
]
|
||||
}
|
18
hdf/usb/requestTest_additional/Test.json
Normal file
18
hdf/usb/requestTest_additional/Test.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsHdfUsbRequestAdditionalTest->/data/local/tmp/HatsHdfUsbRequestAdditionalTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
],
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsHdfUsbRequestAdditionalTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsHdfUsbRequestAdditionalTest Tests"
|
||||
}
|
1124
hdf/usb/requestTest_additional/common/usbd_interface_test.cpp
Normal file
1124
hdf/usb/requestTest_additional/common/usbd_interface_test.cpp
Normal file
File diff suppressed because it is too large
Load Diff
1944
hdf/usb/requestTest_additional/common/usbd_request_test.cpp
Normal file
1944
hdf/usb/requestTest_additional/common/usbd_request_test.cpp
Normal file
File diff suppressed because it is too large
Load Diff
61
hdf/usb/requestTest_additional/include/usbd_request_test.h
Normal file
61
hdf/usb/requestTest_additional/include/usbd_request_test.h
Normal file
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef USBD_REQUEST_TEST_H
|
||||
#define USBD_REQUEST_TEST_H
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "UsbSubscriberTest.h"
|
||||
#include "v1_0/iusbd_subscriber.h"
|
||||
#include "v1_0/usb_types.h"
|
||||
#include "v1_0/iusbd_bulk_callback.h"
|
||||
|
||||
using OHOS::HDI::Usb::V1_0::UsbDev;
|
||||
|
||||
/**
|
||||
* Used to signify direction of data for USBEndpoint is IN, device to host
|
||||
*/
|
||||
const int32_t USB_ENDPOINT_DIR_IN = 0x80;
|
||||
|
||||
/**
|
||||
* Used to signify direction of data for USBEndpoint is OUT, host to device
|
||||
*/
|
||||
const int32_t USB_ENDPOINT_DIR_OUT = 0;
|
||||
|
||||
namespace {
|
||||
class UsbdRequestTestAdditional : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
static UsbDev dev_;
|
||||
static OHOS::sptr<OHOS::USB::UsbSubscriberTest> subscriber_;
|
||||
};
|
||||
class UsbdBulkCallbackTest : public OHOS::HDI::Usb::V1_0::IUsbdBulkCallback {
|
||||
public:
|
||||
UsbdBulkCallbackTest() = default;
|
||||
~UsbdBulkCallbackTest() = default;
|
||||
int32_t OnBulkWriteCallback(int32_t status, int32_t actLength) override
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
int32_t OnBulkReadCallback(int32_t status, int32_t actLength) override
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
#endif // USBD_REQUEST_TEST_H
|
53
hdf/usb/transferTest_additional/BUILD.gn
Normal file
53
hdf/usb/transferTest_additional/BUILD.gn
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/ohos_var.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
module_output_path = "hdf/usb"
|
||||
|
||||
ohos_moduletest_suite("HatsHdfUsbTransferAdditionalTest") {
|
||||
module_out_path = module_output_path
|
||||
sources = [
|
||||
"../UsbSubscriberTest/UsbSubscriberTest.cpp",
|
||||
"./common/usbd_transfer_test.cpp",
|
||||
]
|
||||
configs = [ ":hdf_usb_additional" ]
|
||||
|
||||
deps = [ "//third_party/googletest:gtest_main" ]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"drivers_interface_usb:libusb_proxy_1.0",
|
||||
"eventhandler:libeventhandler",
|
||||
"hdf_core:libhdf_host",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_single",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
]
|
||||
|
||||
subsystem_name = "xts"
|
||||
part_name = "hats"
|
||||
}
|
||||
|
||||
config("hdf_usb_additional") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"../UsbSubscriberTest",
|
||||
]
|
||||
}
|
18
hdf/usb/transferTest_additional/Test.json
Normal file
18
hdf/usb/transferTest_additional/Test.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsHdfUsbTransferAdditionalTest->/data/local/tmp/HatsHdfUsbTransferAdditionalTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
],
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsHdfUsbTransferAdditionalTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsHdfUsbTransferAdditionalTest Tests"
|
||||
}
|
1178
hdf/usb/transferTest_additional/common/usbd_transfer_test.cpp
Normal file
1178
hdf/usb/transferTest_additional/common/usbd_transfer_test.cpp
Normal file
File diff suppressed because it is too large
Load Diff
65
hdf/usb/transferTest_additional/include/usbd_transfer_test.h
Normal file
65
hdf/usb/transferTest_additional/include/usbd_transfer_test.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef USBD_TRANSFER_TEST_H
|
||||
#define USBD_TRANSFER_TEST_H
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "UsbSubscriberTest.h"
|
||||
#include "v1_0/iusbd_subscriber.h"
|
||||
#include "v1_0/usb_types.h"
|
||||
#include "v1_0/iusbd_bulk_callback.h"
|
||||
|
||||
using OHOS::HDI::Usb::V1_0::UsbDev;
|
||||
|
||||
#define USB_DDK_REQ_GET_DESCRIPTOR 0x06
|
||||
#define USB_DDK_REQ_GET_CONFIGURATION 0x08
|
||||
#define USB_DDK_REQ_GET_INTERFACE 0x0A
|
||||
#define USB_DDK_REQ_SYNCH_FRAME 0x0C
|
||||
const int32_t USB_ENDPOINT_DIR_IN = 0x80;
|
||||
const int32_t USB_ENDPOINT_DIR_OUT = 0;
|
||||
|
||||
typedef enum {
|
||||
USB_REQUEST_TARGET_DEVICE,
|
||||
USB_REQUEST_TARGET_INTERFACE,
|
||||
USB_REQUEST_TARGET_ENDPOINT,
|
||||
USB_REQUEST_TARGET_OTHER,
|
||||
} UsbRequestTargetType;
|
||||
|
||||
namespace {
|
||||
class UsbdTransferTestAdditional : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
static UsbDev dev_;
|
||||
static OHOS::sptr<OHOS::USB::UsbSubscriberTest> subscriber_;
|
||||
};
|
||||
class UsbdBulkCallbackTest : public OHOS::HDI::Usb::V1_0::IUsbdBulkCallback {
|
||||
public:
|
||||
UsbdBulkCallbackTest() = default;
|
||||
~UsbdBulkCallbackTest() = default;
|
||||
int32_t OnBulkWriteCallback(int32_t status, int32_t actLength) override
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
int32_t OnBulkReadCallback(int32_t status, int32_t actLength) override
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
#endif // USBD_TRANSFER_TEST_H
|
@ -20,6 +20,9 @@ group("startup") {
|
||||
#"partitionslot:HatsStartupPartitionSlotTest"
|
||||
]
|
||||
} else {
|
||||
deps = [ "partitionslot:HatsStartupPartitionSlotTest" ]
|
||||
deps = [
|
||||
"partitionslot:HatsStartupPartitionSlotTest",
|
||||
"partitionslot_additional:HatsStartupPartitionSlotAdditionalTest",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
45
startup/partitionslot_additional/BUILD.gn
Normal file
45
startup/partitionslot_additional/BUILD.gn
Normal file
@ -0,0 +1,45 @@
|
||||
# Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import("//build/config/features.gni")
|
||||
import("//build/ohos_var.gni")
|
||||
import("//build/test.gni")
|
||||
import("//test/xts/tools/build/suite.gni")
|
||||
|
||||
ohos_moduletest_suite("HatsStartupPartitionSlotAdditionalTest") {
|
||||
module_out_path = "startup/partitionslot"
|
||||
cflags = [
|
||||
"-g",
|
||||
"-O0",
|
||||
"-Wno-unused-variable",
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
include_dirs = [
|
||||
"./include",
|
||||
"//third_party/googletest/googletest/include/gtest",
|
||||
]
|
||||
|
||||
sources = [ "./src/partitionslot_test.cpp" ]
|
||||
|
||||
deps = [ "//third_party/googletest:gtest_main" ]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"drivers_interface_partitionslot:libpartitionslot_proxy_1.0",
|
||||
"hdf_core:libhdf_host",
|
||||
"hdf_core:libhdf_ipc_adapter",
|
||||
"hdf_core:libhdf_utils",
|
||||
"hdf_core:libhdi",
|
||||
"hilog:libhilog",
|
||||
]
|
||||
}
|
18
startup/partitionslot_additional/Test.json
Normal file
18
startup/partitionslot_additional/Test.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"kits": [
|
||||
{
|
||||
"push": [
|
||||
"HatsStartupPartitionSlotAdditionalTest->/data/local/tmp/HatsStartupPartitionSlotAdditionalTest"
|
||||
],
|
||||
"type": "PushKit"
|
||||
}
|
||||
],
|
||||
"driver": {
|
||||
"native-test-timeout": "120000",
|
||||
"type": "CppTest",
|
||||
"module-name": "HatsStartupPartitionSlotAdditionalTest",
|
||||
"runtime-hint": "1s",
|
||||
"native-test-device-path": "/data/local/tmp"
|
||||
},
|
||||
"description": "Configuration for HatsStartupPartitionSlotAdditionalTest Tests"
|
||||
}
|
260
startup/partitionslot_additional/src/partitionslot_test.cpp
Normal file
260
startup/partitionslot_additional/src/partitionslot_test.cpp
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "hdf_log.h"
|
||||
#include "idevmgr_hdi.h"
|
||||
#include "v1_0/ipartition_slot.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <osal_mem.h>
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::HDI::Partitionslot::V1_0;
|
||||
using OHOS::HDI::DeviceManager::V1_0::IDeviceManager;
|
||||
|
||||
class StartupPartitionSlotTestAdditional : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase()
|
||||
{
|
||||
auto devmgr = IDeviceManager::Get();
|
||||
if (devmgr != nullptr) {
|
||||
devmgr->LoadDevice("partition_slot_service");
|
||||
} else {
|
||||
std::cout << "Get devmgr failed" << std::endl;
|
||||
}
|
||||
}
|
||||
static void TearDownTestCase()
|
||||
{
|
||||
auto devmgr = IDeviceManager::Get();
|
||||
if (devmgr != nullptr) {
|
||||
devmgr->UnloadDevice("partition_slot_service");
|
||||
} else {
|
||||
std::cout << "Get devmgr failed" << std::endl;
|
||||
}
|
||||
}
|
||||
void SetUp() {}
|
||||
void TearDown() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0100
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot001
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 1, currentSlo is 0
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot001, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 1;
|
||||
int currentSlot = 0;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0200
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot002
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 0, currentSlo is 1
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot002, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 0;
|
||||
int currentSlot = 1;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0300
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot003
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 1, currentSlo is -1
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot003, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 1;
|
||||
int currentSlot = -1;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0400
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot004
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 2, currentSlo is -1
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot004, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 2;
|
||||
int currentSlot = -1;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0500
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot005
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 2, currentSlo is 1
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot005, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 2;
|
||||
int currentSlot = 1;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0600
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot006
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 3, currentSlo is -1
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot006, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 3;
|
||||
int currentSlot = -1;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0700
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot007
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 3, currentSlo is 1
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot007, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 3;
|
||||
int currentSlot = 1;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0800
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot008
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 3, currentSlo is 2
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot008, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 3;
|
||||
int currentSlot = 2;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetCurrentSlot_0900
|
||||
* @tc.name: testPartitionSlotGetCurrentSlot009
|
||||
* @tc.desc: GetCurrentSlot, numOfSlots is 2, currentSlo is 3
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetCurrentSlot009, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get currentslot by service" << std::endl;
|
||||
int numOfSlots = 2;
|
||||
int currentSlot = 3;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetCurrentSlot(currentSlot, numOfSlots) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetSlotSuffix_0100
|
||||
* @tc.name: testPartitionSlotGetSlotSuffix001
|
||||
* @tc.desc: GetSlotSuffix, slot is 2147483647
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetSlotSuffix001, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get suffix by service" << std::endl;
|
||||
std::string suffix = "";
|
||||
int slot = 2147483647;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetSlotSuffix(slot, suffix) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetSlotSuffix_0200
|
||||
* @tc.name: testPartitionSlotGetSlotSuffix002
|
||||
* @tc.desc: GetSlotSuffix, slot is -2147483648
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetSlotSuffix002, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get suffix by service" << std::endl;
|
||||
std::string suffix = "";
|
||||
int slot = -2147483648;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetSlotSuffix(slot, suffix) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_GetSlotSuffix_0300
|
||||
* @tc.name: testPartitionSlotGetSlotSuffix003
|
||||
* @tc.desc: GetSlotSuffix, stability test
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotGetSlotSuffix003, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin get suffix by service" << std::endl;
|
||||
std::string suffix = "";
|
||||
int slot = 2;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->GetSlotSuffix(slot, suffix) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_SetActiveSlot_0200
|
||||
* @tc.name: testPartitionSlotSetActiveSlot002
|
||||
* @tc.desc: SetActiveSlot, slot is -2147483648
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetActiveSlot002, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin set active slot by service" << std::endl;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->SetActiveSlot(-2147483648) != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: SUB_Startup_PartitionSlot_SetSlotUnbootable_0200
|
||||
* @tc.name: testPartitionSlotSetSlotUnbootable002
|
||||
* @tc.desc: SetSlotUnbootable, slot is -2147483648
|
||||
*/
|
||||
HWTEST_F(StartupPartitionSlotTestAdditional, testPartitionSlotSetSlotUnbootable002, Function | MediumTest | Level1)
|
||||
{
|
||||
std::cout << "begin set unbootable slot by service" << std::endl;
|
||||
sptr<IPartitionSlot> partitionslot = IPartitionSlot::Get();
|
||||
ASSERT_TRUE(partitionslot != nullptr);
|
||||
ASSERT_TRUE(partitionslot->SetSlotUnbootable(-2147483648) != 0);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user