Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6d055a04
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看板
提交
6d055a04
编写于
4月 29, 2021
作者:
O
openharmony_ci
提交者:
Gitee
4月 29, 2021
浏览文件
操作
浏览文件
下载
差异文件
!170 升级子系统 L1 XTS用例上库
Merge pull request !170 from 白国栋/update_lite_20210428
上级
743fd759
3cd2e7a0
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
235 addition
and
0 deletion
+235
-0
update_lite/updater_posix/BUILD.gn
update_lite/updater_posix/BUILD.gn
+36
-0
update_lite/updater_posix/Test.json
update_lite/updater_posix/Test.json
+26
-0
update_lite/updater_posix/src/UpdateTest.cpp
update_lite/updater_posix/src/UpdateTest.cpp
+173
-0
未找到文件。
update_lite/updater_posix/BUILD.gn
0 → 100755
浏览文件 @
6d055a04
# 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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsUpdateTest") {
suite_name = "acts"
sources = [ "src/UpdateTest.cpp" ]
include_dirs = [
"//base/update/ota_lite/interfaces/kits",
"//base/update/ota_lite/hals",
"//utils/native/lite/include",
]
deps = [
"$ohos_third_party_dir/mbedtls:mbedtls_static",
"//base/update/ota_lite/frameworks/source:hota",
]
cflags = [ "-Wno-error" ]
ldflags = [
"-lstdc++",
"-lm",
"-lpthread",
]
}
update_lite/updater_posix/Test.json
0 → 100755
浏览文件 @
6d055a04
{
"description"
:
"Config for kernel_lite test cases"
,
"environment"
:
[
{
"type"
:
"device"
,
"label"
:
"ipcamera"
}
],
"kits"
:
[
{
"type"
:
"MountKit"
,
"server"
:
"NfsServer"
,
"mount"
:
[
{
"source"
:
"testcases/update"
,
"target"
:
"/test_root/update"
}
]
}
],
"driver"
:
{
"type"
:
"CppTestLite"
,
"execute"
:
"/test_root/update/ActsUpdateTest.bin"
}
}
update_lite/updater_posix/src/UpdateTest.cpp
0 → 100755
浏览文件 @
6d055a04
/*
* 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 <stdio.h>
#include "gtest/gtest.h"
#include "hota_updater.h"
#include "ohos_types.h"
#define ERRORCALLBACK 0
#define STATUSCALLBACK 0
#define USE_HOS_PKG 1
#define NOT_HOS_PKG 0
#define ERR_PAK_FALG 2
#define DATA_LENGTH 190
#define READ_LENGTH 0
#define ERR_LENGTH 9
#define DATA_OFFSET 0
using
namespace
std
;
using
namespace
testing
::
ext
;
class
UpdateTest
:
public
testing
::
Test
{
protected:
static
void
SetUpTestCase
(
void
)
{}
static
void
TearDownTestCase
(
void
)
{}
virtual
void
SetUp
()
{}
virtual
void
TearDown
()
{}
};
/**
* @tc.number : SUB_Upgrade_API_0100
* @tc.name : Initializes the OTA module
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI0100
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
ret
=
HotaInit
(
ERRORCALLBACK
,
STATUSCALLBACK
);
printf
(
"HotaInit return = %d
\r\n
"
,
ret
);
EXPECT_EQ
(
OHOS_SUCCESS
,
ret
);
};
/**
* @tc.number : SUB_Upgrade_API_0200
* @tc.name : Sets the switch for using the default upgrade package format
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI0200
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
ret
=
HotaSetPackageType
(
USE_HOS_PKG
);
printf
(
"use package flag = %d
\r\n
, return = %d
\r\n
"
,
USE_HOS_PKG
,
ret
);
EXPECT_EQ
(
OHOS_SUCCESS
,
ret
);
};
/**
* @tc.number : SUB_Upgrade_API_0300
* @tc.name : Sets the switch for using the non default upgrade package format
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI0300
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
ret
=
HotaSetPackageType
(
NOT_HOS_PKG
);
printf
(
"use package flag = %d
\r\n
, return = %d
\r\n
"
,
NOT_HOS_PKG
,
ret
);
EXPECT_EQ
(
OHOS_SUCCESS
,
ret
);
};
/**
* @tc.number : SUB_Upgrade_API_0400
* @tc.name : Sets the switch for using the default upgrade package format fail
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI0400
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
ret
=
HotaSetPackageType
(
ERR_PAK_FALG
);
printf
(
"use package flag = %d, return = %d
\r\n
"
,
ERR_PAK_FALG
,
ret
);
EXPECT_EQ
(
OHOS_FAILURE
,
ret
);
};
/**
* @tc.number : SUB_Upgrade_API_0500
* @tc.name : Obtains the index of the A or B partition to be upgraded
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI0500
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
unsigned
int
index
=
0
;
ret
=
HotaGetUpdateIndex
(
&
index
);
printf
(
"index = %d
\r\n
, get index return = %d
\r\n
"
,
index
,
ret
);
EXPECT_EQ
(
OHOS_SUCCESS
,
ret
);
};
/**
* @tc.number : SUB_Upgrade_API_0600
* @tc.name : Set upgrade status
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI0600
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
ret
=
HotaSetBootSettings
();
printf
(
"HotaSetBootSettings return = %d
\r\n
"
,
ret
);
EXPECT_EQ
(
OHOS_SUCCESS
,
ret
);
};
/**
* @tc.number : SUB_Upgrade_API_1000
* @tc.name : Writes specified data into flash memory fail
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI1000
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
unsigned
int
index
=
0
;
ret
=
HotaGetUpdateIndex
(
&
index
);
printf
(
"index = %d, get index return = %d
\r\n
"
,
index
,
ret
);
ret
=
HotaSetPackageType
(
USE_HOS_PKG
);
printf
(
"use package flag = %d
\r\n
, return = %d
\r\n
"
,
USE_HOS_PKG
,
ret
);
unsigned
char
buffer
[
DATA_LENGTH
]
=
{
0
};
ret
=
HotaWrite
(
buffer
,
DATA_OFFSET
,
DATA_LENGTH
);
printf
(
"Hota write return =%d
\r\n
"
,
ret
);
EXPECT_EQ
(
OHOS_FAILURE
,
ret
);
HotaCancel
();
};
/**
* @tc.number : SUB_Upgrade_API_1100
* @tc.name : Reads the data that has been written into flash memory fail
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI1100
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
unsigned
int
index
=
0
;
unsigned
char
buffer
[
DATA_LENGTH
]
=
{
0
};
unsigned
char
bufferread
[
DATA_LENGTH
]
=
{
0
};
HotaGetUpdateIndex
(
&
index
);
HotaSetPackageType
(
USE_HOS_PKG
);
HotaWrite
(
buffer
,
DATA_OFFSET
,
DATA_LENGTH
);
ret
=
HotaRead
(
DATA_OFFSET
,
DATA_LENGTH
,
bufferread
);
printf
(
"Hota read return =%d
\r\n
"
,
ret
);
EXPECT_EQ
(
OHOS_FAILURE
,
ret
);
HotaCancel
();
};
/**
* @tc.number : SUB_Upgrade_API_1200
* @tc.name : Cancels an upgrade fail
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
UpdateTest
,
subUpgradeAPI1200
,
Function
|
MediumTest
|
Level1
)
{
unsigned
int
ret
;
ret
=
HotaCancel
();
printf
(
"Hota Cancel return = %d
\r\n
"
,
ret
);
EXPECT_EQ
(
OHOS_SUCCESS
,
ret
);
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录