!85 adapt new cpp synx of struct init

From: @duguhaotian
Reviewed-by: @jingxiaolu
Signed-off-by: @jingxiaolu
This commit is contained in:
openeuler-ci-bot 2021-11-23 01:33:35 +00:00 committed by Gitee
commit d5b53e8882
4 changed files with 87 additions and 3 deletions

View File

@ -1,7 +1,7 @@
From 9911948a5806c6641d8c6a7ffe7cbe82da165917 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 22 Nov 2021 06:27:10 +0000
Subject: [PATCH 1/2] improve code for check ags
Subject: [PATCH 1/3] improve code for check ags
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -1,7 +1,7 @@
From 76386373577c70a3a302c6aaa48fd301ffb173b2 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 22 Nov 2021 06:27:29 +0000
Subject: [PATCH 2/2] improve coverage of ut
Subject: [PATCH 2/3] improve coverage of ut
Signed-off-by: haozi007 <liuhao27@huawei.com>
---

View File

@ -0,0 +1,77 @@
From 830b3ce91c04c6d6970e7564834720f3a1d57b80 Mon Sep 17 00:00:00 2001
From: haozi007 <liuhao27@huawei.com>
Date: Mon, 22 Nov 2021 11:32:00 +0000
Subject: [PATCH 3/3] support new cpp synx check
Signed-off-by: haozi007 <liuhao27@huawei.com>
---
tests/api_llt.cpp | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/tests/api_llt.cpp b/tests/api_llt.cpp
index 186c76b..5ea7c09 100644
--- a/tests/api_llt.cpp
+++ b/tests/api_llt.cpp
@@ -232,10 +232,13 @@ TEST(api_testcases, cni_add_network_list)
char netns[PATH_MAX] = {0x0};
char *err = NULL;
struct runtime_conf rc = {
- .container_id = (char *)"abcd",
- .netns = netns,
- .ifname = (char *)"eth0",
- .p_mapping_len = 1,
+ container_id: (char *)"abcd",
+ netns: netns,
+ ifname: (char *)"eth0",
+ args: nullptr,
+ args_len: 0,
+ p_mapping: nullptr,
+ p_mapping_len: 1,
};
struct result *pret = nullptr;
@@ -296,10 +299,13 @@ TEST(api_testcases, cni_add_network)
char netns[PATH_MAX] = {0x0};
char *err = NULL;
struct runtime_conf rc = {
- .container_id = (char *)"abcd",
- .netns = netns,
- .ifname = (char *)"eth0",
- .p_mapping_len = 1,
+ container_id: (char *)"abcd",
+ netns: netns,
+ ifname: (char *)"eth0",
+ args: nullptr,
+ args_len: 0,
+ p_mapping: nullptr,
+ p_mapping_len: 1,
};
struct result *pret = nullptr;
@@ -413,7 +419,6 @@ TEST(api_testcases, cni_conf_files)
int ret = 0;
char pwd_buf[PATH_MAX] = {0X0};
char *pwd = nullptr;
- char *paths[] = {pwd_buf, nullptr};
char *err = NULL;
const char *exts[] = {"json", "conf", "conflist"};
char **result = nullptr;
@@ -531,7 +536,6 @@ TEST(api_testcases, cni_conflist_from_file)
TEST(api_testcases, free_cni_port_mapping)
{
- int ret = 0;
struct cni_port_mapping *cpm = (struct cni_port_mapping *)malloc(sizeof(struct cni_port_mapping));
cpm->container_port = 80;
@@ -544,7 +548,6 @@ TEST(api_testcases, free_cni_port_mapping)
TEST(api_testcases, free_runtime_conf)
{
- int ret = 0;
struct runtime_conf *rc = (struct runtime_conf *)calloc(sizeof(struct runtime_conf), 1);
rc->ifname = strdup("eth0");
--
2.20.1

View File

@ -1,5 +1,5 @@
%global _version 2.0.6
%global _release 3
%global _release 4
Name: clibcni
Version: %{_version}
Release: %{_release}
@ -12,6 +12,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}
Patch0001: 0001-improve-code-for-check-ags.patch
Patch0002: 0002-improve-coverage-of-ut.patch
Patch0003: 0003-support-new-cpp-synx-check.patch
BuildRequires: gcc git gcc-c++
BuildRequires: cmake
@ -92,6 +93,12 @@ rm -rf %{buildroot}
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Tue Nov 23 2021 liuhao <liuhao27@huawei.com> - 2.0.6-4
- Type: enhancement
- ID: NA
- SUG: NA
- DESC: improve coverage of ut
* Mon Nov 22 2021 liuhao <liuhao27@huawei.com> - 2.0.6-3
- Type: enhancement
- ID: NA