Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
195a8b5e
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
195a8b5e
编写于
3月 23, 2023
作者:
1
15929983503
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hilogtestjs add debug lable
Signed-off-by:
N
15929983503
<
duanhaizhen@huawei.com
>
上级
7b228c66
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
177 addition
and
26 deletion
+177
-26
hiviewdfx/BUILD.gn
hiviewdfx/BUILD.gn
+0
-1
hiviewdfx/hilogtest/hilogjstest/BUILD.gn
hiviewdfx/hilogtest/hilogjstest/BUILD.gn
+4
-0
hiviewdfx/hilogtest/hilogjstest/src/main/config.json
hiviewdfx/hilogtest/hilogjstest/src/main/config.json
+5
-3
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/BUILD.gn
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/BUILD.gn
+55
-0
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/CMakeLists.txt
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/CMakeLists.txt
+11
-0
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/hilogndk.cpp
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/hilogndk.cpp
+67
-0
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/types/libentry/index.d.ts
...ogtest/hilogjstest/src/main/cpp/types/libentry/index.d.ts
+1
-0
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/types/libentry/package.json
...test/hilogjstest/src/main/cpp/types/libentry/package.json
+4
-0
hiviewdfx/hilogtest/hilogjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
...logjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+1
-1
hiviewdfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js
...dfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js
+29
-3
hiviewdfx/hilogtest/hilogndktest/Test.json
hiviewdfx/hilogtest/hilogndktest/Test.json
+0
-18
未找到文件。
hiviewdfx/BUILD.gn
浏览文件 @
195a8b5e
...
@@ -26,7 +26,6 @@ group("hiviewdfxtestacts") {
...
@@ -26,7 +26,6 @@ group("hiviewdfxtestacts") {
"hilogtest/hilogdomainofftest:ActsHilogDomainOffJsTest",
"hilogtest/hilogdomainofftest:ActsHilogDomainOffJsTest",
"hilogtest/hilogdomainontest:ActsHilogDomainOnJsTest",
"hilogtest/hilogdomainontest:ActsHilogDomainOnJsTest",
"hilogtest/hilogjstest:ActsHilogJsTest",
"hilogtest/hilogjstest:ActsHilogJsTest",
"hilogtest/hilogndktest:ActsHilogndkTest",
"hisyseventtest/hisyseventjstest:ActsHiSysEventJsTest",
"hisyseventtest/hisyseventjstest:ActsHiSysEventJsTest",
"hisyseventtest/hisyseventnormaltest:ActsHiSysEventNormalTest",
"hisyseventtest/hisyseventnormaltest:ActsHiSysEventNormalTest",
"hitracechainjstest:ActsHiTraceChainJsTest",
"hitracechainjstest:ActsHiTraceChainJsTest",
...
...
hiviewdfx/hilogtest/hilogjstest/BUILD.gn
浏览文件 @
195a8b5e
...
@@ -21,6 +21,10 @@ ohos_js_hap_suite("ActsHilogJsTest") {
...
@@ -21,6 +21,10 @@ ohos_js_hap_suite("ActsHilogJsTest") {
certificate_profile = "./signature/openharmony_sx.p7b"
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsHilogJsTest"
hap_name = "ActsHilogJsTest"
js_build_mode = "debug"
shared_libraries = [
"./src/main/cpp:hilogndk",
]
}
}
ohos_js_assets("hilog_js_assets") {
ohos_js_assets("hilog_js_assets") {
js2abc = true
js2abc = true
...
...
hiviewdfx/hilogtest/hilogjstest/src/main/config.json
浏览文件 @
195a8b5e
...
@@ -11,13 +11,15 @@
...
@@ -11,13 +11,15 @@
"target"
:
5
"target"
:
5
}
}
},
},
"deviceConfig"
:
{},
"deviceConfig"
:
{
"default"
:{
"debug"
:
true
}
},
"module"
:
{
"module"
:
{
"package"
:
"ohos.acts.hiviewdfx.hilog.function"
,
"package"
:
"ohos.acts.hiviewdfx.hilog.function"
,
"name"
:
".entry"
,
"name"
:
".entry"
,
"deviceType"
:
[
"deviceType"
:
[
"tablet"
,
"tablet"
,
"default"
,
"default"
,
"phone"
"phone"
],
],
"distro"
:
{
"distro"
:
{
...
...
hiviewdfx/hilogtest/hilog
ndktest
/BUILD.gn
→
hiviewdfx/hilogtest/hilog
jstest/src/main/cpp
/BUILD.gn
100755 → 100644
浏览文件 @
195a8b5e
...
@@ -11,24 +11,45 @@
...
@@ -11,24 +11,45 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
import("//build/config/ohos/config.gni")
module_output_path = "hits/ActsHilogndkTest"
import("//build/ohos.gni")
import("//foundation/arkui/napi/napi.gni")
config("
hilogndktest_
config") {
config("config") {
visibility = [ ":*" ]
visibility = [ ":*" ]
include_dirs = [
"//base/hiviewdfx/hilog/interfaces/native/kits/include",
cflags = [
"//commonlibrary/c_utils/base/include/",
"-Wall",
"-Werror",
"-g3",
"-Wunused-variable",
]
]
}
}
ohos_moduletest_suite("ActsHilogndkTest") {
module_out_path = module_output_path
config("public_config") {
sources = [ "hilogndktest.cpp" ]
}
external_deps = [ "c_utils:utils" ]
ohos_shared_library("hilogndk") {
sources = [ "./hilogndk.cpp" ]
if (!(product_name == "m40")) {
if (target_cpu == "arm") {
libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ]
} else if (target_cpu == "arm64") {
libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ]
} else {
libs = []
}
}
include_dirs = [ "//test/xts/acts/hiviewdfx/hilogtest/hilogjstest/src/main/cpp",
"//base/hiviewdfx/hilog/interfaces/native/kits/include", ]
configs = [ ":config" ]
deps = [
deps = [
"//foundation/arkui/napi:ace_napi",
"//base/hiviewdfx/hilog/frameworks/hilog_ndk:hilog_ndk",
"//base/hiviewdfx/hilog/frameworks/hilog_ndk:hilog_ndk",
"//base/hiviewdfx/hilog/interfaces/native/kits:libhilog_ndk",
"//base/hiviewdfx/hilog/interfaces/native/kits:libhilog_ndk",
"//third_party/googletest:gtest_main",
]
]
configs = [ ":hilogndktest_config" ]
output_extension = "so"
}
}
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/CMakeLists.txt
0 → 100644
浏览文件 @
195a8b5e
# the minimum version of CMake.
cmake_minimum_required
(
VERSION 3.4.1
)
project
(
XComponent
)
set
(
NATIVERENDER_ROOT_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
)
include_directories
(
${
NATIVERENDER_ROOT_PATH
}
${
NATIVERENDER_ROOT_PATH
}
/include
)
add_library
(
hilogndk SHARED hilogndk.cpp
)
target_link_libraries
(
hilogndk PUBLIC libace_napi.z.so libc++.a libhilog_ndk.z.so
)
\ No newline at end of file
hiviewdfx/hilogtest/hilog
ndktest/hilogndktest
.cpp
→
hiviewdfx/hilogtest/hilog
jstest/src/main/cpp/hilogndk
.cpp
浏览文件 @
195a8b5e
/**
/*
* Copyright (c) 2020-2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
#include <gtest/gtest.h>
#include "napi/native_api.h"
#include "hilog/log.h"
#include "hilog/log.h"
#undef LOG_DOMAIN
static
napi_value
OhIsLoggableTest
(
napi_env
env
,
napi_callback_info
info
)
#undef LOG_TAG
{
#define LOG_DOMAIN 0xD003e00
napi_value
res
=
nullptr
;
bool
isLoggable
=
OH_LOG_IsLoggable
(
0x3200
,
"testTag"
,
LOG_DEBUG
);
using
namespace
std
;
napi_get_boolean
(
env
,
isLoggable
,
&
res
);
using
namespace
testing
::
ext
;
return
res
;
}
class
hilogndktest
:
public
testing
::
Test
{
public:
static
napi_value
OhPrintTest
(
napi_env
env
,
napi_callback_info
info
)
static
void
SetUpTestCase
();
{
static
void
TearDownTestCase
();
napi_value
res
=
nullptr
;
void
SetUp
();
LogType
type
=
LOG_APP
;
void
TearDown
();
LogLevel
level
=
LOG_ERROR
;
};
int
retLen
=
OH_LOG_Print
(
type
,
level
,
0x3200
,
"testTag"
,
"string for hilog test"
);
bool
ret
=
(
retLen
>
0
)
?
true
:
false
;
void
hilogndktest
::
SetUp
()
napi_get_boolean
(
env
,
ret
,
&
res
);
{
return
res
;
}
}
void
hilogndktest
::
TearDown
()
{
}
void
hilogndktest
::
SetUpTestCase
()
EXTERN_C_START
{
static
napi_value
Init
(
napi_env
env
,
napi_value
exports
)
}
{
void
hilogndktest
::
TearDownTestCase
()
napi_property_descriptor
desc
[]
=
{
{
{
"ohIsLoggableTest"
,
nullptr
,
OhIsLoggableTest
,
}
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
},
{
"ohPrintTest"
,
nullptr
,
OhPrintTest
,
/**
nullptr
,
nullptr
,
nullptr
,
napi_default
,
nullptr
}
* @tc.number : DFX_DFT_HILOGNDK_0100
};
* @tc.name : HILOGNDK_TEST
napi_define_properties
(
env
,
exports
,
sizeof
(
desc
)
/
sizeof
(
desc
[
0
]),
desc
);
* @tc.desc : HILOGNDK_TEST
return
exports
;
*/
}
HWTEST_F
(
hilogndktest
,
OH_LOG_Print_CHECK
,
Function
|
MediumTest
|
Level1
)
EXTERN_C_END
{
LogType
type
=
LOG_APP
;
static
napi_module
demoModule
=
{
LogLevel
level
=
LOG_ERROR
;
.
nm_version
=
1
,
int
ret
=
OH_LOG_Print
(
type
,
level
,
0xD003e00
,
"testtag0testtag1testtag2"
,
"string:for hilog test %{private}s"
,
"name"
);
.
nm_flags
=
0
,
ASSERT_TRUE
(
ret
==
85
);
.
nm_filename
=
nullptr
,
}
.
nm_register_func
=
Init
,
.
nm_modname
=
"libhilogndk"
,
/**
.
nm_priv
=
((
void
*
)
0
),
* @tc.number : DFX_DFT_HILOGNDK_0200
.
reserved
=
{
0
},
* @tc.name : HILOGNDK_TEST
};
* @tc.desc : HILOGNDK_TEST
*/
extern
"C"
__attribute__
((
constructor
))
void
RegisterModule
(
void
)
HWTEST_F
(
hilogndktest
,
OH_LOG_IsLoggable_CHECK
,
Function
|
MediumTest
|
Level1
)
{
{
napi_module_register
(
&
demoModule
);
LogLevel
level
=
LOG_DEBUG
;
}
const
char
*
LOG_TAG
=
"testtag0testtag0testtag0testta"
;
bool
res
=
OH_LOG_IsLoggable
(
0xD003e00
,
LOG_TAG
,
level
);
ASSERT_TRUE
(
res
==
false
);
}
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/types/libentry/index.d.ts
0 → 100644
浏览文件 @
195a8b5e
export
const
OhIsLoggableTest
:
()
=>
object
;
\ No newline at end of file
hiviewdfx/hilogtest/hilogjstest/src/main/cpp/types/libentry/package.json
0 → 100644
浏览文件 @
195a8b5e
{
"name"
:
"libhilogndk.so"
,
"types"
:
"./index.d.ts"
}
\ No newline at end of file
hiviewdfx/hilogtest/hilogjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
浏览文件 @
195a8b5e
...
@@ -41,7 +41,7 @@ function translateParamsToString(parameters) {
...
@@ -41,7 +41,7 @@ function translateParamsToString(parameters) {
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -
d 0 -
a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
var
cmd
=
'
aa start -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
console
.
info
(
'
debug value :
'
+
debug
)
...
...
hiviewdfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js
浏览文件 @
195a8b5e
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
import
hilog
from
'
@ohos.hilog
'
import
hilog
from
'
@ohos.hilog
'
import
hilogndk
from
"
libhilogndk.so
"
export
default
function
HilogJsTest
()
{
export
default
function
HilogJsTest
()
{
describe
(
'
HilogJsTest
'
,
function
()
{
describe
(
'
HilogJsTest
'
,
function
()
{
...
@@ -120,7 +121,7 @@ describe('HilogJsTest', function () {
...
@@ -120,7 +121,7 @@ describe('HilogJsTest', function () {
it
(
'
testHilogJsApi06
'
,
2
,
function
()
{
it
(
'
testHilogJsApi06
'
,
2
,
function
()
{
console
.
info
(
'
testHilogJsApi06 start
'
);
console
.
info
(
'
testHilogJsApi06 start
'
);
const
res
=
hilog
.
isLoggable
(
0x3200
,
"
HILOGTEST
"
,
hilog
.
LogLevel
.
DEBUG
);
const
res
=
hilog
.
isLoggable
(
0x3200
,
"
HILOGTEST
"
,
hilog
.
LogLevel
.
DEBUG
);
expect
(
res
).
assertEqual
(
fals
e
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
info
(
'
testHilogJsApi06 end
'
);
console
.
info
(
'
testHilogJsApi06 end
'
);
})
})
...
@@ -136,7 +137,7 @@ describe('HilogJsTest', function () {
...
@@ -136,7 +137,7 @@ describe('HilogJsTest', function () {
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
tag
+=
"
HILOGTEST
"
tag
+=
"
HILOGTEST
"
}
}
expect
(
res
).
assertEqual
(
fals
e
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
info
(
'
testHilogJsApi07 end
'
);
console
.
info
(
'
testHilogJsApi07 end
'
);
})
})
...
@@ -148,7 +149,7 @@ describe('HilogJsTest', function () {
...
@@ -148,7 +149,7 @@ describe('HilogJsTest', function () {
it
(
'
testHilogJsApi08
'
,
2
,
function
()
{
it
(
'
testHilogJsApi08
'
,
2
,
function
()
{
console
.
info
(
'
testHilogJsApi08 start
'
);
console
.
info
(
'
testHilogJsApi08 start
'
);
const
res
=
hilog
.
isLoggable
(
0x3200
,
""
,
hilog
.
LogLevel
.
DEBUG
);
const
res
=
hilog
.
isLoggable
(
0x3200
,
""
,
hilog
.
LogLevel
.
DEBUG
);
expect
(
res
).
assertEqual
(
fals
e
);
expect
(
res
).
assertEqual
(
tru
e
);
console
.
info
(
'
testHilogJsApi08 end
'
);
console
.
info
(
'
testHilogJsApi08 end
'
);
})
})
...
@@ -415,5 +416,30 @@ describe('HilogJsTest', function () {
...
@@ -415,5 +416,30 @@ describe('HilogJsTest', function () {
console
.
info
(
'
testHilogJsApi26 end
'
);
console
.
info
(
'
testHilogJsApi26 end
'
);
})
})
/**
* @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3800
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHilogJsApi27
'
,
2
,
function
()
{
console
.
info
(
'
testHilogJsApi27 start
'
);
const
res
=
hilogndk
.
ohIsLoggableTest
();
expect
(
res
).
assertEqual
(
true
);
console
.
info
(
'
testHilogJsApi27 end
'
);
})
/**
* @tc.number DFX_DFT_Hiview_Libhilog_Hilog_JS_3800
* @tc.name hitrace interface test
* @tc.desc hitrace begin interface test.
*/
it
(
'
testHilogJsApi28
'
,
2
,
function
()
{
console
.
info
(
'
testHilogJsApi28 start
'
);
const
res
=
hilogndk
.
ohPrintTest
();
expect
(
res
).
assertEqual
(
true
);
console
.
info
(
'
testHilogJsApi28 end
'
);
})
})
})
}
}
hiviewdfx/hilogtest/hilogndktest/Test.json
已删除
100755 → 0
浏览文件 @
7b228c66
{
"description"
:
"Configuration for hilogndktest demo Tests"
,
"driver"
:
{
"type"
:
"CppTest"
,
"native-test-timeout"
:
"120000"
,
"module-name"
:
"ActsHilogndkTest"
,
"runtime-hint"
:
"ls"
,
"native-test-device-path"
:
"/data/local/tmp"
},
"kits"
:
[
{
"push"
:
[
"ActsHilogndkTest->/data/local/tmp/ActsHilogndkTest"
],
"type"
:
"PushKit"
}
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录