Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Test Developertest
提交
92e608a0
T
Test Developertest
项目概览
OpenHarmony
/
Test Developertest
大约 1 年 前同步成功
通知
2
Star
23
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Test Developertest
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
92e608a0
编写于
3月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!94 Modified the codes
Merge pull request !94 from stivn/master
上级
fb1c02b8
2cde3b8d
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
88 addition
and
73 deletion
+88
-73
aw/cxx/distributed/distributed.h
aw/cxx/distributed/distributed.h
+3
-3
aw/cxx/distributed/distributed_agent.cpp
aw/cxx/distributed/distributed_agent.cpp
+8
-3
aw/cxx/distributed/distributed_agent.h
aw/cxx/distributed/distributed_agent.h
+5
-4
aw/cxx/distributed/distributed_cfg.cpp
aw/cxx/distributed/distributed_cfg.cpp
+1
-1
aw/cxx/distributed/distributed_cfg.h
aw/cxx/distributed/distributed_cfg.h
+4
-3
aw/cxx/distributed/distributed_major.cpp
aw/cxx/distributed/distributed_major.cpp
+1
-1
aw/cxx/distributed/distributed_major.h
aw/cxx/distributed/distributed_major.h
+7
-7
aw/cxx/distributed/utils/csv_transform_xml.h
aw/cxx/distributed/utils/csv_transform_xml.h
+6
-4
aw/cxx/hwext/perf.cpp
aw/cxx/hwext/perf.cpp
+9
-11
aw/cxx/hwext/perf.h
aw/cxx/hwext/perf.h
+7
-6
examples/calculator/test/fuzztest/common/parse_fuzzer/parse_fuzzer.cpp
...ulator/test/fuzztest/common/parse_fuzzer/parse_fuzzer.cpp
+5
-1
examples/detector/src/detector.cpp
examples/detector/src/detector.cpp
+3
-0
examples/distributedb/test/distributedtest/common/distribute_demo.cpp
...tributedb/test/distributedtest/common/distribute_demo.cpp
+5
-5
examples/lite/c_demo/include/calc_multi.h
examples/lite/c_demo/include/calc_multi.h
+3
-3
examples/sleep/test/performance/common/spent_time_test.cpp
examples/sleep/test/performance/common/spent_time_test.cpp
+6
-6
libs/benchmark/README_zh.md
libs/benchmark/README_zh.md
+15
-15
未找到文件。
aw/cxx/distributed/distributed.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef _DISTRIBUTED_H_
#define _DISTRIBUTED_H_
#ifndef
AW_CXX_DISTRIBUTED
_DISTRIBUTED_H_
#define
AW_CXX_DISTRIBUTED
_DISTRIBUTED_H_
#include <iostream>
#include "securec.h"
...
...
@@ -50,4 +50,4 @@ using DistDeviceInfo = DistDevInfo;
}
// namespace DistributeSystemTest
}
// namespace OHOS
#endif // _DISTRIBUTED_H_
#endif //
AW_CXX_DISTRIBUTED
_DISTRIBUTED_H_
aw/cxx/distributed/distributed_agent.cpp
浏览文件 @
92e608a0
...
...
@@ -85,7 +85,11 @@ int DistributedAgent::InitAgentServer()
}
struct
sockaddr_in
addr
;
memset_s
(
&
addr
,
sizeof
(
addr
),
0
,
sizeof
(
addr
));
errno_t
ret
=
EOK
;
ret
=
memset_s
(
&
addr
,
sizeof
(
addr
),
0
,
sizeof
(
addr
));
if
(
ret
!=
EOK
)
{
return
-
1
;
}
addr
.
sin_family
=
AF_INET
;
if
(
agentIpAddr_
!=
""
)
{
inet_pton
(
AF_INET
,
agentIpAddr_
.
c_str
(),
&
addr
.
sin_addr
);
...
...
@@ -203,7 +207,8 @@ int DistributedAgent::DoCmdServer(int serverSockFd)
auto
pclinereturn
=
reinterpret_cast
<
DistributedMsg
*>
(
returnValue
);
pclinereturn
->
no
=
pcline
->
no
;
pclinereturn
->
cmdTestType
=
htons
(
DST_COMMAND_CALL
);
sprintf_s
(
pclinereturn
->
alignmentCmd
,
(
MAX_BUFF_LEN
-
DST_COMMAND_HEAD_LEN
),
"%d"
,
nresult
);
(
void
)
sprintf_s
(
pclinereturn
->
alignmentCmd
,
(
MAX_BUFF_LEN
-
DST_COMMAND_HEAD_LEN
),
"%d"
,
nresult
)
<
0
);
rlen
=
strlen
(
pclinereturn
->
alignmentCmd
)
+
1
;
pclinereturn
->
len
=
htons
(
rlen
);
HiLog
::
Info
(
DistributedAgent
::
LABEL
,
"agent get message :%s .
\n
"
,
...
...
@@ -413,4 +418,4 @@ int DistributedAgent::Stop()
return
0
;
}
}
// namespace DistributeSystemTest
}
// namespace OHOS
\ No newline at end of file
}
// namespace OHOS
aw/cxx/distributed/distributed_agent.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef
DISTRIBUTED_AGENT_H
#define
DISTRIBUTED_AGENT_H
#ifndef
AW_CXX_DISTRIBUTED_DISTRIBUTED_AGENT_H_
#define
AW_CXX_DISTRIBUTED_DISTRIBUTED_AGENT_H_
#include <map>
#include <vector>
...
...
@@ -47,7 +47,7 @@ public:
protected:
virtual
bool
SetUp
();
virtual
bool
TearDown
();
virtual
void
OnLocalInit
()
{}
;
virtual
void
OnLocalInit
()
{}
virtual
int
OnProcessCmd
(
const
std
::
string
&
strCommand
,
int
cmdLen
,
const
std
::
string
&
strArgs
,
int
argsLen
,
const
std
::
string
&
strExpectValue
,
int
expectValueLen
);
virtual
int
OnProcessMsg
(
const
std
::
string
&
strMsg
,
int
msgLen
,
std
::
string
&
strReturnValue
,
int
returnBufLen
);
...
...
@@ -69,4 +69,5 @@ private:
}
// namespace DistributeSystemTest
}
// namespace OHOS
#endif // DISTRIBUTED_AGENT_H
#endif // AW_CXX_DISTRIBUTED_DISTRIBUTED_AGENT_H_
aw/cxx/distributed/distributed_cfg.cpp
浏览文件 @
92e608a0
...
...
@@ -160,4 +160,4 @@ std::unique_ptr<DistributedCfg>& DistributedCfg::GetInstance()
std
::
unique_ptr
<
DistributedCfg
>
DistributedCfg
::
getCfg_
=
nullptr
;
}
// namespace DistributeSystemTest
}
// namespace OHOS
\ No newline at end of file
}
// namespace OHOS
aw/cxx/distributed/distributed_cfg.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef
DISTRIBUTED_CFG_H
#define
DISTRIBUTED_CFG_H
#ifndef
AW_CXX_DISTRIBUTED_DISTRIBUTED_CFG_H_
#define
AW_CXX_DISTRIBUTED_DISTRIBUTED_CFG_H_
#include <map>
#include <iostream>
...
...
@@ -52,4 +52,5 @@ private:
};
}
// namespace DistributeSystemTest
}
// namespace OHOS
#endif
\ No newline at end of file
#endif // AW_CXX_DISTRIBUTED_DISTRIBUTED_CFG_H_
aw/cxx/distributed/distributed_major.cpp
浏览文件 @
92e608a0
...
...
@@ -504,4 +504,4 @@ bool DistributeTest::Notify(AGENT_NO devNo, const std::string ¬ifyType, const
return
false
;
}
}
// namespace DistributeSystemTest
}
// namespace OHOS
\ No newline at end of file
}
// namespace OHOS
aw/cxx/distributed/distributed_major.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef
DISTRIBUTED_MAJOR_H
#define
DISTRIBUTED_MAJOR_H
#ifndef
AW_CXX_DISTRIBUTED_DISTRIBUTED_MAJOR_H_
#define
AW_CXX_DISTRIBUTED_DISTRIBUTED_MAJOR_H_
#include <vector>
#include <map>
...
...
@@ -92,7 +92,7 @@ protected:
int
GetReturnVal
();
private:
void
OnProcessNotify
()
{}
;
void
OnProcessNotify
()
{}
int
returnVal_
;
static
void
SetUpTestCase
(
void
);
...
...
@@ -101,14 +101,14 @@ private:
// init network environment, obtain all the address of agent and connect
int
InitEnv
(
std
::
vector
<
std
::
string
>
clientList
);
virtual
void
SetUp
()
{}
;
virtual
void
TearDown
()
{}
;
virtual
void
SetUp
()
{}
virtual
void
TearDown
()
{}
virtual
void
OnNotify
()
{}
;
virtual
void
OnNotify
()
{}
virtual
bool
OnProcessValue
(
const
std
::
string
&
szbuf
,
int
len
);
virtual
bool
OnMsgProc
(
const
std
::
string
&
szbuf
,
int
len
);
};
}
// namespace DistributeSystemTest
}
// namespace OHOS
#endif // DISTRIBUTED_MAJOR_H
\ No newline at end of file
#endif // AW_CXX_DISTRIBUTED_DISTRIBUTED_MAJOR_H_
aw/cxx/distributed/utils/csv_transform_xml.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,9 @@
* limitations under the License.
*/
#ifndef UNTITLED_CSV_TO_XML_H
#define UNTITLED_CSV_TO_XML_H
#ifndef AW_CXX_DISTRIBUTED_UTILS_CSV_TRANSFORM_XML_H_
#define AW_CXX_DISTRIBUTED_UTILS_CSV_TRANSFORM_XML_H_
#include <iostream>
#include <vector>
#include <string>
...
...
@@ -35,7 +36,7 @@ class CsvTransformXml {
public:
CsvTransformXml
(
std
::
string
targetFile
)
explicit
CsvTransformXml
(
std
::
string
targetFile
)
{
SetFileName
(
targetFile
);
SetCvsFileName
();
...
...
@@ -137,4 +138,5 @@ public:
}
};
#endif // UNTITLED_CVS_TO_XML_H
#endif // AW_CXX_DISTRIBUTED_UTILS_CSV_TRANSFORM_XML_H_
aw/cxx/hwext/perf.cpp
浏览文件 @
92e608a0
...
...
@@ -32,8 +32,6 @@ namespace TestAW {
#define ID_LARGER_IS_BETTER true
#define ID_SMALLER_IS_BETTER false
#define _max(a,b) (((a)>=(b)) ? (a) : (b) )
#define _min(a,b) (((a)<=(b)) ? (a) : (b))
namespace
{
const
auto
XML_TAG_ROOT
=
"configuration"
;
...
...
@@ -182,7 +180,7 @@ GtestPerfTestCase::GtestPerfTestCase(BaseLineManager* pManager,
// get test case name from GTEST API.
// should be use tester->XXX() instead of this.
if
(
tester
!=
nullptr
)
{
if
(
tester
!=
nullptr
&&
::
testing
::
UnitTest
::
GetInstance
()
!=
nullptr
)
{
m_strCaseName
=
string
(
::
testing
::
UnitTest
::
GetInstance
()
->
current_test_info
()
->
name
());
}
...
...
@@ -284,11 +282,11 @@ bool GtestPerfTestCase::ExpectValue(double testValue, bool isLargerBetter)
}
else
{
double
baseValue
=
-
1
;
if
(
isLargerBetter
)
{
baseValue
=
_max
(
m_dbLastValue
,
m_dbBaseLine
)
;
baseValue
=
(
m_dbLastValue
>=
m_dbBaseLine
)
?
m_dbLastValue
:
m_dbBaseLine
;
EXPECT_GE
(
testValue
,
(
baseValue
*
(
1.0
-
m_dbFloatRange
)));
m_bTestResult
=
(
testValue
>=
(
baseValue
*
(
1.0
-
m_dbFloatRange
)))
?
true
:
false
;
}
else
{
baseValue
=
_min
(
m_dbLastValue
,
m_dbBaseLine
)
;
baseValue
=
(
m_dbLastValue
<=
m_dbBaseLine
)
?
m_dbLastValue
:
m_dbBaseLine
;
EXPECT_LE
(
testValue
,
(
baseValue
*
(
1.0
+
m_dbFloatRange
)));
m_bTestResult
=
(
testValue
<=
(
baseValue
*
(
1.0
+
m_dbFloatRange
)))
?
true
:
false
;
}
...
...
@@ -311,22 +309,22 @@ bool GtestPerfTestCase::SaveResult(double testValue)
INF_MSG
(
"[ PERF ] %s: baseline:%f, test_result: %f
\n
"
,
m_strCaseName
.
c_str
(),
m_dbBaseLine
,
testValue
);
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
(
void
)
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
if
(
snprintf_s
(
buffer
,
sizeof
(
buffer
),
sizeof
(
buffer
)
-
1
,
"%g"
,
m_dbBaseLine
)
>
0
)
{
m_pTester
->
RecordProperty
(
"baseline"
,
buffer
);
}
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
(
void
)
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
if
(
snprintf_s
(
buffer
,
sizeof
(
buffer
),
sizeof
(
buffer
)
-
1
,
"%d"
,
m_dCaseVersion
)
>
0
)
{
m_pTester
->
RecordProperty
(
"tc_version"
,
buffer
);
}
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
(
void
)
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
if
(
snprintf_s
(
buffer
,
sizeof
(
buffer
),
sizeof
(
buffer
)
-
1
,
"%g"
,
m_dbLastValue
)
>
0
)
{
m_pTester
->
RecordProperty
(
"lastvalue"
,
m_bHasLastValue
?
buffer
:
""
);
}
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
(
void
)
memset_s
(
buffer
,
sizeof
(
buffer
),
0
,
sizeof
(
buffer
));
if
(
snprintf_s
(
buffer
,
sizeof
(
buffer
),
sizeof
(
buffer
)
-
1
,
"%g"
,
testValue
)
>
0
)
{
m_pTester
->
RecordProperty
(
"value"
,
buffer
);
}
...
...
@@ -337,5 +335,5 @@ bool GtestPerfTestCase::SaveResult(double testValue)
return
true
;
}
}
// TestAW
}
// OHOS
\ No newline at end of file
}
// namespace TestAW
}
// namespace OHOS
aw/cxx/hwext/perf.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef
TEST_AW_CXX_HWEXT_PERF_H
#define
TEST_AW_CXX_HWEXT_PERF_H
#ifndef
AW_CXX_HWEXT_PERF_H_
#define
AW_CXX_HWEXT_PERF_H_
#include <string>
#include <list>
...
...
@@ -80,7 +80,7 @@ public:
std
::
string
testClassName
=
""
,
std
::
string
testInterfaceName
=
""
);
~
GtestPerfTestCase
()
{}
;
~
GtestPerfTestCase
()
{}
// expect result is larger than or equal baseline*(1.0-float_range).
bool
ExpectLarger
(
double
testValue
);
...
...
@@ -164,6 +164,7 @@ private:
bool
m_bTestResult
;
double
m_dbTestResult
;
};
}
// TestAW
}
// OHOS
#endif // TEST_AW_CXX_HWEXT_PERF_H
\ No newline at end of file
}
// namespace TestAW
}
// namespace OHOS
#endif // AW_CXX_HWEXT_PERF_H_
examples/calculator/test/fuzztest/common/parse_fuzzer/parse_fuzzer.cpp
浏览文件 @
92e608a0
...
...
@@ -25,6 +25,10 @@ const int FUZZ_FTH_DATA = 3;
namespace
OHOS
{
bool
DoSomethingInterestingWithMyAPI
(
const
uint8_t
*
data
,
size_t
size
)
{
if
(
data
==
nullptr
)
{
return
false
;
}
bool
result
=
false
;
if
(
size
>=
FUZZ_DATA_LEN
)
{
result
=
data
[
FUZZ_FST_DATA
]
==
'F'
&&
...
...
@@ -34,7 +38,7 @@ namespace OHOS {
}
return
result
;
}
}
}
// namespace.OHOS
/* Fuzzer entry point */
extern
"C"
int
LLVMFuzzerTestOneInput
(
const
uint8_t
*
data
,
size_t
size
)
...
...
examples/detector/src/detector.cpp
浏览文件 @
92e608a0
...
...
@@ -50,6 +50,9 @@ bool IsPrime(int n)
bool
FileExist
(
const
char
*
fileName
)
{
if
(
fileName
==
nullptr
)
{
return
false
;
}
struct
stat
myStat
;
return
(
!
stat
(
fileName
,
&
myStat
));
}
examples/distributedb/test/distributedtest/common/distribute_demo.cpp
浏览文件 @
92e608a0
...
...
@@ -45,11 +45,11 @@ public:
DistributeDemo
()
=
default
;
~
DistributeDemo
()
=
default
;
static
void
SetUpTestCase
(
void
)
{}
;
static
void
TearDownTestCase
(
void
)
{}
;
static
void
SetUpTestCase
(
void
)
{}
static
void
TearDownTestCase
(
void
)
{}
virtual
void
SetUp
()
{}
;
virtual
void
TearDown
()
{}
;
virtual
void
SetUp
()
{}
virtual
void
TearDown
()
{}
};
/**
...
...
@@ -252,4 +252,4 @@ int main(int argc, char *argv[])
testing
::
GTEST_FLAG
(
output
)
=
"xml:./"
;
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
\ No newline at end of file
}
examples/lite/c_demo/include/calc_multi.h
浏览文件 @
92e608a0
...
...
@@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef
SERVICEDEMO_CALC_MULTI_H
#define
SERVICEDEMO_CALC_MULTI_H
#ifndef
EXAMPLE_LITE_C_DEMO_INCLUDE_CALC_MULTI_H_
#define
EXAMPLE_LITE_C_DEMO_INCLUDE_CALC_MULTI_H_
#ifdef __cplusplus
#if __cplusplus
...
...
@@ -30,4 +30,4 @@ int calc_multi(int a, int b);
#endif
#endif
#endif //
SERVICEDEMO_CALC_MULTI_H
#endif //
EXAMPLE_LITE_C_DEMO_INCLUDE_CALC_MULTI_H_
examples/sleep/test/performance/common/spent_time_test.cpp
浏览文件 @
92e608a0
...
...
@@ -24,19 +24,19 @@ using namespace OHOS::TestAW;
static
BaseLineManager
m_baseline
(
PERF_BASELINE_CONFIG_PATH
);
class
SpentTimeTest
:
public
testing
::
Test
{
public:
static
void
SetUpTestCase
(
void
)
{}
;
static
void
TearDownTestCase
(
void
)
{}
;
void
SetUp
()
{}
;
void
TearDown
()
{}
;
static
void
SetUpTestCase
(
void
)
{}
static
void
TearDownTestCase
(
void
)
{}
void
SetUp
()
{}
void
TearDown
()
{}
};
static
void
LoopMsleep
(
void
*
pMsec
)
{
if
(
pMsec
==
NULL
)
{
if
(
pMsec
==
nullptr
)
{
return
;
}
int
msec
=
*
(
int
*
)
pMsec
;
int
msec
=
*
reinterpret_cast
<
int
*>
(
pMsec
)
;
for
(
int
index
=
0
;
index
<
msec
;
index
++
)
{
Msleep
(
1
);
}
...
...
libs/benchmark/README_zh.md
浏览文件 @
92e608a0
...
...
@@ -263,20 +263,20 @@ import("//build/test.gni")
module_output_path = "developertest/calculator"
ohos_
unittest("BenchmarkDemoTest") {
module_out_path = module_output_path
sources = [ "benchmark_demo_test.cpp" ]
ohos_
benchmarktest("BenchmarkDemoTest") {
module_out_path = module_output_path
sources = [ "benchmark_demo_test.cpp" ]
}
group("
unittest") {
testonly = true
deps = []
deps += [
# deps file
":BenchmarkDemoTest",
]
}
group("
benchmarktest") {
testonly = true
deps = []
deps += [
# deps file
":BenchmarkDemoTest",
]
}
```
详细内容如下:
...
...
@@ -315,9 +315,9 @@ group("unittest") {
4.
指定测试套名称
```
ohos_
unittest("BenchmarkDemoTest") { # benchmark测试编译模板
module_out_path = module_output_path
sources = [ "benchmark_demo_test.cpp" ]
# 指定测试用例文件
ohos_
benchmarktest("BenchmarkDemoTest") {
module_out_path = module_output_path
sources = [ "benchmark_demo_test.cpp" ]
}
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录