已合并
hats用例整改 #1474
qiang_l_2421创建于 2025年2月17日
hats用例整改 #1474
已合并
qiang_l_2421创建于 2025年2月17日
refs/pull/1474/head合入到master
12 个文件变更+753-465
Mhdf/usb/accessoryTest/BUILD.gn+1-1
@@ -315,7 +315,7 @@ HWTEST_F(UsbdRequestTestAdditional, testHdiUsbRequestTestRequestCancel002, TestS
315 pipe.intfId = 255;315 pipe.intfId = 255;
316 pipe.endpointId = 1;316 pipe.endpointId = 1;
317 ret = g_usbInterface->RequestCancel(dev, pipe);317 ret = g_usbInterface->RequestCancel(dev, pipe);
318- ASSERT_EQ(0, ret);318+ ASSERT_NE(0, ret);
319 pipe = {interfaceId, pointId};319 pipe = {interfaceId, pointId};
320 320
Mhdf/usb/deviceStatusTest/BUILD.gn+1-1
@@ -45,6 +45,35 @@ ohos_moduletest_suite("HatsHdfUsbTransferTest") {
45 part_name = "drivers_peripheral_usb"45 part_name = "drivers_peripheral_usb"
46}46}
47 47 
48+ohos_moduletest_suite("HatsHdfUsbTransferTestInterrupt") {
49+ module_out_path = module_output_path
50+ s
Mhdf/usb/deviceTest/BUILD.gn+1-1
Mhdf/usb/requestTest/common/usbd_request_test.cpp+1-1
Mhdf/usb/requestTest_additional/common/usbd_request_test_additional.cpp+1-1
@@ -1444,326 +1444,6 @@ HWTEST_F(UsbdTransferTest, SUB_USB_HostManager_HDI_TranCompatibility_3100, Funct
1444 ASSERT_EQ(0, ret);1444 ASSERT_EQ(0, ret);
1445}1445}
1446 1446 
1447-/**
1448- * @tc.name: SUB_USB_HostManager_HDI_TranFunc_0400
1449- * @tc.desc: Test functions to InterruptTransferRead(const UsbDev &dev, const UsbPipe &pipe, int32_t timeout,
1450- * std::vector<uint8_t> &dat
Mhdf/usb/transferTest/BUILD.gn+29-0
Mhdf/usb/transferTest/common/usbd_transfer_test.cpp+0-320
@@ -0,0 +1,458 @@
1+/*
2+ * Copyright (c) 2025 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+#include <iostream>
16+#include <vector>
17+ 
18+#include "hdf_log.h"
19+#include "securec.h"
20+#include "usbd_transfer_test.h"
21+#include "v1_2/iusb_interface.h"
22+#include "v1_2/usb_types.h"
23+ 
24+const int SLEEP_TIME = 3;
25+const uint8_t BUS_NUM_INVALID = 255;
26+const uint8_t DEV_ADDR_INVALID = 255;
27+const uint32_t MAX_BUFFER_LENGTH = 255;
28+const uint8_t INTERFACEID_OK = 1;
29+const uint8_t INTERFACEID_EFFECTIVE = 0;
30+const uint8_t PIPE_ENDPOINTID_INVALID = 244;
31+const uint8_t PIPE_INTERFACEID_INVALID = 244;
32+const uint8_t POINTID_INTERRUPT_IN = 129;
33+// data interface have 2 point : 1->bulk_out 2->bulk_in
34+const uint8_t POINTID_BULK_IN = USB_ENDPOINT_DIR_
Ahdf/usb/transferTest/common/usbd_transfer_test_interrupt.cpp+458-0
@@ -74,6 +74,35 @@ ohos_moduletest_suite("HatsHdfUsbTransferAdditionalAddTest") {
74 part_name = "drivers_peripheral_usb"74 part_name = "drivers_peripheral_usb"
75}75}
76 76 
77+ohos_moduletest_suite("HatsHdfUsbTransferAddInterruptTest") {
78+ module_out_path = module_output_path
79+ sources = [
80+ "../UsbSubscriberTest/UsbSubscriberTest.cpp",
81+ "./common/usbd_transfer_test_additional_interrupt.cpp",
82+ ]
83+ configs = [ ":hdf_usb_additional" ]
84+ 
85+ deps = [ "//third_party/googletest:gtest_main" ]
86+ 
87+ external_deps = [
88+ "ability_base:want",
89+ "bundle_framework:appexecfwk_base",
90+ "c_utils:utils",
91+ "common_event_service:cesfwk_innerkits",
92+ "drivers_interface_usb:libusb_proxy_1.2",
93+ "eventhandler:libeventhandler",
94+ "hdf_core:libhdf_host",
95+ "hdf_core:libhdf_utils",
96+ "hilog:libhilog",
97+ "ipc:ipc_single",
98+ "safwk:system_ability_fwk",
99+ "samgr:samgr_proxy",
100+ ]
101+ 
102+ subsystem_name = "hdf"
103+ part_name = "drivers_peripheral_usb"
104+}
105+ 
77config("hdf_usb_additional") {106config("hdf_usb_additional") {
78 include_dirs = [107 include_dirs = [
79 "include",108 "include",
@@ -84,6 +113,7 @@ config("hdf_usb_additional") {
84group("transferAdditional_test") {113group("transferAdditional_test") {
85 testonly = true114 testonly = true
86 deps = [115 deps = [
116+ ":HatsHdfUsbTransferAddInterruptTest",
87 ":HatsHdfUsbTransferAdditionalAddTest",117 ":HatsHdfUsbTransferAdditionalAddTest",
88 ":HatsHdfUsbTransferAdditionalTest",118 ":HatsHdfUsbTransferAdditionalTest",
89 ]119 ]
@@ -269,144 +269,6 @@ HWTEST_
Mhdf/usb/transferTest_additional/BUILD.gn+30-0
Mhdf/usb/transferTest_additional/common/usbd_transfer_test_additional.cpp+0-138
@@ -0,0 +1,229 @@
1+/*
2+ * Copyright (c) 2025 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+#include <iostream>
16+#include <vector>
17+ 
18+#include "hdf_log.h"
19+#include "securec.h"
20+#include "usbd_transfer_test.h"
21+#include "v1_0/iusb_interface.h"
22+#include "v1_0/usb_types.h"
23+ 
24+const int SLEEP_TIME = 3;
25+const uint32_t MAX_BUFFER_LENGTH = 255;
26+const uint8_t INTERFACEID_OK = 0;
27+const uint8_t POINTID_BULK_OUT = 0;
28+const uint8_t POINTID_INTERRUPT_IN = 129;
29+const int32_t TRANSFER_TIME_OUT = 1000;
30+ 
31+using namespace testing::ext;
32+using namespace OHOS;
33+using namespace OHOS::USB;
34+using namespace std;
35+using namespace OHOS::HDI::Usb::V1_0;
36+ 
37+UsbDev UsbdTransferTestAdditional::dev_ = {0, 0};
38+sptr<UsbSubscriberTest> UsbdTransferTestAd
Ahdf/usb/transferTest_additional/common/usbd_transfer_test_additional_interrupt.cpp+229-0
Mhdf/usb/usbdBenchmarkTest/BUILD.gn+2-2