From 15f777ae41c6497848959ae6af79b14fed192b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 14 Mar 2025 10:41:47 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUILD.gn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/test/unittest/napi_test/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/test/unittest/napi_test/BUILD.gn b/interfaces/test/unittest/napi_test/BUILD.gn index d0dbea092..40c83b511 100644 --- a/interfaces/test/unittest/napi_test/BUILD.gn +++ b/interfaces/test/unittest/napi_test/BUILD.gn @@ -13,7 +13,7 @@ import("//build/test.gni") -module_output_path = "file_api/napi" +module_output_path = "file_api/file_api" ohos_js_unittest("file_api_js_test") { module_out_path = module_output_path hap_profile = "./config.json" -- Gitee From f6d348ee276e358eba14f95d2f4397706f8e43e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Thu, 20 Mar 2025 20:41:37 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 49 +++++++++++++++++++ interfaces/kits/js/src/mod_fs/common_func.h | 6 +++ interfaces/kits/js/src/mod_fs/module.cpp | 2 + 3 files changed, 57 insertions(+) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index 6193013a3..e830dfecd 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -78,6 +78,55 @@ void InitAccessModeType(napi_env env, napi_value exports) } } +void InitAccessFlagType(napi_env env, napi_value exports) +{ + char propertyName[] = "AccessFlagType"; + napi_property_descriptor desc[] = { + DECLARE_NAPI_STATIC_PROPERTY("LOCAL", NVal::CreateInt32(env, MODE_LOCAL).val_), + }; + napi_value obj = nullptr; + napi_status status = napi_create_object(env, &obj); + if (status != napi_ok) { + HILOGE("Failed to create object at initializing openMode"); + return; + } + status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); + if (status != napi_ok) { + HILOGE("Failed to set properties of character at initializing openMode"); + return; + } + status = napi_set_named_property(env, exports, propertyName, obj); + if (status != napi_ok) { + HILOGE("Failed to set direction property at initializing openMode"); + return; + } +} + +void InitLocationType(napi_env env, napi_value exports) +{ + char propertyName[] = "LocationType"; + napi_property_descriptor desc[] = { + DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAl).val_), + DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_CLOUD).val_), + }; + napi_value obj = nullptr; + napi_status status = napi_create_object(env, &obj); + if (status != napi_ok) { + HILOGE("Failed to create object at initializing openMode"); + return; + } + status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); + if (status != napi_ok) { + HILOGE("Failed to set properties of character at initializing openMode"); + return; + } + status = napi_set_named_property(env, exports, propertyName, obj); + if (status != napi_ok) { + HILOGE("Failed to set direction property at initializing openMode"); + return; + } +} + void InitOpenMode(napi_env env, napi_value exports) { char propertyName[] = "OpenMode"; diff --git a/interfaces/kits/js/src/mod_fs/common_func.h b/interfaces/kits/js/src/mod_fs/common_func.h index 567cf26b4..832325a9e 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.h +++ b/interfaces/kits/js/src/mod_fs/common_func.h @@ -44,6 +44,10 @@ constexpr unsigned int MODE_WRITE = 02; constexpr unsigned int MODE_READ = 04; constexpr unsigned int MODE_READ_WRITE = 06; +constexpr unsigned int MODE_LOCAL = 00; +constexpr unsigned int MODE_C_LOCAl = 01; +constexpr unsigned int MODE_CLOUD = 02; + constexpr unsigned int USR_READ_ONLY = 00; constexpr unsigned int USR_WRITE_ONLY = 01; constexpr unsigned int USR_RDWR = 02; @@ -75,6 +79,8 @@ public: #endif void InitAccessModeType(napi_env env, napi_value exports); +void InitAccessFlagType(napi_env env, napi_value exports); +void InitLocationType(napi_env env, napi_value exports); void InitOpenMode(napi_env env, napi_value exports); void InitWhenceType(napi_env env, napi_value exports); diff --git a/interfaces/kits/js/src/mod_fs/module.cpp b/interfaces/kits/js/src/mod_fs/module.cpp index 8944c27a6..cdbc61f85 100644 --- a/interfaces/kits/js/src/mod_fs/module.cpp +++ b/interfaces/kits/js/src/mod_fs/module.cpp @@ -39,6 +39,8 @@ namespace ModuleFileIO { static napi_value Export(napi_env env, napi_value exports) { InitAccessModeType(env, exports); + InitAccessFlagType(env, exports); + InitLocationType(env, exports); InitOpenMode(env, exports); InitWhenceType(env, exports); std::vector> products; -- Gitee From 1fe6d3367d6c86e555f4d7aa6c56b6750277c751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 00:48:31 +0000 Subject: [PATCH 03/12] update interfaces/kits/js/src/mod_fs/common_func.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.h b/interfaces/kits/js/src/mod_fs/common_func.h index 832325a9e..b850f6555 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.h +++ b/interfaces/kits/js/src/mod_fs/common_func.h @@ -45,7 +45,7 @@ constexpr unsigned int MODE_READ = 04; constexpr unsigned int MODE_READ_WRITE = 06; constexpr unsigned int MODE_LOCAL = 00; -constexpr unsigned int MODE_C_LOCAl = 01; +constexpr unsigned int MODE_C_LOCAL = 01; constexpr unsigned int MODE_CLOUD = 02; constexpr unsigned int USR_READ_ONLY = 00; -- Gitee From 022ed2846b00c4c90330acf4f469b60e563eb3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 01:38:24 +0000 Subject: [PATCH 04/12] update interfaces/kits/js/src/mod_fs/common_func.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index e830dfecd..b9043cbc0 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -106,7 +106,7 @@ void InitLocationType(napi_env env, napi_value exports) { char propertyName[] = "LocationType"; napi_property_descriptor desc[] = { - DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAl).val_), + DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAL).val_), DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_CLOUD).val_), }; napi_value obj = nullptr; -- Gitee From 09e323f4f0442b6d7e356f5776a6e3f0e72943ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 06:59:02 +0000 Subject: [PATCH 05/12] update interfaces/kits/js/src/mod_fs/common_func.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index b9043cbc0..61e911440 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -106,8 +106,8 @@ void InitLocationType(napi_env env, napi_value exports) { char propertyName[] = "LocationType"; napi_property_descriptor desc[] = { - DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_C_LOCAL).val_), - DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_CLOUD).val_), + DECLARE_NAPI_STATIC_PROPERTY("LOCAl", NVal::CreateInt32(env, MODE_LOCATION_LOCAL).val_), + DECLARE_NAPI_STATIC_PROPERTY("CLOUD", NVal::CreateInt32(env, MODE_LOCATION_CLOUD).val_), }; napi_value obj = nullptr; napi_status status = napi_create_object(env, &obj); -- Gitee From c6041f19fbe984fabbf9c2960e3bcf5d87a3286d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 07:01:16 +0000 Subject: [PATCH 06/12] update interfaces/kits/js/src/mod_fs/common_func.h. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.h b/interfaces/kits/js/src/mod_fs/common_func.h index b850f6555..7b6a2052b 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.h +++ b/interfaces/kits/js/src/mod_fs/common_func.h @@ -45,8 +45,8 @@ constexpr unsigned int MODE_READ = 04; constexpr unsigned int MODE_READ_WRITE = 06; constexpr unsigned int MODE_LOCAL = 00; -constexpr unsigned int MODE_C_LOCAL = 01; -constexpr unsigned int MODE_CLOUD = 02; +constexpr unsigned int MODE_LOCATION_LOCAL = 01; +constexpr unsigned int MODE_LOCATION_CLOUD = 02; constexpr unsigned int USR_READ_ONLY = 00; constexpr unsigned int USR_WRITE_ONLY = 01; -- Gitee From 18e206fc2b573c18de85ce081441e0cfd8f6c2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E9=87=91=E6=B2=9B?= Date: Fri, 21 Mar 2025 07:25:22 +0000 Subject: [PATCH 07/12] update interfaces/kits/js/src/mod_fs/common_func.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 陶金沛 --- interfaces/kits/js/src/mod_fs/common_func.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/common_func.cpp b/interfaces/kits/js/src/mod_fs/common_func.cpp index 61e911440..46e0cf653 100644 --- a/interfaces/kits/js/src/mod_fs/common_func.cpp +++ b/interfaces/kits/js/src/mod_fs/common_func.cpp @@ -87,17 +87,17 @@ void InitAccessFlagType(napi_env env, napi_value exports) napi_value obj = nullptr; napi_status status = napi_create_object(env, &obj); if (status != napi_ok) { - HILOGE("Failed to create object at initializing openMode"); + HILOGE("Failed to create object at initializing AccessFlagType"); return; } status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); if (status != napi_ok) { - HILOGE("Failed to set properties of character at initializing openMode"); + HILOGE("Failed to set properties of character at initializing AccessFlagType"); return; } status = napi_set_named_property(env, exports, propertyName, obj); if (status != napi_ok) { - HILOGE("Failed to set direction property at initializing openMode"); + HILOGE("Failed to set direction property at initializing AccessFlagType"); return; } } @@ -112,17 +112,17 @@ void InitLocationType(napi_env env, napi_value exports) napi_value obj = nullptr; napi_status status = napi_create_object(env, &obj); if (status != napi_ok) { - HILOGE("Failed to create object at initializing openMode"); + HILOGE("Failed to create object at initializing LocationType"); return; } status = napi_define_properties(env, obj, sizeof(desc) / sizeof(desc[0]), desc); if (status != napi_ok) { - HILOGE("Failed to set properties of character at initializing openMode"); + HILOGE("Failed to set properties of character at initializing LocationType"); return; } status = napi_set_named_property(env, exports, propertyName, obj); if (status != napi_ok) { - HILOGE("Failed to set direction property at initializing openMode"); + HILOGE("Failed to set direction property at initializing LocationType"); return; } } -- Gitee From dd8fabd0f237760c0ef581b7abf52099bf4b8426 Mon Sep 17 00:00:00 2001 From: zhongning5 Date: Tue, 25 Mar 2025 17:19:39 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0platformsdk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhongning5 --- interfaces/kits/rust/BUILD.gn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interfaces/kits/rust/BUILD.gn b/interfaces/kits/rust/BUILD.gn index a4cc7d698..965a4ec21 100644 --- a/interfaces/kits/rust/BUILD.gn +++ b/interfaces/kits/rust/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. +# Copyright (c) 2023-2025 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 @@ -26,5 +26,6 @@ ohos_rust_shared_ffi("rust_file") { rustflags = [ "-Zstack-protector=all" ] deps = [ "//third_party/rust/crates/libc:lib" ] external_deps = [ "hilog:hilog_rust" ] + innerapi_tags = [ "platformsdk" ] public_configs = [ ":public_config" ] } -- Gitee From 4dcedb85c3ce94d6a1a068762e9a56e66efa2791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9C=E9=99=B6=E9=87=91=E6=B2=9B=E2=80=9D?= Date: Mon, 31 Mar 2025 21:04:54 +0800 Subject: [PATCH 09/12] =?UTF-8?q?tdd=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: “陶金沛” --- .../test/unittest/class_file/rust_test.cpp | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/interfaces/test/unittest/class_file/rust_test.cpp b/interfaces/test/unittest/class_file/rust_test.cpp index 7b3800a8b..6c60bd3b1 100644 --- a/interfaces/test/unittest/class_file/rust_test.cpp +++ b/interfaces/test/unittest/class_file/rust_test.cpp @@ -95,10 +95,10 @@ HWTEST_F(RustTest, RustTest_ReaderIterator_0003, testing::ext::TestSize.Level1) * @tc.desc: Test function of NextLine() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNF */ -HWTEST_F(RustTest, RustTest_NextLine_0001, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_NextLine_0001, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_NextLine_0001"; @@ -119,10 +119,10 @@ HWTEST_F(RustTest, RustTest_NextLine_0001, testing::ext::TestSize.Level1) * @tc.desc: Test function of NextLine() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNF */ -HWTEST_F(RustTest, RustTest_NextLine_0002, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_NextLine_0002, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_NextLine_0002"; @@ -159,10 +159,10 @@ HWTEST_F(RustTest, RustTest_NextLine_0003, testing::ext::TestSize.Level1) * @tc.desc: Test function of Lseek() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGCS3 */ -HWTEST_F(RustTest, RustTest_Lseek_0001, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Lseek_0001, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Lseek_0001"; @@ -182,10 +182,10 @@ HWTEST_F(RustTest, RustTest_Lseek_0001, testing::ext::TestSize.Level1) * @tc.desc: Test function of Lseek() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGCS3 */ -HWTEST_F(RustTest, RustTest_Lseek_0002, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Lseek_0002, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Lseek_0002"; @@ -208,10 +208,10 @@ HWTEST_F(RustTest, RustTest_Lseek_0002, testing::ext::TestSize.Level1) * @tc.desc: Test function of Lseek() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGCS3 */ -HWTEST_F(RustTest, RustTest_Lseek_0003, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Lseek_0003, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Lseek_0003"; @@ -254,10 +254,10 @@ HWTEST_F(RustTest, RustTest_Lseek_0004, testing::ext::TestSize.Level1) * @tc.desc: Test function of Lseek() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGCS3 */ -HWTEST_F(RustTest, RustTest_Lseek_0005, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Lseek_0005, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Lseek_0005"; @@ -280,10 +280,10 @@ HWTEST_F(RustTest, RustTest_Lseek_0005, testing::ext::TestSize.Level1) * @tc.desc: Test function of Lseek() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGCS3 */ -HWTEST_F(RustTest, RustTest_Lseek_0006, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Lseek_0006, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Lseek_0006"; @@ -303,10 +303,10 @@ HWTEST_F(RustTest, RustTest_Lseek_0006, testing::ext::TestSize.Level1) * @tc.desc: Test function of Lseek() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGCS3 */ -HWTEST_F(RustTest, RustTest_Lseek_0007, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Lseek_0007, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Lseek_0007"; @@ -322,10 +322,10 @@ HWTEST_F(RustTest, RustTest_Lseek_0007, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0001, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0001, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0001"; @@ -347,10 +347,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0001, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0002, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0002, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0002"; @@ -372,10 +372,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0002, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0003, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0003, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0003"; @@ -393,10 +393,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0003, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0004, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0004, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0004"; @@ -412,10 +412,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0004, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0005, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0005, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0005"; @@ -432,10 +432,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0005, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0006, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0006, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0006"; @@ -452,10 +452,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0006, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0007, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0007, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0007"; @@ -472,10 +472,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0007, testing::ext::TestSize.Level1) * @tc.desc: Test function of Mkdirs() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNJ */ -HWTEST_F(RustTest, RustTest_Mkdirs_0008, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_Mkdirs_0008, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_Mkdirs_0008"; @@ -492,10 +492,10 @@ HWTEST_F(RustTest, RustTest_Mkdirs_0008, testing::ext::TestSize.Level1) * @tc.desc: Test function of GetParent() interface for SUCCESS. * @tc.size: MEDIUM * @tc.type: FUNC -* @tc.level Level 1 +* @tc.level Level 0 * @tc.require: AR000IGDNL */ -HWTEST_F(RustTest, RustTest_GetParent_0001, testing::ext::TestSize.Level1) +HWTEST_F(RustTest, RustTest_GetParent_0001, testing::ext::TestSize.Level0) { GTEST_LOG_(INFO) << "RustTest-begin RustTest_GetParent_0001"; -- Gitee From 1dd0d213f40b9082e741fee31e76ec9b22a5bfce Mon Sep 17 00:00:00 2001 From: repo sync -c Date: Thu, 10 Apr 2025 15:48:31 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E4=B8=AD=E9=80=94=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=A2=9E=E5=8A=A0scope=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 周鑫 Change-Id: Iea71514be018757f3c0c6dfc1222bfbb3ac21553 --- utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp b/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp index 9cad32c85..ff421fc03 100644 --- a/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp +++ b/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp @@ -120,6 +120,7 @@ static void CallbackComplete(napi_env env, napi_status status, void *data) napi_value callback = ctx->cb_.Deref(env).val_; if (!bool(ctx->cb_)) { HILOGE("failed to get ref."); + napi_close_handle_scope(env, scope); return; } -- Gitee From 88e347e81679f6daee49d7e7f31a695a08cc8b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E9=91=AB?= Date: Thu, 10 Apr 2025 09:27:08 +0000 Subject: [PATCH 11/12] update utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 周鑫 --- utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp b/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp index ff421fc03..4f2e88a80 100644 --- a/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp +++ b/utils/filemgmt_libn/src/n_async/n_async_work_callback.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 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 -- Gitee From 19f00b93a29d54f77ba9eecab58f2c1b17a69e45 Mon Sep 17 00:00:00 2001 From: y30045862 Date: Sat, 12 Apr 2025 23:52:41 +0800 Subject: [PATCH 12/12] fix randomaccess write async Signed-off-by: yangjingbo10 Change-Id: I8b01907ff6b349514d4cd01448b0d43711170448 --- .../randomaccessfile_n_exporter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/class_randomaccessfile/randomaccessfile_n_exporter.cpp b/interfaces/kits/js/src/mod_fs/class_randomaccessfile/randomaccessfile_n_exporter.cpp index 3a620f1fc..bbe140fbb 100644 --- a/interfaces/kits/js/src/mod_fs/class_randomaccessfile/randomaccessfile_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fs/class_randomaccessfile/randomaccessfile_n_exporter.cpp @@ -275,8 +275,10 @@ napi_value RandomAccessFileNExporter::WriteSync(napi_env env, napi_callback_info struct AsyncIORafWriteArg { NRef rafRefWriteArrayBuf; + std::unique_ptr guardWriteStr_ = nullptr; int actLen = 0; explicit AsyncIORafWriteArg(NVal refWriteArrayBuf) : rafRefWriteArrayBuf(refWriteArrayBuf) {} + explicit AsyncIORafWriteArg(std::unique_ptr &&guardWriteStr) : guardWriteStr_(move(guardWriteStr)) {} ~AsyncIORafWriteArg() = default; }; @@ -286,7 +288,8 @@ static napi_value WriteExec(napi_env env, NFuncArg &funcArg, RandomAccessFileEnt void *buf = nullptr; size_t len = 0; int64_t offset = 0; - tie(succ, ignore, buf, len, offset) = + unique_ptr bufGuard = nullptr; + tie(succ, bufGuard, buf, len, offset) = CommonFunc::GetWriteArg(env, funcArg[NARG_POS::FIRST], funcArg[NARG_POS::SECOND]); if (!succ) { HILOGE("Invalid buffer/options"); @@ -294,7 +297,7 @@ static napi_value WriteExec(napi_env env, NFuncArg &funcArg, RandomAccessFileEnt return nullptr; } - auto arg = CreateSharedPtr(NVal(env, funcArg[NARG_POS::FIRST])); + auto arg = CreateSharedPtr(move(bufGuard)); if (arg == nullptr) { HILOGE("Failed to request heap memory."); NError(ENOMEM).ThrowErr(env); @@ -319,9 +322,8 @@ static napi_value WriteExec(napi_env env, NFuncArg &funcArg, RandomAccessFileEnt auto cbCompl = [arg](napi_env env, NError err) -> NVal { if (err) { return { env, err.GetNapiErr(env) }; - } else { - return { NVal::CreateInt64(env, arg->actLen) }; } + return { NVal::CreateInt64(env, arg->actLen) }; }; NVal thisVar(env, funcArg.GetThisVar()); -- Gitee