提交 01a34e2e 编写于 作者: O openeuler-ci-bot 提交者: Gitee

!687 fix dt testcase coding style

Merge pull request !687 from JingWoo/master
......@@ -25,7 +25,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/client/connect/isula_connect.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cmd/isula/extend/pause.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/grpc_client_mock.cc
pause_ut.cpp)
pause_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -25,7 +25,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/client/connect/isula_connect.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cmd/isula/extend/resume.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/grpc_client_mock.cc
resume_ut.cpp)
resume_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -26,7 +26,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/client/connect/isula_connect.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cmd/isula/information/info.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/grpc_client_mock.cc
info_ut.cpp)
info_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -25,7 +25,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/client/connect/isula_connect.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/cmd/isula/information/ps.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/grpc_client_mock.cc
ps_ut.cpp)
ps_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -6,7 +6,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/isulad-shim/process.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/isulad-shim/common.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/isulad-shim/terminal.c
isulad-shim_ut.cpp)
isulad-shim_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -14,7 +14,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/map.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/rb_tree.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/path.c
utils_array_ut.cpp)
utils_array_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -15,7 +15,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/path.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/map.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/rb_tree.c
utils_base64_ut.cpp)
utils_base64_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -21,14 +21,16 @@
TEST(utils_base64, test_util_base64)
{
char *plain_text = (char*)"^cvdgfdgghaswere3575676y&*`~cx,xfdgdvcvdfd][';./?.,<>|\\!@#$%^&*()_+=-090wvvs3sdfel33cxvdf***$";
char *plain_text = (char*)
"^cvdgfdgghaswere3575676y&*`~cx,xfdgdvcvdfd][';./?.,<>|\\!@#$%^&*()_+=-090wvvs3sdfel33cxvdf***$";
char *encoded = NULL;
char *decoded = NULL;
size_t decoded_len = 0;
// check long base64 encode/decode
ASSERT_EQ(util_base64_encode((unsigned char*)plain_text, strlen(plain_text), &encoded), 0);
ASSERT_STREQ(encoded, "XmN2ZGdmZGdnaGFzd2VyZTM1NzU2NzZ5JipgfmN4LHhmZGdkdmN2ZGZkXVsnOy4vPy4sPD58XCFAIyQlXiYqKClfKz0tMDkwd3Z2czNzZGZlbDMzY3h2ZGYqKiok");
ASSERT_STREQ(encoded,
"XmN2ZGdmZGdnaGFzd2VyZTM1NzU2NzZ5JipgfmN4LHhmZGdkdmN2ZGZkXVsnOy4vPy4sPD58XCFAIyQlXiYqKClfKz0tMDkwd3Z2czNzZGZlbDMzY3h2ZGYqKiok");
ASSERT_EQ(util_base64_decode((const char*)encoded, strlen(encoded), (unsigned char**)&decoded, &decoded_len), 0);
ASSERT_STREQ(decoded, plain_text);
ASSERT_EQ(strlen(plain_text), decoded_len);
......
......@@ -14,7 +14,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/map.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/rb_tree.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/path.c
utils_convert_ut.cpp)
utils_convert_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -14,7 +14,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/path.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/map.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/utils/cutils/map/rb_tree.c
utils_string_ut.cpp)
utils_string_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -18,9 +18,9 @@ SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
SET(EXE0 im_oci_image_exist_fuzz)
SET(EXE1 im_config_image_exist_fuzz)
SET(EXE2 im_get_image_count_fuzz)
add_executable(${EXE0} im_oci_image_exist_fuzz.cpp)
add_executable(${EXE1} im_config_image_exist_fuzz.cpp)
add_executable(${EXE2} im_get_image_count_fuzz.cpp)
add_executable(${EXE0} im_oci_image_exist_fuzz.cc)
add_executable(${EXE1} im_config_image_exist_fuzz.cc)
add_executable(${EXE2} im_get_image_count_fuzz.cc)
SET(IMAGE_FUZZ_INCLUDE_DIRS
${GTEST_INCLUDE_DIR}
......
......@@ -22,13 +22,13 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/common/sysinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/cmd/command_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/config/daemon_arguments.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/image/oci/oci_ut_common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/image/oci/oci_ut_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/containers_store_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/namespace_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/container_unix_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/modules/spec//specs_mount.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../test/mocks/selinux_label_mock.cc
oci_config_merge_ut.cpp)
oci_config_merge_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -37,7 +37,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/storage_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/oci_image_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/http_mock.cc
registry_ut.cpp)
registry_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -70,7 +70,6 @@ std::string get_dir()
}
return static_cast<std::string>(abs_path) + "../../../../../test/image/oci/registry";
return static_cast<std::string>(abs_path);
}
class RegistryUnitTest : public testing::Test {
......@@ -104,45 +103,45 @@ int invokeHttpRequestV1(const char *url, struct http_get_options *options, long
std::string data_path = get_dir() + "/data/v1/";
if (!strcmp(url, "https://quay.io/v2/")) {
ping_count++;
if (ping_count == 1) {
file = data_path + "ping_head1";
} else {
file = data_path + "ping_head";
}
if (ping_count == 1) {
file = data_path + "ping_head1";
} else {
file = data_path + "ping_head";
}
} else if (!strcmp(url, "https://quay.io/v2/coreos/etcd/manifests/v3.3.17-arm64")) {
file = data_path + "manifest";
file = data_path + "manifest";
} else if (util_has_prefix(url, "https://auth.quay.io")) {
token_count++;
if (token_count == 2) {
file = data_path + "token_body2";
} else {
file = data_path + "token_body";
}
token_count++;
if (token_count == 2) {
file = data_path + "token_body2";
} else {
file = data_path + "token_body";
}
} else if (util_has_prefix(url, "https://quay.io/v2/coreos/etcd/blobs/sha256")) {
file = std::string("");
file = std::string("");
} else {
ERROR("%s not match failed", url);
return -1;
ERROR("%s not match failed", url);
return -1;
}
if (file == std::string("")) {
data = util_strdup_s("test");
data = util_strdup_s("test");
} else {
data = util_read_text_file(file.c_str());
if (data == NULL) {
ERROR("read file %s failed", file.c_str());
return -1;
}
data = util_read_text_file(file.c_str());
if (data == NULL) {
ERROR("read file %s failed", file.c_str());
return -1;
}
}
if (options->outputtype == HTTP_REQUEST_STRBUF) {
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
} else {
if (util_write_file((const char *)options->output, data, strlen(data), 0600) != 0) {
free(data);
ERROR("write file %s failed", (char *)options->output);
return -1;
}
if (util_write_file((const char *)options->output, data, strlen(data), 0600) != 0) {
free(data);
ERROR("write file %s failed", (char *)options->output);
return -1;
}
}
free(data);
......@@ -163,75 +162,75 @@ int invokeHttpRequestV2(const char *url, struct http_get_options *options, long
// Test insecure registry, assume registry cann't support https.
if (util_has_prefix(url, "https://")) {
return -1;
return -1;
}
std::string data_path = get_dir() + "/data/v2/";
if (!strcmp(url, "http://hub-mirror.c.163.com/v2/")) {
count++;
file = data_path + "ping_head";
count++;
file = data_path + "ping_head";
} else if (!strcmp(url, "http://hub-mirror.c.163.com/v2/library/busybox/manifests/latest")) {
// test not found
if (count == COUNT_TEST_NOT_FOUND) {
file = data_path + "manifest_404";
} else {
file = data_path + "manifest_list";
}
// test not found
if (count == COUNT_TEST_NOT_FOUND) {
file = data_path + "manifest_404";
} else {
file = data_path + "manifest_list";
}
} else if (util_has_prefix(url, "http://hub-mirror.c.163.com/v2/library/busybox/manifests/sha256:2131f09e")) {
file = data_path + "manifest_body";
file = data_path + "manifest_body";
} else if (util_has_prefix(url, "http://hub-mirror.c.163.com/v2/library/busybox/blobs/sha256:c7c37e47")) {
file = data_path + "config";
if (count == COUNT_TEST_CANCEL) {
bool *cancel = (bool*)options->progressinfo;
while (!(*cancel)) {
sleep(1); // schedule out to let cancel variable set to be true
}
if (options->progress_info_op(options->progressinfo, 0, 0, 0, 0) != 0) {
file = data_path + "config";
if (count == COUNT_TEST_CANCEL) {
bool *cancel = (bool*)options->progressinfo;
while (!(*cancel)) {
sleep(1); // schedule out to let cancel variable set to be true
}
if (options->progress_info_op(options->progressinfo, 0, 0, 0, 0) != 0) {
return -1;
}
}
}
}
} else if (util_has_prefix(url, "http://hub-mirror.c.163.com/v2/library/busybox/blobs/sha256:91f30d77")) {
if (retry) {
retry = false;
options->errcode = CURLE_RANGE_ERROR;
return -1;
}
// test cancel
if (count == COUNT_TEST_CANCEL) {
return -1;
}
// test server error
if (count == COUNT_TEST_SERVER_ERROR) {
file = data_path + "0_server_error";
} else {
file = data_path + "0";
}
if (retry) {
retry = false;
options->errcode = CURLE_RANGE_ERROR;
return -1;
}
// test cancel
if (count == COUNT_TEST_CANCEL) {
return -1;
}
// test server error
if (count == COUNT_TEST_SERVER_ERROR) {
file = data_path + "0_server_error";
} else {
file = data_path + "0";
}
} else {
ERROR("%s not match failed", url);
return -1;
ERROR("%s not match failed", url);
return -1;
}
size = util_file_size(file.c_str());
if (size < 0) {
ERROR("get file %s size failed", file.c_str());
return -1;
ERROR("get file %s size failed", file.c_str());
return -1;
}
data = util_read_text_file(file.c_str());
if (data == NULL) {
ERROR("read file %s failed", file.c_str());
return -1;
ERROR("read file %s failed", file.c_str());
return -1;
}
if (options->outputtype == HTTP_REQUEST_STRBUF) {
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
} else {
if (util_write_file((const char *)options->output, data, size, 0600) != 0) {
free(data);
ERROR("write file %s failed", (char *)options->output);
return -1;
}
if (util_write_file((const char *)options->output, data, size, 0600) != 0) {
free(data);
ERROR("write file %s failed", (char *)options->output);
return -1;
}
}
free(data);
......@@ -247,41 +246,41 @@ int invokeHttpRequestOCI(const char *url, struct http_get_options *options, long
std::string data_path = get_dir() + "/data/oci/";
if (!strcmp(url, "https://hub-mirror.c.163.com/v2/")) {
file = data_path + "ping_head";
file = data_path + "ping_head";
} else if (!strcmp(url, "https://hub-mirror.c.163.com/v2/library/busybox/manifests/latest")) {
file = data_path + "index";
file = data_path + "index";
} else if (util_has_prefix(url, "https://hub-mirror.c.163.com/v2/library/busybox/manifests/sha256:106429d7")) {
file = data_path + "manifest_body";
file = data_path + "manifest_body";
} else if (util_has_prefix(url, "https://hub-mirror.c.163.com/v2/library/busybox/blobs/sha256:c7c37e47")) {
file = data_path + "config";
file = data_path + "config";
} else if (util_has_prefix(url, "https://hub-mirror.c.163.com/v2/library/busybox/blobs/sha256:91f30d77")) {
file = data_path + "0";
file = data_path + "0";
} else {
ERROR("%s not match failed", url);
return -1;
ERROR("%s not match failed", url);
return -1;
}
size = util_file_size(file.c_str());
if (size < 0) {
ERROR("get file %s size failed", file.c_str());
return -1;
ERROR("get file %s size failed", file.c_str());
return -1;
}
data = util_read_text_file(file.c_str());
if (data == NULL) {
ERROR("read file %s failed", file.c_str());
return -1;
ERROR("read file %s failed", file.c_str());
return -1;
}
if (options->outputtype == HTTP_REQUEST_STRBUF) {
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
} else {
if (util_write_file((const char *)options->output, data, size, 0600) != 0) {
free(data);
ERROR("write file %s failed", (char *)options->output);
return -1;
}
if (util_write_file((const char *)options->output, data, size, 0600) != 0) {
free(data);
ERROR("write file %s failed", (char *)options->output);
return -1;
}
}
free(data);
......@@ -296,34 +295,35 @@ int invokeHttpRequestLogin(const char *url, struct http_get_options *options, lo
std::string data_path = get_dir() + "/data/v2/";
if (!strcmp(url, "https://hub-mirror.c.163.com/v2/") || !strcmp(url, "https://test2.com/v2/")) {
file = data_path + "ping_head";
file = data_path + "ping_head";
} else {
ERROR("%s not match failed", url);
return -1;
ERROR("%s not match failed", url);
return -1;
}
data = util_read_text_file(file.c_str());
if (data == NULL) {
ERROR("read file %s failed", file.c_str());
return -1;
ERROR("read file %s failed", file.c_str());
return -1;
}
if (options->outputtype == HTTP_REQUEST_STRBUF) {
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
free(output_buffer->contents);
output_buffer->contents = util_strdup_s(data);
}
free(data);
return 0;
}
int invokeStorageImgCreate(const char *id, const char *parent_id, const char *metadata, struct storage_img_create_options *opts)
int invokeStorageImgCreate(const char *id, const char *parent_id, const char *metadata,
struct storage_img_create_options *opts)
{
static int count = 0;
count++;
if (count == 1) {
return -1;
return -1;
}
return 0;
......@@ -386,33 +386,34 @@ struct layer_list *invokeStorageLayersGetByCompressDigest(const char *digest)
list = (struct layer_list*)util_common_calloc_s(sizeof(struct layer_list));
if (list == NULL) {
ERROR("out of memory");
ERROR("out of memory");
return NULL;
}
list->layers = (struct layer **)util_common_calloc_s(sizeof(struct layer*) * 1);
if (list->layers == NULL) {
ERROR("out of memory");
ret = -1;
goto out;
ERROR("out of memory");
ret = -1;
goto out;
}
list->layers[0] = (struct layer *)util_common_calloc_s(sizeof(struct layer));
if (list->layers[0] == NULL) {
ERROR("out of memory");
ret = -1;
goto out;
ERROR("out of memory");
ret = -1;
goto out;
}
list->layers_len = 1;
list->layers[0]->uncompressed_digest = util_strdup_s("sha256:50761fe126b6e4d90fa0b7a6e195f6030fe250c016c2fc860ac40f2e8d2f2615");
list->layers[0]->uncompressed_digest =
util_strdup_s("sha256:50761fe126b6e4d90fa0b7a6e195f6030fe250c016c2fc860ac40f2e8d2f2615");
list->layers[0]->id = util_strdup_s("sha256:50761fe126b6e4d90fa0b7a6e195f6030fe250c016c2fc860ac40f2e8d2f2615");
list->layers[0]->parent = NULL;
out:
if (ret != 0) {
free_layer_list(list);
list = NULL;
free_layer_list(list);
list = NULL;
}
return list;
......@@ -424,8 +425,8 @@ struct layer * invokeStorageLayerGet1(const char *layer_id)
l = (struct layer *)util_common_calloc_s(sizeof(struct layer));
if (l == NULL) {
ERROR("out of memory");
return NULL;
ERROR("out of memory");
return NULL;
}
return l;
......@@ -493,29 +494,29 @@ static int init_log()
void mockCommonAll(MockStorage *mock, MockOciImage *oci_image_mock)
{
EXPECT_CALL(*mock, StorageImgCreate(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageImgCreate(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgCreate));
EXPECT_CALL(*mock, StorageImgGet(::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgGet));
EXPECT_CALL(*mock, StorageImgSetBigData(::testing::_,::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageImgSetBigData(::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgSetBigData));
EXPECT_CALL(*mock, StorageImgAddName(::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageImgAddName(::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgAddName));
EXPECT_CALL(*mock, StorageImgDelete(::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageImgDelete(::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgDelete));
EXPECT_CALL(*mock, StorageImgSetLoadedTime(::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageImgSetLoadedTime(::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgSetLoadedTime));
EXPECT_CALL(*mock, StorageImgSetImageSize(::testing::_))
.WillRepeatedly(Invoke(invokeStorageImgSetImageSize));
EXPECT_CALL(*mock, StorageGetImgTopLayer(::testing::_))
.WillRepeatedly(Invoke(invokeStorageGetImgTopLayer));
EXPECT_CALL(*mock, StorageLayerCreate(::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageLayerCreate(::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageLayerCreate));
EXPECT_CALL(*mock, StorageSetHoldFlag(::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageSetHoldFlag(::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageSetHoldFlag));
EXPECT_CALL(*mock, StorageLayerGet(::testing::_))
.WillRepeatedly(Invoke(invokeStorageLayerGet));
EXPECT_CALL(*mock, StorageLayerTryRepairLowers(::testing::_,::testing::_))
EXPECT_CALL(*mock, StorageLayerTryRepairLowers(::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeStorageLayerTryRepairLowers));
EXPECT_CALL(*mock, FreeLayerList(::testing::_))
.WillRepeatedly(Invoke(invokeFreeLayerList));
......@@ -536,8 +537,8 @@ int create_certs(std::string &dir)
if (util_write_file(ca.c_str(), "1", 1, 0600) != 0 ||
util_write_file(cert.c_str(), "1", 1, 0600) != 0 ||
util_write_file(key.c_str(), "1", 1, 0600) != 0) {
ERROR("write certs file failed");
return -1;
ERROR("write certs file failed");
return -1;
}
return 0;
......@@ -552,8 +553,8 @@ int remove_certs(std::string &dir)
if (util_path_remove(ca.c_str()) != 0 ||
util_path_remove(cert.c_str()) != 0 ||
util_path_remove(key.c_str()) != 0) {
ERROR("remove certs file failed");
return -1;
ERROR("remove certs file failed");
return -1;
}
return 0;
......@@ -571,14 +572,14 @@ TEST_F(RegistryUnitTest, test_pull_v1_image)
std::string auths_dir = get_dir() + "/auths";
std::string certs_dir = get_dir() + "/certs";
std::string mirror_dir = certs_dir+"/hub-mirror.c.163.com";
std::string mirror_dir = certs_dir + "/hub-mirror.c.163.com";
ASSERT_EQ(util_mkdir_p(auths_dir.c_str(), 0700), 0);
ASSERT_EQ(util_mkdir_p(mirror_dir.c_str(), 0700), 0);
ASSERT_EQ(create_certs(mirror_dir), 0);
ASSERT_EQ(init_log(), 0);
ASSERT_EQ(registry_init((char *)auths_dir.c_str(), (char *)certs_dir.c_str()), 0);
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeHttpRequestV1));
mockCommonAll(&m_storage_mock, &m_oci_image_mock);
ASSERT_EQ(registry_pull(&options), 0);
......@@ -592,7 +593,7 @@ TEST_F(RegistryUnitTest, test_login)
{
registry_login_options options = {0};
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeHttpRequestLogin));
options.host = (char*)"test2.com";
......@@ -638,7 +639,7 @@ TEST_F(RegistryUnitTest, test_pull_v2_image)
clock_gettime(CLOCK_MONOTONIC, &start_time);
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeHttpRequestV2));
mockCommonAll(&m_storage_mock, &m_oci_image_mock);
......@@ -656,7 +657,7 @@ TEST_F(RegistryUnitTest, test_pull_v2_image)
clock_gettime(CLOCK_MONOTONIC, &end_time);
ASSERT_TRUE(end_time.tv_sec-start_time.tv_sec <= 10);
ASSERT_TRUE(end_time.tv_sec - start_time.tv_sec <= 10);
}
TEST_F(RegistryUnitTest, test_pull_oci_image)
......@@ -672,7 +673,7 @@ TEST_F(RegistryUnitTest, test_pull_oci_image)
options->auth.password = NULL;
options->skip_tls_verify = false;
options->insecure_registry = false;
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeHttpRequestOCI));
mockCommonAll(&m_storage_mock, &m_oci_image_mock);
ASSERT_EQ(registry_pull(options), 0);
......@@ -690,7 +691,7 @@ TEST_F(RegistryUnitTest, test_pull_already_exist)
options.skip_tls_verify = true;
options.insecure_registry = true;
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeHttpRequestV2));
mockCommonAll(&m_storage_mock, &m_oci_image_mock);
EXPECT_CALL(m_storage_mock, StorageLayerGet(::testing::_))
......@@ -699,7 +700,7 @@ TEST_F(RegistryUnitTest, test_pull_already_exist)
options.image_name = (char*)"quay.io/coreos/etcd:v3.3.17-arm64";
options.dest_image_name = (char*)"quay.io/coreos/etcd:v3.3.17-arm64";
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_,::testing::_,::testing::_,::testing::_))
EXPECT_CALL(m_http_mock, HttpRequest(::testing::_, ::testing::_, ::testing::_, ::testing::_))
.WillRepeatedly(Invoke(invokeHttpRequestV1));
EXPECT_CALL(m_storage_mock, StorageLayerGet(::testing::_))
.WillRepeatedly(Invoke(invokeStorageLayerGet));
......@@ -714,7 +715,7 @@ TEST_F(RegistryUnitTest, test_aes)
unsigned char *encoded = NULL;
char *decoded = NULL;
ASSERT_EQ(aes_encode((unsigned char *)text, strlen(text), &encoded), 0);
ASSERT_EQ(aes_decode(encoded, AES_256_CFB_IV_LEN+strlen(text), (unsigned char **)&decoded), 0);
ASSERT_EQ(aes_decode(encoded, AES_256_CFB_IV_LEN + strlen(text), (unsigned char **)&decoded), 0);
ASSERT_STREQ(decoded, text);
free(encoded);
free(decoded);
......
......@@ -22,7 +22,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/registry_type.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/image_store/image_store.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/storage_mock.cc
storage_images_ut.cpp)
storage_images_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -30,7 +30,7 @@ add_executable(${DRIVER_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/overlay2/driver_overlay2.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/quota/project_quota.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/driver_quota_mock.cc
storage_driver_ut.cpp)
storage_driver_ut.cc)
target_include_directories(${DRIVER_EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......@@ -101,7 +101,7 @@ add_executable(${LAYER_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/overlay2/driver_overlay2.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/layer_store/graphdriver/quota/project_quota.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/driver_quota_mock.cc
storage_layers_ut.cpp)
storage_layers_ut.cc)
target_include_directories(${LAYER_EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -109,11 +109,12 @@ protected:
std::string cp_command = "cp -r " + std::string(data_path) + " " + isulad_dir;
ASSERT_EQ(system(cp_command.c_str()), 0);
std::string mkdir = "mkdir -p " + root_dir + "/overlay/1be74353c3d0fd55fb5638a52953e6f1bc441e5b1710921db9ec2aa202725569/merged "
+ root_dir + "/overlay/1be74353c3d0fd55fb5638a52953e6f1bc441e5b1710921db9ec2aa202725569/work && "
std::string mkdir = "mkdir -p " + root_dir +
"/overlay/1be74353c3d0fd55fb5638a52953e6f1bc441e5b1710921db9ec2aa202725569/merged "
+ root_dir + "/overlay/1be74353c3d0fd55fb5638a52953e6f1bc441e5b1710921db9ec2aa202725569/work && "
"mkdir -p " + root_dir + "/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/empty "
+ root_dir + "/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/merged "
+ root_dir + "/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/work ";
+ root_dir + "/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/merged "
+ root_dir + "/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/work ";
ASSERT_EQ(system(mkdir.c_str()), 0);
opts = (struct storage_module_init_options *)util_common_calloc_s(sizeof(struct storage_module_init_options));
......@@ -225,7 +226,7 @@ TEST_F(StorageDriverUnitTest, test_graphdriver_try_repair_lowers)
TEST(StorageOverlay2QuotaOptionsTest, test_overlay2_is_quota_options)
{
std::vector<std::string> options { "overlay2.size", "overlay2.basesize" };
for(auto option : options) {
for (auto option : options) {
ASSERT_TRUE(overlay2_is_quota_options(nullptr, option.c_str()));
}
}
......@@ -212,7 +212,8 @@ TEST_F(StorageLayersUnitTest, test_layers_load)
}
// check layer 7db8f44a0a8e12ea4283e3180e98880007efbd5de2e7c98b67de9cdd4dfffb0b
std::string mount_point = std::string(real_path) + "/overlay/7db8f44a0a8e12ea4283e3180e98880007efbd5de2e7c98b67de9cdd4dfffb0b/merged";
std::string mount_point = std::string(real_path) +
"/overlay/7db8f44a0a8e12ea4283e3180e98880007efbd5de2e7c98b67de9cdd4dfffb0b/merged";
ASSERT_NE(layers[id_container], nullptr);
ASSERT_STREQ(layers[id_container]->id, "7db8f44a0a8e12ea4283e3180e98880007efbd5de2e7c98b67de9cdd4dfffb0b");
ASSERT_STREQ(layers[id_container]->parent, "9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63");
......@@ -222,8 +223,10 @@ TEST_F(StorageLayersUnitTest, test_layers_load)
ASSERT_NE(layers[id_image], nullptr);
ASSERT_STREQ(layers[id_image]->id, "9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63");
ASSERT_STREQ(layers[id_image]->parent, nullptr);
ASSERT_STREQ(layers[id_image]->compressed_digest, "sha256:0e03bdcc26d7a9a57ef3b6f1bf1a210cff6239bff7c8cac72435984032851689");
ASSERT_STREQ(layers[id_image]->uncompressed_digest, "sha256:9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63");
ASSERT_STREQ(layers[id_image]->compressed_digest,
"sha256:0e03bdcc26d7a9a57ef3b6f1bf1a210cff6239bff7c8cac72435984032851689");
ASSERT_STREQ(layers[id_image]->uncompressed_digest,
"sha256:9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63");
ASSERT_EQ(layers[id_image]->uncompress_size, 1672256);
free_layer_list(layer_list);
......
......@@ -21,7 +21,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/rootfs_store/rootfs.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../src/daemon/modules/image/oci/storage/rootfs_store/rootfs_store.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/storage_mock.cc
storage_rootfs_ut.cpp)
storage_rootfs_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -103,7 +103,7 @@ protected:
}
std::vector<std::string> ids { "0e025f44cdca20966a5e5f11e1d9d8eb726aef2d38ed20f89ea986987c2010a9",
"28a8e1311d71345b08788c16b8c4f45a57641854f0e7c16802eedd0eb334b832" };
"28a8e1311d71345b08788c16b8c4f45a57641854f0e7c16802eedd0eb334b832" };
char store_real_path[PATH_MAX] = { 0x00 };
};
......@@ -149,8 +149,8 @@ TEST_F(StorageRootfsUnitTest, test_rootfs_store_create)
sizeof(names_with_id) / sizeof(names_with_id[0]), image.c_str(),
layer_with_id.c_str(), metadata.c_str(), nullptr);
char *container_without_id =
rootfs_store_create(nullptr, names_without_id, sizeof(names_without_id) / sizeof(names_without_id[0]),
image.c_str(), layer_without_id.c_str(), metadata.c_str(), nullptr);
rootfs_store_create(nullptr, names_without_id, sizeof(names_without_id) / sizeof(names_without_id[0]),
image.c_str(), layer_without_id.c_str(), metadata.c_str(), nullptr);
ASSERT_STREQ(created_container, id.c_str());
ASSERT_NE(container_without_id, nullptr);
......
......@@ -14,7 +14,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_regex.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/cutils/utils_verify.c
${CMAKE_CURRENT_SOURCE_DIR}/../../src/utils/sha256/sha256.c
path_ut.cpp)
path_ut.cc)
target_include_directories(${EXE} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/../include
......
......@@ -20,14 +20,14 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/common/sysinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/command_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config/daemon_arguments.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/containers_store_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/namespace_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/container_unix_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/engine_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/runtime/isula/isula_rt_ops.c
isula_rt_ops_ut.cpp)
isula_rt_ops_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -19,14 +19,14 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/common/sysinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/command_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config/daemon_arguments.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/containers_store_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/namespace_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/container_unix_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/engine_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/modules/runtime/engines/lcr/lcr_rt_ops.c
lcr_rt_ops_ut.cpp)
lcr_rt_ops_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -42,7 +42,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/engine_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/restartmanager_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../mocks/specs_mock.cc
execution_extend_ut.cpp)
execution_extend_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -134,7 +134,7 @@ container_t *invokeContainersStoreGet(const char *id_or_name)
}
container_t *cont = (container_t *)util_common_calloc_s(sizeof(container_t));
cont->common_config =
(container_config_v2_common_config *)util_common_calloc_s(sizeof(container_config_v2_common_config));
(container_config_v2_common_config *)util_common_calloc_s(sizeof(container_config_v2_common_config));
cont->refcnt = 1;
return cont;
}
......@@ -204,7 +204,7 @@ TEST_F(ExecutionExtendUnitTest, test_container_extend_callback_init_pause)
service_container_callback_t cb;
container_pause_request *request = (container_pause_request *)util_common_calloc_s(sizeof(container_pause_request));
container_pause_response *response =
(container_pause_response *)util_common_calloc_s(sizeof(container_pause_response));
(container_pause_response *)util_common_calloc_s(sizeof(container_pause_response));
request->id = util_strdup_s("64ff21ebf4e4");
EXPECT_CALL(m_runtime, RuntimePause(_, _, _)).WillRepeatedly(Invoke(invokeRuntimePause));
......@@ -230,9 +230,9 @@ TEST_F(ExecutionExtendUnitTest, test_container_extend_callback_init_resume)
{
service_container_callback_t cb;
container_resume_request *request =
(container_resume_request *)util_common_calloc_s(sizeof(container_resume_request));
(container_resume_request *)util_common_calloc_s(sizeof(container_resume_request));
container_resume_response *response =
(container_resume_response *)util_common_calloc_s(sizeof(container_resume_response));
(container_resume_response *)util_common_calloc_s(sizeof(container_resume_response));
request->id = util_strdup_s("64ff21ebf4e4");
EXPECT_CALL(m_runtime, RuntimeResume(_, _, _)).WillRepeatedly(Invoke(invokeRuntimeResume));
......
......@@ -18,7 +18,7 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/common/err_msg.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/namespace_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/common/selinux_label.c
selinux_label_ut.cpp)
selinux_label_ut.cc)
add_executable(${MOCK_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/utils/cutils/utils.c
......@@ -37,7 +37,7 @@ add_executable(${MOCK_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/syscall_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../mocks/selinux_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/daemon/common/selinux_label.c
selinux_label_mock_ut.cpp)
selinux_label_mock_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -23,14 +23,14 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/common/sysinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/command_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config/daemon_arguments.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/containers_store_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/namespace_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/container_unix_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/engine_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/selinux_label_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
specs_ut.cpp)
specs_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -23,14 +23,14 @@ add_executable(${EXE}
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/common/sysinfo.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/cmd/command_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../src/daemon/config/daemon_arguments.c
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/image/oci/oci_ut_common.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/containers_store_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/namespace_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/container_unix_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/engine_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/selinux_label_mock.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../../test/mocks/isulad_config_mock.cc
specs_extend_ut.cpp)
specs_extend_ut.cc)
target_include_directories(${EXE} PUBLIC
${GTEST_INCLUDE_DIR}
......
......@@ -87,9 +87,9 @@ function codestyle_check() {
local start_time=$(date +%s)
local files
if [[ ${1} == "all" ]]; then
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(cc)")
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(cc|cpp)")
else
files=$(git diff --name-only HEAD | grep -E "*.cc$")
files=$(git diff --name-only HEAD | grep -E "*.cc$|*.cpp$")
fi
files=(${files// / })
local total=${#files[@]}
......@@ -128,7 +128,7 @@ function clang_format() {
\____//_____//_/ |_|/_/ |_/ \____/ /_/ \____//_/ |_|/_/ /_//_/ |_|/_/ \033[0m]
================================================================================================="
local start_time=$(date +%s)
local files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$")
local files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$|*.cpp$")
files=(${files// / })
local total=${#files[@]}
local failure_num=0
......@@ -208,7 +208,7 @@ function astyle_format() {
/_/ |_|/____/ /_/ /_//_____//_____/ /_/ \____//_/ |_|/_/ /_//_/ |_|/_/ \033[0m]
================================================================================================="
local start_time=$(date +%s)
local files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc)")
local files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc|cpp)")
files=(${files// / })
local total=${#files[@]}
local failure_num=0
......@@ -263,9 +263,9 @@ echo -e "\
local start_time=$(date +%s)
local files
if [[ ${1} == "all" ]]; then
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc)")
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc|cpp)")
else
files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$")
files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$|*.cpp$")
fi
files=(${files// / })
local total=${#files[@]}
......@@ -360,13 +360,13 @@ function clang_tidy_check() {
local files
if [[ ${1} == "all" ]]; then
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc)")
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc|cpp)")
elif [[ ${1} == "incremental" ]]; then
files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$")
files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$|*.cpp$")
elif [[ -f "$1" ]]; then
files="$1"
elif [[ -d "$1" ]]; then
files=$(find "$1" -regextype posix-extended -regex ".*\.(h|c|cc)")
files=$(find "$1" -regextype posix-extended -regex ".*\.(h|c|cc|cpp)")
fi
files=(${files// / })
local total=${#files[@]}
......@@ -432,13 +432,13 @@ function clang_tidy_fix() {
fi
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h)")
elif [[ ${1} == "all" ]]; then
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc)")
files=$(find ./src ./test -regextype posix-extended -regex ".*\.(h|c|cc|cpp)")
elif [[ ${1} == "incremental" ]]; then
files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$")
files=$(git diff --name-only HEAD | grep -E "*.h$|*.c$|*.cc$|*.cpp$")
elif [[ -f "$1" ]]; then
files="$1"
elif [[ -d "$1" ]]; then
files=$(find "$1" -regextype posix-extended -regex ".*\.(h|c|cc)")
files=$(find "$1" -regextype posix-extended -regex ".*\.(h|c|cc|cpp)")
fi
files=(${files// / })
local total=${#files[@]}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册