Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9a69b872
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
12 个月 前同步成功
通知
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9a69b872
编写于
5月 19, 2021
作者:
G
Gloria Yin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ai engine testcase 20210519
Change-Id: Ia517f4ff89fd06e9e0484e931e8364945798b4c3
上级
33380dff
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
231 addition
and
739 deletion
+231
-739
ai_lite/ai_engine_posix/base/BUILD.gn
ai_lite/ai_engine_posix/base/BUILD.gn
+1
-0
ai_lite/ai_engine_posix/base/src/aie_client/AieClientAsyncProcessFunctionTest.cpp
...base/src/aie_client/AieClientAsyncProcessFunctionTest.cpp
+1
-76
ai_lite/ai_engine_posix/base/src/aie_client/AieClientDestroyFunctionTest.cpp
...osix/base/src/aie_client/AieClientDestroyFunctionTest.cpp
+1
-76
ai_lite/ai_engine_posix/base/src/aie_client/AieClientInitFunctionTest.cpp
...e_posix/base/src/aie_client/AieClientInitFunctionTest.cpp
+2
-51
ai_lite/ai_engine_posix/base/src/aie_client/AieClientPrepareFunctionTest.cpp
...osix/base/src/aie_client/AieClientPrepareFunctionTest.cpp
+2
-77
ai_lite/ai_engine_posix/base/src/aie_client/AieClientReleaseFunctionTest.cpp
...osix/base/src/aie_client/AieClientReleaseFunctionTest.cpp
+2
-77
ai_lite/ai_engine_posix/base/src/aie_client/AieClientSetOptionFunctionTest.cpp
...ix/base/src/aie_client/AieClientSetOptionFunctionTest.cpp
+2
-77
ai_lite/ai_engine_posix/base/src/aie_client/AieClientSyncProcessFunctionTest.cpp
.../base/src/aie_client/AieClientSyncProcessFunctionTest.cpp
+2
-77
ai_lite/ai_engine_posix/base/src/aie_client/AieClientSyncProcessShareMemoryFunctionTest.cpp
...ie_client/AieClientSyncProcessShareMemoryFunctionTest.cpp
+1
-122
ai_lite/ai_engine_posix/base/src/utils/aie_client_common.cpp
ai_lite/ai_engine_posix/base/src/utils/aie_client_common.cpp
+156
-0
ai_lite/ai_engine_posix/base/src/utils/aie_client_common.h
ai_lite/ai_engine_posix/base/src/utils/aie_client_common.h
+61
-0
ai_lite/ai_engine_posix/base/src/utils/aie_client_perf_baseline.h
...ai_engine_posix/base/src/utils/aie_client_perf_baseline.h
+0
-106
未找到文件。
ai_lite/ai_engine_posix/base/BUILD.gn
浏览文件 @
9a69b872
...
...
@@ -17,6 +17,7 @@ hcpptest_suite("ActsAiEngineTest") {
suite_name = "acts"
sources = [
# Utils files
"src/utils/aie_client_common.cpp",
"src/utils/utils.cpp",
# AieClient Function Test Cases
...
...
ai_lite/ai_engine_posix/base/src/aie_client/AieClientAsyncProcessFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -24,6 +24,7 @@
#include "protocol/struct_definition/aie_info_define.h"
#include "server_executor/include/server_executor.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/aie_macros.h"
#include "utils/log/aie_log.h"
...
...
@@ -40,82 +41,6 @@ namespace {
class
AieClientAsyncProcessFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Tests AieClientAsyncProcess().
*
...
...
ai_lite/ai_engine_posix/base/src/aie_client/AieClientDestroyFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -20,6 +20,7 @@
#include "client_executor/include/i_aie_client.inl"
#include "protocol/struct_definition/aie_info_define.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/log/aie_log.h"
#include "utils/service_dead_cb.h"
...
...
@@ -31,82 +32,6 @@ using namespace OHOS::AI;
class
AieClientDestroyFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Tests AieClientDestroy. Invoke sequence: AieClientInit-AieClientPrepare-AieClientSyncProcess/AieClientAsyncProcess
* -AieClientRelease-AieClientDestroy.
...
...
ai_lite/ai_engine_posix/base/src/aie_client/AieClientInitFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -20,6 +20,7 @@
#include <string>
#include "client_executor/include/i_aie_client.inl"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/service_dead_cb.h"
#include "utils/utils.h"
...
...
@@ -35,56 +36,6 @@ namespace {
class
AieClientInitFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
,
const
char
*
description
)
{
configInfo
=
{.
description
=
description
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Tests AieClientInit.
*
...
...
@@ -96,7 +47,7 @@ static void TestAieClientInit(const char *configDesc, bool isAsync, bool isDeadC
{
// Step 0: Defines variables.
ConfigInfo
configInfo
;
GetConfigInfo
(
configInfo
,
configDesc
);
GetConfigInfo
2
(
configInfo
,
configDesc
);
ClientInfo
clientInfo
;
GetClientInfo
(
clientInfo
);
...
...
ai_lite/ai_engine_posix/base/src/aie_client/AieClientPrepareFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -21,6 +21,7 @@
#include "protocol/retcode_inner/aie_retcode_inner.h"
#include "server_executor/include/server_executor.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/aie_macros.h"
#include "utils/constants/constants.h"
...
...
@@ -34,82 +35,6 @@ using namespace OHOS::AI;
class
AieClientPrepareFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Tests the input parameters algorithmInfo and inputInfo in AieClientPrepare().
*
...
...
@@ -278,4 +203,4 @@ HWTEST_F(AieClientPrepareFunctionTest, testAieClientPrepareFunction0204, Functio
{
HILOGI
(
"[Test]testAieClientPrepareFunction0204."
);
TestAieClientPrepare
(
true
,
true
,
true
,
false
,
false
);
}
}
\ No newline at end of file
ai_lite/ai_engine_posix/base/src/aie_client/AieClientReleaseFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -20,6 +20,7 @@
#include "client_executor/include/i_aie_client.inl"
#include "protocol/struct_definition/aie_info_define.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/log/aie_log.h"
#include "utils/service_dead_cb.h"
...
...
@@ -31,82 +32,6 @@ using namespace OHOS::AI;
class
AieClientReleaseFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Tests AieClientRelease.
* Invoke sequence: AieClientInit-AieClientPrepare-AieClientSyncProcess/AieClientAsyncProcess-AieClientRelease.
...
...
@@ -227,4 +152,4 @@ HWTEST_F(AieClientReleaseFunctionTest, testAieClientReleaseFunction004, Function
{
HILOGI
(
"[Test]testAieClientReleaseFunction004."
);
TestAieClientRelease
(
true
,
true
);
}
}
\ No newline at end of file
ai_lite/ai_engine_posix/base/src/aie_client/AieClientSetOptionFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -20,6 +20,7 @@
#include "client_executor/include/i_aie_client.inl"
#include "protocol/retcode_inner/aie_retcode_inner.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/aie_macros.h"
#include "utils/log/aie_log.h"
...
...
@@ -39,82 +40,6 @@ namespace {
class
AieClientSetOptionFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
INT_LENGTH
),
.
requestId
=
GetRandomInt
(
INT_LENGTH
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Tests TestAieClientSetOption.
* Invoke sequence: AieClientInit-AieClientPrepare-AieClientSetOption-AieClientGetOption.
...
...
@@ -327,4 +252,4 @@ HWTEST_F(AieClientSetOptionFunctionTest, testAieClientSetOptionFunction0202, Fun
HILOGI
(
"[Test]testAieClientSetOptionFunction0202."
);
bool
isAsync
=
GetRandomBool
();
TestAieClientSetOptionWithoutPrepare
(
isAsync
,
false
);
}
}
\ No newline at end of file
ai_lite/ai_engine_posix/base/src/aie_client/AieClientSyncProcessFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -20,6 +20,7 @@
#include "client_executor/include/i_aie_client.inl"
#include "platform/time/include/time.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/log/aie_log.h"
#include "utils/service_dead_cb.h"
...
...
@@ -35,82 +36,6 @@ namespace {
class
AieClientSyncProcessFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Tests AieClientSyncProcess().
*
...
...
@@ -215,4 +140,4 @@ HWTEST_F(AieClientSyncProcessFunctionTest, testAieClientSyncProcessFunction0201,
HILOGI
(
"[Test]testAieClientSyncProcessFunction0201."
);
bool
isSyncProcessInputInfoNull
=
GetRandomBool
();
TestAieClientSyncProcess
(
true
,
isSyncProcessInputInfoNull
,
false
,
false
);
}
}
\ No newline at end of file
ai_lite/ai_engine_posix/base/src/aie_client/AieClientSyncProcessShareMemoryFunctionTest.cpp
浏览文件 @
9a69b872
...
...
@@ -20,6 +20,7 @@
#include "client_executor/include/i_aie_client.inl"
#include "platform/time/include/time.h"
#include "utils/aie_client_callback.h"
#include "utils/aie_client_common.h"
#include "utils/aie_client_const.h"
#include "utils/log/aie_log.h"
#include "utils/service_dead_cb.h"
...
...
@@ -31,132 +32,10 @@ using namespace OHOS::AI;
namespace
{
const
int
WAIT_CALLBACK_TIME_MS
=
2000
;
const
int
INT_1
=
1
;
const
int
INT_2
=
2
;
const
int
INT_1024
=
1024
;
}
class
AieClientSyncProcessShareMemoryFunctionTest
:
public
testing
::
Test
{};
/**
* Constructs ConfigInfo parameters.
*/
static
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ClientInfo parameters.
*/
static
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
static
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
65535
),
.
requestId
=
GetRandomInt
(
65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
static
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Constructs DataInfo with a big length data.
*/
static
DataInfo
GetBigDataInfo
(
bool
isDataInfoNull
=
true
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
#ifdef __LINUX__
int
length
=
INT_2
*
INT_1024
*
INT_1024
;
// 2 MB long data, the unit is Byte here.
#else // liteos device has no enough remaining memory to contain 2MB long data.
int
length
=
INT_1
*
INT_1024
*
INT_1024
;
// 1 MB long data, the unit is Byte here.
#endif
char
*
data
=
reinterpret_cast
<
char
*>
(
malloc
(
length
));
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Release DataInfo.
*/
static
void
FreeDataInfo
(
DataInfo
&
dataInfo
)
{
if
(
dataInfo
.
data
!=
nullptr
)
{
free
(
dataInfo
.
data
);
dataInfo
.
data
=
nullptr
;
dataInfo
.
length
=
0
;
}
}
/**
* Tests AieClientSyncProcess().
*
...
...
ai_lite/ai_engine_posix/base/src/utils/aie_client_common.cpp
0 → 100644
浏览文件 @
9a69b872
/*
* Copyright (C) 2021 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 <cstring>
#include "client_executor/include/i_aie_client.inl"
#include "utils/aie_client_const.h"
#include "utils/log/aie_log.h"
#include "utils/utils.h"
using
namespace
OHOS
::
AI
;
namespace
{
const
int
INT_1
=
1
;
const
int
INT_2
=
2
;
const
int
INT_1024
=
1024
;
const
int
INT_65535
=
65535
;
}
/**
* Constructs ConfigInfo parameters.
*/
void
GetConfigInfo
(
ConfigInfo
&
configInfo
)
{
configInfo
=
{.
description
=
CONFIG_DESCRIPTION
};
}
/**
* Constructs ConfigInfo parameters,including specified description.
*/
void
GetConfigInfo2
(
ConfigInfo
&
configInfo
,
const
char
*
description
)
{
configInfo
=
{.
description
=
description
};
}
/**
* Constructs ClientInfo parameters.
*/
void
GetClientInfo
(
ClientInfo
&
clientInfo
)
{
const
char
*
str
=
CLIENT_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
len
=
strlen
(
str
)
+
1
;
clientInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
clientId
=
INVALID_CLIENT_ID
,
.
sessionId
=
INVALID_SESSION_ID
,
.
serverUid
=
INVALID_UID
,
.
clientUid
=
INVALID_UID
,
.
extendLen
=
len
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs AlgorithmInfo parameters.
*/
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
)
{
const
char
*
str
=
ALGORITHM_EXTEND_MSG
;
char
*
extendMsg
=
const_cast
<
char
*>
(
str
);
int
extendLen
=
strlen
(
str
)
+
1
;
algorithmInfo
=
{
.
clientVersion
=
CLIENT_VERSION_VALID
,
.
isAsync
=
isAsync
,
.
algorithmType
=
algorithmType
,
.
algorithmVersion
=
ALGORITHM_VERSION_VALID
,
.
isCloud
=
GetRandomBool
(),
.
operateId
=
GetRandomInt
(
INT_65535
),
.
requestId
=
GetRandomInt
(
INT_65535
),
.
extendLen
=
extendLen
,
.
extendMsg
=
(
unsigned
char
*
)
extendMsg
,
};
}
/**
* Constructs DataInfo.
*/
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
const
char
*
str
=
dataString
;
char
*
data
=
const_cast
<
char
*>
(
str
);
int
length
=
strlen
(
str
)
+
1
;
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Constructs DataInfo with a big length data.
*/
DataInfo
GetBigDataInfo
(
bool
isDataInfoNull
=
true
)
{
// Sets default dataInfo to null.
DataInfo
dataInfo
=
{
.
data
=
nullptr
,
.
length
=
0
,
};
// Sets dataInfo to specified value.
if
(
!
isDataInfoNull
)
{
#ifdef __LINUX__
int
length
=
INT_2
*
INT_1024
*
INT_1024
;
// 2 MB long data, the unit is Byte here.
#else // liteos device has no enough remaining memory to contain 2MB long data.
int
length
=
INT_1
*
INT_1024
*
INT_1024
;
// 1 MB long data, the unit is Byte here.
#endif
char
*
data
=
reinterpret_cast
<
char
*>
(
malloc
(
length
));
dataInfo
=
{
.
data
=
reinterpret_cast
<
unsigned
char
*>
(
data
),
.
length
=
length
,
};
}
return
dataInfo
;
}
/**
* Release DataInfo.
*/
void
FreeDataInfo
(
DataInfo
&
dataInfo
)
{
if
(
dataInfo
.
data
!=
nullptr
)
{
free
(
dataInfo
.
data
);
dataInfo
.
data
=
nullptr
;
dataInfo
.
length
=
0
;
}
}
\ No newline at end of file
ai_lite/ai_engine_posix/base/src/utils/aie_client_common.h
0 → 100644
浏览文件 @
9a69b872
/*
* Copyright (C) 2021 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 AIE_CLIENT_COMMON_H
#define AIE_CLIENT_COMMON_H
#include <cstring>
#include "client_executor/include/i_aie_client.inl"
#include "utils/aie_client_const.h"
#include "utils/log/aie_log.h"
#include "utils/utils.h"
/**
* Constructs ConfigInfo parameters.
*/
void
GetConfigInfo
(
ConfigInfo
&
configInfo
);
/**
* Constructs ConfigInfo parameters,including specified description.
*/
void
GetConfigInfo2
(
ConfigInfo
&
configInfo
,
const
char
*
description
);
/**
* Constructs ClientInfo parameters.
*/
void
GetClientInfo
(
ClientInfo
&
clientInfo
);
/**
* Constructs AlgorithmInfo parameters.
*/
void
GetSyncAlgorithmInfo
(
AlgorithmInfo
&
algorithmInfo
,
bool
isAsync
,
int
algorithmType
);
/**
* Constructs DataInfo.
*/
DataInfo
GetDataInfo
(
bool
isDataInfoNull
=
true
,
const
char
*
dataString
=
DATA_INFO_DEFAULT
);
/**
* Constructs DataInfo with a big length data.
*/
DataInfo
GetBigDataInfo
(
bool
isDataInfoNull
=
true
);
/**
* Release DataInfo.
*/
void
FreeDataInfo
(
DataInfo
&
dataInfo
);
#endif
\ No newline at end of file
ai_lite/ai_engine_posix/base/src/utils/aie_client_perf_baseline.h
已删除
100644 → 0
浏览文件 @
33380dff
/*
* Copyright (C) 2021 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 AIE_CLIENT_PERF_BASELINE_H
#define AIE_CLIENT_PERF_BASELINE_H
#include <iostream>
namespace
AI_ENGINE_TEST
{
/**
* Configures which type of device to be test.
*/
const
int
DEVICE_TYPE_L1
=
1
;
const
int
DEVICE_TYPE_L2
=
2
;
const
int
DEVICE_TYPE
=
DEVICE_TYPE_L1
;
/**
* PerfBaseline to test.
*/
struct
PerfBaseline
{
int
T01
;
// us, AieClientInit
int
T02
;
// us, AieClientPrepare
int
T03
;
// us, AieClientASyncProcess
int
T04
;
// us, AieClientSyncProcess
int
T05
;
// us, AieClientRelease
int
T06
;
// us, AieClientDestroy
int
T07
;
// us, AieClientSetOption
int
T08
;
// us, AieClientGetOption
};
const
int
PERF_BASELINE_L1_AIE_CLIENT_INIT
=
100000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_PREPARE
=
300000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_ASYNC_PROCESS
=
150000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_SYNC_PROCESS
=
100000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_RELEASE
=
300000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_DESTROY
=
100000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_SET_OPTION
=
100000
;
const
int
PERF_BASELINE_L1_AIE_CLIENT_GET_OPTION
=
100000
;
PerfBaseline
L1
=
{
.
T01
=
PERF_BASELINE_L1_AIE_CLIENT_INIT
,
// us, AieClientInit
.
T02
=
PERF_BASELINE_L1_AIE_CLIENT_PREPARE
,
// us, AieClientPrepare
.
T03
=
PERF_BASELINE_L1_AIE_CLIENT_ASYNC_PROCESS
,
// us, AieClientASyncProcess
.
T04
=
PERF_BASELINE_L1_AIE_CLIENT_SYNC_PROCESS
,
// us, AieClientSyncProcess
.
T05
=
PERF_BASELINE_L1_AIE_CLIENT_RELEASE
,
// us, AieClientRelease
.
T06
=
PERF_BASELINE_L1_AIE_CLIENT_DESTROY
,
// us, AieClientDestroy
.
T07
=
PERF_BASELINE_L1_AIE_CLIENT_SET_OPTION
,
// us, AieClientSetOption
.
T08
=
PERF_BASELINE_L1_AIE_CLIENT_GET_OPTION
,
// us, AieClientGetOption
};
const
int
PERF_BASELINE_L2_AIE_CLIENT_INIT
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_PREPARE
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_ASYNC_PROCESS
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_SYNC_PROCESS
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_RELEASE
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_DESTROY
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_SET_OPTION
=
500
;
const
int
PERF_BASELINE_L2_AIE_CLIENT_GET_OPTION
=
500
;
PerfBaseline
L2
=
{
.
T01
=
PERF_BASELINE_L2_AIE_CLIENT_INIT
,
// us, AieClientInit
.
T02
=
PERF_BASELINE_L2_AIE_CLIENT_PREPARE
,
// us, AieClientPrepare
.
T03
=
PERF_BASELINE_L2_AIE_CLIENT_ASYNC_PROCESS
,
// us, AieClientASyncProcess
.
T04
=
PERF_BASELINE_L2_AIE_CLIENT_SYNC_PROCESS
,
// us, AieClientSyncProcess
.
T05
=
PERF_BASELINE_L2_AIE_CLIENT_RELEASE
,
// us, AieClientRelease
.
T06
=
PERF_BASELINE_L2_AIE_CLIENT_DESTROY
,
// us, AieClientDestroy
.
T07
=
PERF_BASELINE_L2_AIE_CLIENT_SET_OPTION
,
// us, AieClientSetOption
.
T08
=
PERF_BASELINE_L2_AIE_CLIENT_GET_OPTION
,
// us, AieClientGetOption
};
/**
* Gets Performance BaseLine according to deviceType.
*/
PerfBaseline
GetPerformanceBaseLine
(
int
deviceType
)
{
PerfBaseline
aieClientPerfBase
;
switch
(
deviceType
)
{
case
DEVICE_TYPE_L1
:
{
aieClientPerfBase
=
L1
;
break
;
}
case
DEVICE_TYPE_L2
:
{
aieClientPerfBase
=
L2
;
break
;
}
default:
{
aieClientPerfBase
=
L1
;
break
;
}
}
return
aieClientPerfBase
;
}
}
#endif // AIE_CLIENT_PERF_BASELINE_H
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录