From 549e22a9fb7f6e2c36a4a7422223c90fa7c44bd6 Mon Sep 17 00:00:00 2001
From: zhangxiaoyu <zhangxiaoyu58@huawei.com>
Date: Fri, 17 Feb 2023 09:34:14 +0800
Subject: [PATCH 16/19] fix code style

Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
---
 src/client/connect/protocol_type.c            |  2 +-
 .../connect/rest/rest_containers_client.c     |  2 +-
 src/cmd/isula/base/run.h                      |  2 +-
 src/cmd/isula/client_console.c                |  2 +-
 src/cmd/isula/stream/attach.c                 |  2 +-
 src/cmd/isulad-shim/process.c                 |  5 +-
 .../connect/grpc/grpc_containers_service.cc   |  2 +-
 .../grpc/grpc_containers_service_private.cc   |  8 +--
 .../cri_pod_sandbox_manager_service_impl.cc   | 10 ++--
 src/daemon/executor/container_cb/execution.c  |  2 +-
 .../modules/image/image_rootfs_handler.c      | 12 ++---
 .../modules/runtime/isula/isula_rt_ops.c      |  8 +--
 src/daemon/modules/runtime/shim/shim_rt_ops.c |  2 +-
 .../modules/service/service_container.c       |  4 +-
 src/utils/cutils/filters.c                    |  2 +-
 src/utils/cutils/utils_mount_spec.c           |  6 +--
 test/cgroup/cpu/cgroup_cpu_ut.cc              |  2 +-
 test/console/console_ut.cc                    |  4 +-
 test/cutils/utils_file/utils_file_ut.cc       | 50 +++++++++----------
 .../utils_mount_spec/utils_mount_spec_ut.cc   |  6 ++-
 test/cutils/utils_pwgr/utils_pwgr_ut.cc       |  4 +-
 test/cutils/utils_utils/utils_utils_ut.cc     |  5 +-
 test/cutils/utils_verify/utils_verify_ut.cc   |  2 +-
 .../oci/storage/layers/storage_driver_ut.cc   |  3 +-
 test/sha256/sha256_ut.cc                      |  2 +-
 25 files changed, 78 insertions(+), 71 deletions(-)

diff --git a/src/client/connect/protocol_type.c b/src/client/connect/protocol_type.c
index a3aabe0e..64576d1e 100644
--- a/src/client/connect/protocol_type.c
+++ b/src/client/connect/protocol_type.c
@@ -660,7 +660,7 @@ void isula_kill_response_free(struct isula_kill_response *response)
     }
     free(response->id);
     response->id = NULL;
-    
+
     free(response->errmsg);
     response->errmsg = NULL;
     free(response);
diff --git a/src/client/connect/rest/rest_containers_client.c b/src/client/connect/rest/rest_containers_client.c
index 22aa1c9b..0a735a64 100644
--- a/src/client/connect/rest/rest_containers_client.c
+++ b/src/client/connect/rest/rest_containers_client.c
@@ -1333,7 +1333,7 @@ static int unpack_kill_response(const struct parsed_http_message *message, void
     if (cresponse->id != NULL) {
         kill_response->id = util_strdup_s(cresponse->id);
     }
-    
+
     kill_response->server_errono = cresponse->cc;
     if (cresponse->errmsg != NULL) {
         kill_response->errmsg = util_strdup_s(cresponse->errmsg);
diff --git a/src/cmd/isula/base/run.h b/src/cmd/isula/base/run.h
index efca28a9..1084fae2 100644
--- a/src/cmd/isula/base/run.h
+++ b/src/cmd/isula/base/run.h
@@ -34,7 +34,7 @@ extern "C" {
         'd',                                                        \
         &(cmdargs).detach,                                          \
         "Run container in background and print container ID",       \
-        NULL },                                                   
+        NULL },
 
 extern const char g_cmd_run_desc[];
 extern const char g_cmd_run_usage[];
diff --git a/src/cmd/isula/client_console.c b/src/cmd/isula/client_console.c
index 8cba2047..1c087d24 100644
--- a/src/cmd/isula/client_console.c
+++ b/src/cmd/isula/client_console.c
@@ -338,7 +338,7 @@ int delete_client_fifo_home_dir(const char *name)
         WARN("Failed to delete client fifo home path:%s", client_fifo_home_dir);
     }
     free(client_fifo_home_dir);
-    
+
     return 0;
 }
 
diff --git a/src/cmd/isula/stream/attach.c b/src/cmd/isula/stream/attach.c
index 8f60eb44..02c67e30 100644
--- a/src/cmd/isula/stream/attach.c
+++ b/src/cmd/isula/stream/attach.c
@@ -49,7 +49,7 @@ sem_t g_attach_waitopen_sem;
 sem_t g_attach_waitexit_sem;
 #endif
 
-struct client_arguments g_cmd_attach_args = { 
+struct client_arguments g_cmd_attach_args = {
     .time = INSPECT_TIMEOUT_SEC,
 };
 
diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c
index 66c604f3..5222629c 100644
--- a/src/cmd/isulad-shim/process.c
+++ b/src/cmd/isulad-shim/process.c
@@ -1203,7 +1203,8 @@ out:
     return ret;
 }
 
-static int try_wait_all_child(void) {
+static int try_wait_all_child(void)
+{
     if (waitpid(-1, NULL, WNOHANG) == -1 && errno == ECHILD) {
         // all child handled
         return 0;
@@ -1243,7 +1244,7 @@ int process_signal_handle_routine(process_t *p, const pthread_t tid_accept)
         }
         if (exit_shim) {
             process_kill_all(p);
-            
+
             // wait atmost 120 seconds
             DO_RETRY_CALL(120, 1000000, nret, try_wait_all_child);
             if (nret != 0) {
diff --git a/src/daemon/entry/connect/grpc/grpc_containers_service.cc b/src/daemon/entry/connect/grpc/grpc_containers_service.cc
index d3b661a2..bc5c73f9 100644
--- a/src/daemon/entry/connect/grpc/grpc_containers_service.cc
+++ b/src/daemon/entry/connect/grpc/grpc_containers_service.cc
@@ -465,7 +465,7 @@ Status ContainerServiceImpl::Stop(ServerContext *context, const StopRequest *req
     }
 
     (void)cb->container.stop(container_req, &container_res);
-    
+
     stop_response_to_grpc(container_res, reply);
 
     free_container_stop_request(container_req);
diff --git a/src/daemon/entry/connect/grpc/grpc_containers_service_private.cc b/src/daemon/entry/connect/grpc/grpc_containers_service_private.cc
index e934aa74..853336fe 100644
--- a/src/daemon/entry/connect/grpc/grpc_containers_service_private.cc
+++ b/src/daemon/entry/connect/grpc/grpc_containers_service_private.cc
@@ -268,12 +268,12 @@ void ContainerServiceImpl::stop_response_to_grpc(const container_stop_response *
         gresponse->set_cc(ISULAD_ERR_MEMOUT);
         return;
     }
-    
+
     gresponse->set_cc(response->cc);
     if (response->errmsg != nullptr) {
         gresponse->set_errmsg(response->errmsg);
     }
-    
+
     if (response->id != nullptr) {
         gresponse->set_id(response->id);
     }
@@ -321,12 +321,12 @@ void ContainerServiceImpl::kill_response_to_grpc(const container_kill_response *
         gresponse->set_cc(ISULAD_ERR_MEMOUT);
         return;
     }
-    
+
     gresponse->set_cc(response->cc);
     if (response->errmsg != nullptr) {
         gresponse->set_errmsg(response->errmsg);
     }
-    
+
     if (response->id != nullptr) {
         gresponse->set_id(response->id);
     }
diff --git a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
index 3e89008a..2ebd800e 100644
--- a/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
+++ b/src/daemon/entry/cri/cri_pod_sandbox_manager_service_impl.cc
@@ -99,8 +99,8 @@ void PodSandboxManagerServiceImpl::ApplySandboxResources(const runtime::v1alpha2
 }
 
 
-void PodSandboxManagerServiceImpl::SetHostConfigDefaultValue(const google::protobuf::Map<std::string, std::string> &annotations, 
-                                                             host_config *hc)
+void PodSandboxManagerServiceImpl::SetHostConfigDefaultValue(
+    const google::protobuf::Map<std::string, std::string> &annotations, host_config *hc)
 {
     free(hc->network_mode);
 
@@ -525,7 +525,7 @@ void PodSandboxManagerServiceImpl::SetupSandboxNetwork(const runtime::v1alpha2::
             return;
         }
         stdAnnos.insert(std::pair<std::string, std::string>(CRIHelpers::Constants::POD_SANDBOX_KEY,
-                        std::string(sandbox_key)));
+                                                            std::string(sandbox_key)));
         free(sandbox_key);
     }
     m_pluginManager->SetUpPod(config.metadata().namespace_(), config.metadata().name(),
@@ -775,12 +775,12 @@ auto PodSandboxManagerServiceImpl::ClearCniNetwork(const std::string &realSandbo
             // not return and make sure teardown network
         } else {
             stdAnnos.insert(std::pair<std::string, std::string>(CRIHelpers::Constants::POD_SANDBOX_KEY,
-                                                    std::string(netnsPath)));
+                                                                std::string(netnsPath)));
         }
     }
 
     m_pluginManager->TearDownPod(ns, name, Network::DEFAULT_NETWORK_INTERFACE_NAME, realSandboxID, stdAnnos,
-                                    pluginErr);
+                                 pluginErr);
     if (pluginErr.NotEmpty()) {
         WARN("TearDownPod cni network failed: %s", pluginErr.GetCMessage());
         errlist.push_back(pluginErr.GetMessage());
diff --git a/src/daemon/executor/container_cb/execution.c b/src/daemon/executor/container_cb/execution.c
index 4dd5f858..4ca2eb8b 100644
--- a/src/daemon/executor/container_cb/execution.c
+++ b/src/daemon/executor/container_cb/execution.c
@@ -465,7 +465,7 @@ static int container_start_prepare(container_t *cont, const container_start_requ
 
     // init cgroup path for cpu_rt_runtime and cpu_rt_period
     // we should do this in start container, not create container
-    // because it will fail after the following steps: 
+    // because it will fail after the following steps:
     // 1. enable cpu-rt of isulad;
     // 2. then run container with --cpu-rt-runtime
     // 3. then reboot machine;
diff --git a/src/daemon/modules/image/image_rootfs_handler.c b/src/daemon/modules/image/image_rootfs_handler.c
index c3964b2c..1275658e 100644
--- a/src/daemon/modules/image/image_rootfs_handler.c
+++ b/src/daemon/modules/image/image_rootfs_handler.c
@@ -87,7 +87,7 @@ static int proc_by_fpasswd(FILE *f_passwd, const char *user, defs_process_user *
     struct passwd *pwbufp = NULL;
 
     if (f_passwd != NULL) {
-#if defined (__ANDROID__) || defined(__MUSL__) 
+#if defined (__ANDROID__) || defined(__MUSL__)
         errval = util_getpwent_r(f_passwd, &pw, buf, sizeof(buf), &pwbufp);
 #else
         errval = fgetpwent_r(f_passwd, &pw, buf, sizeof(buf), &pwbufp);
@@ -105,7 +105,7 @@ static int proc_by_fpasswd(FILE *f_passwd, const char *user, defs_process_user *
                 *matched_username = util_strdup_s(pwbufp->pw_name);
                 break;
             }
-#if defined (__ANDROID__) || defined(__MUSL__) 
+#if defined (__ANDROID__) || defined(__MUSL__)
             errval = util_getpwent_r(f_passwd, &pw, buf, sizeof(buf), &pwbufp);
 #else
             errval = fgetpwent_r(f_passwd, &pw, buf, sizeof(buf), &pwbufp);
@@ -215,7 +215,7 @@ static int do_proc_by_froup(FILE *f_group, const char *group, defs_process_user
         return 0;
     }
 
-#if defined (__ANDROID__) || defined(__MUSL__) 
+#if defined (__ANDROID__) || defined(__MUSL__)
     errval = util_getgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp);
 #else
     errval = fgetgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp);
@@ -226,7 +226,7 @@ static int do_proc_by_froup(FILE *f_group, const char *group, defs_process_user
             if (search_group_list(gbufp, matched_username, puser) != 0) {
                 return -1;
             }
-#if defined (__ANDROID__) || defined(__MUSL__) 
+#if defined (__ANDROID__) || defined(__MUSL__)
             errval = util_getgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp);
 #else
             errval = fgetgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp);
@@ -240,7 +240,7 @@ static int do_proc_by_froup(FILE *f_group, const char *group, defs_process_user
             puser->gid = gbufp->gr_gid;
             *groupcnt = 1;
         }
-#if defined (__ANDROID__) || defined(__MUSL__) 
+#if defined (__ANDROID__) || defined(__MUSL__)
         errval = util_getgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp);
 #else
         errval = fgetgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp);
@@ -378,7 +378,7 @@ static int get_additional_groups(char **additional_groups, size_t additional_gro
     struct group *gbufp = NULL;
     struct group *groups = NULL;
 
-#if defined (__ANDROID__) || defined(__MUSL__) 
+#if defined (__ANDROID__) || defined(__MUSL__)
     while (f_group != NULL && util_getgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp) == 0) {
 #else
     while (f_group != NULL && fgetgrent_r(f_group, &grp, buf, sizeof(buf), &gbufp) == 0) {
diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
index d198f92e..99f8be5e 100644
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
@@ -599,10 +599,10 @@ static int runtime_call_simple(const char *workdir, const char *runtime, const c
     if (!util_exec_cmd(runtime_exec_func, &rei, NULL, &stdout, &stderr)) {
         ERROR("call runtime %s failed stderr %s", subcmd, stderr);
         ret = -1;
-        // additional handler for the stderr, 
+        // additional handler for the stderr,
         // this intend to change the ret val of this function
-        // for example, if output string contains some specific content, 
-        // we consider the runtime call simple succeeded, 
+        // for example, if output string contains some specific content,
+        // we consider the runtime call simple succeeded,
         // even if the process exit with failure.
         if (stderr != NULL && cb != NULL) {
             ret = cb(stderr);
@@ -636,7 +636,7 @@ static int kill_output_check(const char *output)
 
 // kill success or kill_output_check succeed return 0, DO_RETRY_CALL will break;
 // if kill failed, recheck on shim alive, if not alive, kill succeed,  still return 0;
-// else, return -1, DO_RETRY_CALL will call this again; 
+// else, return -1, DO_RETRY_CALL will call this again;
 static int runtime_call_kill_and_check(const char *workdir, const char *runtime, const char *id)
 {
     int ret = -1;
diff --git a/src/daemon/modules/runtime/shim/shim_rt_ops.c b/src/daemon/modules/runtime/shim/shim_rt_ops.c
index 1b497358..9afb9ce7 100644
--- a/src/daemon/modules/runtime/shim/shim_rt_ops.c
+++ b/src/daemon/modules/runtime/shim/shim_rt_ops.c
@@ -289,7 +289,7 @@ int rt_shim_create(const char *id, const char *runtime, const rt_create_params_t
         goto out;
     }
     close(fd);
-    
+
     if (shim_bin_v2_create(runtime, id, params->bundle, NULL, addr, state_path) != 0) {
         ERROR("%s: failed to create v2 shim", id);
         ret = -1;
diff --git a/src/daemon/modules/service/service_container.c b/src/daemon/modules/service/service_container.c
index 340dea07..f30a3f8e 100644
--- a/src/daemon/modules/service/service_container.c
+++ b/src/daemon/modules/service/service_container.c
@@ -1094,7 +1094,7 @@ static int delete_client_fifo_home_dir(const char *name)
         WARN("Failed to delete client fifo home path:%s", client_fifo_home_dir);
     }
     free(client_fifo_home_dir);
-    
+
     return 0;
 }
 
@@ -1199,7 +1199,7 @@ out:
     // when container is auto-remove, it will be deleted when stopped.
     // isula has no suitable time to delete fifo dir, so isulad delete it here.
     // Whether the delete container operation fails or not, delete the client's fifo dir to avoid it residual.
-    // When isula and isulad use tcp to connect, fifo files will not be created. 
+    // When isula and isulad use tcp to connect, fifo files will not be created.
     // Because restart will set auto_remove to false, using auto_remove_bak to ensure delete Policy.
     if (cont->hostconfig != NULL && cont->hostconfig->auto_remove_bak && delete_client_fifo_home_dir(id) != 0) {
         WARN("Failed to delete client fifo home dir");
diff --git a/src/utils/cutils/filters.c b/src/utils/cutils/filters.c
index 21f5db7c..43ccde20 100644
--- a/src/utils/cutils/filters.c
+++ b/src/utils/cutils/filters.c
@@ -318,7 +318,7 @@ bool filters_args_valid_key(const char **accepted, size_t len, const char *field
     if (accepted == NULL || field == NULL) {
         return false;
     }
-    
+
     for (i = 0; i < len; i++) {
         if (accepted[i] != NULL && strcmp(accepted[i], field) == 0) {
             return true;
diff --git a/src/utils/cutils/utils_mount_spec.c b/src/utils/cutils/utils_mount_spec.c
index e9b23cf2..6793f93b 100644
--- a/src/utils/cutils/utils_mount_spec.c
+++ b/src/utils/cutils/utils_mount_spec.c
@@ -465,15 +465,15 @@ int util_parse_mount_spec(char *mount_str, mount_spec **spec, char **errmsg_out)
         return -1;
     }
 
-    if(spec == NULL){
+    if (spec == NULL) {
         CACHE_ERRMSG(errmsg, "Invalid spec: can't be NULL");
         return -1;
     }
 
-    if(errmsg_out == NULL){
+    if (errmsg_out == NULL) {
         CACHE_ERRMSG(errmsg, "Invalid errmsg_out: can't be NULL");
         return -1;
-    } 
+    }
 
     m = util_common_calloc_s(sizeof(mount_spec));
     if (m == NULL) {
diff --git a/test/cgroup/cpu/cgroup_cpu_ut.cc b/test/cgroup/cpu/cgroup_cpu_ut.cc
index 1cfdf86f..8691db7c 100644
--- a/test/cgroup/cpu/cgroup_cpu_ut.cc
+++ b/test/cgroup/cpu/cgroup_cpu_ut.cc
@@ -49,7 +49,7 @@ TEST(CgroupCpuUnitTest, test_conf_get_cgroup_cpu_rt)
     ASSERT_EQ(conf_get_cgroup_cpu_rt(nullptr, nullptr), -1);
     ASSERT_EQ(conf_get_cgroup_cpu_rt(&cpu_rt_period, nullptr), -1);
     ASSERT_EQ(conf_get_cgroup_cpu_rt(nullptr, &cpu_rt_runtime), -1);
-    
+
     struct service_arguments *args = new_args(cpu_rt_period, cpu_rt_runtime);
     ASSERT_EQ(save_args_to_conf(args), 0);
     ASSERT_EQ(conf_get_cgroup_cpu_rt(&cpu_rt_period, &cpu_rt_runtime), 0);
diff --git a/test/console/console_ut.cc b/test/console/console_ut.cc
index 73479000..a31083b3 100644
--- a/test/console/console_ut.cc
+++ b/test/console/console_ut.cc
@@ -26,7 +26,7 @@ TEST(utils_console, test_console_fifo_create)
 
     ASSERT_EQ(S_ISFIFO(buf.st_mode), true);
 
-    ret = access(FIFO_NAME, R_OK|W_OK);
+    ret = access(FIFO_NAME, R_OK | W_OK);
     ASSERT_EQ(ret, 0);
 
     remove(FIFO_NAME);
@@ -47,7 +47,7 @@ TEST(utils_console, test_console_fifo_delete)
 
     memset(path_buf, 'a', LONGER_PATH_MAX);
     path_buf[LONGER_PATH_MAX - 1] = 0;
-    ASSERT_EQ(strlen(path_buf), LONGER_PATH_MAX-1)<< "strlen is " << strlen(path_buf);
+    ASSERT_EQ(strlen(path_buf), LONGER_PATH_MAX - 1) << "strlen is " << strlen(path_buf);
 
     ret = console_fifo_create(FIFO_NAME);
     if (ret != 0) {
diff --git a/test/cutils/utils_file/utils_file_ut.cc b/test/cutils/utils_file/utils_file_ut.cc
index ccd60ba4..78c07e60 100644
--- a/test/cutils/utils_file/utils_file_ut.cc
+++ b/test/cutils/utils_file/utils_file_ut.cc
@@ -40,12 +40,12 @@ TEST(utils_file, test_util_dir_exists)
 TEST(utils_file, test_util_fileself_exists)
 {
     ASSERT_EQ(util_fileself_exists(nullptr), false);
-   
+
     std::string path = "/tmp/test";
     std::string path_link = "/tmp/test/link";
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
     ASSERT_EQ(util_fileself_exists(path_link.c_str()), false);
-    ASSERT_EQ(symlink(path.c_str(),path_link.c_str()), 0);
+    ASSERT_EQ(symlink(path.c_str(), path_link.c_str()), 0);
     ASSERT_EQ(util_fileself_exists(path_link.c_str()), true);
     ASSERT_EQ(util_path_remove(path_link.c_str()), 0);
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
@@ -54,7 +54,7 @@ TEST(utils_file, test_util_fileself_exists)
 TEST(utils_file, test_util_file_exists)
 {
     ASSERT_EQ(util_file_exists(nullptr), false);
-   
+
     std::string path = "/tmp/test";
     ASSERT_EQ(util_file_exists(path.c_str()), false);
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
@@ -65,13 +65,13 @@ TEST(utils_file, test_util_file_exists)
 
 TEST(utils_file, test_util_recursive_rmdir)
 {
-    ASSERT_EQ(util_recursive_rmdir(nullptr,0), -1);
-   
+    ASSERT_EQ(util_recursive_rmdir(nullptr, 0), -1);
+
     std::string path = "/tmp/test";
     std::string path_link = "/tmp/test/link";
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
     ASSERT_EQ(util_mkdir_p(path_link.c_str(), FILE_PERMISSION_TEST), 0);
-    ASSERT_EQ(util_recursive_rmdir(path.c_str(),1), 0);
+    ASSERT_EQ(util_recursive_rmdir(path.c_str(), 1), 0);
     ASSERT_EQ(util_file_exists(path.c_str()), false);
     ASSERT_EQ(util_file_exists(path_link.c_str()), false);
 }
@@ -80,11 +80,11 @@ TEST(utils_file, test_util_ensure_path)
 {
     char *rpath = NULL;
     std::string path = "/tmp/test";
-    ASSERT_EQ(util_ensure_path(nullptr,path.c_str()), -1);
-    ASSERT_EQ(util_ensure_path(&rpath,nullptr), -1);
+    ASSERT_EQ(util_ensure_path(nullptr, path.c_str()), -1);
+    ASSERT_EQ(util_ensure_path(&rpath, nullptr), -1);
 
     ASSERT_EQ(util_file_exists(path.c_str()), false);
-    ASSERT_EQ(util_ensure_path(&rpath,path.c_str()), 0);
+    ASSERT_EQ(util_ensure_path(&rpath, path.c_str()), 0);
     ASSERT_EQ(util_file_exists(rpath), true);
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
 }
@@ -130,12 +130,12 @@ TEST(utils_file, test_util_add_path)
     std::string path = "/tmp/test/";
     std::string add_path = "add";
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
-    ASSERT_STREQ(util_add_path(path.c_str(),add_path.c_str()), "/tmp/test/add");
+    ASSERT_STREQ(util_add_path(path.c_str(), add_path.c_str()), "/tmp/test/add");
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
-   
+
     std::string path1 = "/tmp/test";
     ASSERT_EQ(util_mkdir_p(path1.c_str(), FILE_PERMISSION_TEST), 0);
-    ASSERT_STREQ(util_add_path(path1.c_str(),add_path.c_str()), "/tmp/add");
+    ASSERT_STREQ(util_add_path(path1.c_str(), add_path.c_str()), "/tmp/add");
     ASSERT_EQ(util_path_remove(path1.c_str()), 0);
 }
 
@@ -143,7 +143,7 @@ TEST(utils_file, test_verify_file_and_get_real_path)
 {
     std::string path = "/tmp/test";
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
-    ASSERT_STREQ(verify_file_and_get_real_path(path.c_str()),"/tmp/test");
+    ASSERT_STREQ(verify_file_and_get_real_path(path.c_str()), "/tmp/test");
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
 }
 
@@ -151,17 +151,17 @@ TEST(utils_file, test_look_path)
 {
     std::string path = "/usr/bin/nsenter";
     char *err = NULL;
-    ASSERT_STREQ(look_path("nsenter",&err),path.c_str());
+    ASSERT_STREQ(look_path("nsenter", &err), path.c_str());
 }
 
 TEST(utils_file, test_util_copy_file)
 {
     std::string path = "/tmp/test";
-    ASSERT_EQ(util_copy_file("/etc/hosts",path.c_str(),NETWORK_MOUNT_FILE_MODE), 0);
+    ASSERT_EQ(util_copy_file("/etc/hosts", path.c_str(), NETWORK_MOUNT_FILE_MODE), 0);
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
 
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
-    ASSERT_EQ(util_copy_file("/etc/hosts",path.c_str(),NETWORK_MOUNT_FILE_MODE), -1);
+    ASSERT_EQ(util_copy_file("/etc/hosts", path.c_str(), NETWORK_MOUNT_FILE_MODE), -1);
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
 }
 
@@ -169,10 +169,10 @@ TEST(utils_file, test_utils_calculate_dir_size_without_hardlink)
 {
     std::string path = "/tmp/test";
     std::string hosts = "/etc/hosts";
-    ASSERT_EQ(util_copy_file(hosts.c_str(),path.c_str(),NETWORK_MOUNT_FILE_MODE), 0);
+    ASSERT_EQ(util_copy_file(hosts.c_str(), path.c_str(), NETWORK_MOUNT_FILE_MODE), 0);
     int64_t total_size = 0;
     int64_t total_inodes = 0;
-    utils_calculate_dir_size_without_hardlink("/tmp/", &total_size,&total_inodes);
+    utils_calculate_dir_size_without_hardlink("/tmp/", &total_size, &total_inodes);
     ASSERT_NE(total_size, 0);
     ASSERT_NE(total_inodes, 0);
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
@@ -191,12 +191,12 @@ TEST(utils_file, test_util_proc_file_line_by_line)
     std::string content = "hello world";
     int fd;
     fd = util_open(path.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, DEFAULT_SECURE_FILE_MODE);
-    ASSERT_EQ(util_write_nointr_in_total(fd, content.c_str(), strlen(content.c_str())),11);
+    ASSERT_EQ(util_write_nointr_in_total(fd, content.c_str(), strlen(content.c_str())), 11);
     FILE *fp = NULL;
-    map_t *checked_layers = NULL; 
+    map_t *checked_layers = NULL;
     fp = util_fopen(path.c_str(), "r");
     checked_layers = map_new(MAP_STR_BOOL, MAP_DEFAULT_CMP_FUNC, MAP_DEFAULT_FREE_FUNC);
-    ASSERT_EQ(util_proc_file_line_by_line(fp, parse_checked_layer_cb, (void *)checked_layers),0);
+    ASSERT_EQ(util_proc_file_line_by_line(fp, parse_checked_layer_cb, (void *)checked_layers), 0);
     fclose(fp);
     ASSERT_EQ(util_path_remove(path.c_str()), 0);
 }
@@ -204,7 +204,7 @@ TEST(utils_file, test_util_proc_file_line_by_line)
 TEST(utils_file, test_util_recursive_remove_path)
 {
     ASSERT_EQ(util_recursive_remove_path(nullptr), -1);
-   
+
     std::string path = "/tmp/test";
     std::string path_link = "/tmp/test/link";
     ASSERT_EQ(util_mkdir_p(path.c_str(), FILE_PERMISSION_TEST), 0);
@@ -212,16 +212,16 @@ TEST(utils_file, test_util_recursive_remove_path)
     ASSERT_EQ(util_recursive_remove_path(path.c_str()), 0);
     ASSERT_EQ(util_file_exists(path.c_str()), false);
     ASSERT_EQ(util_file_exists(path_link.c_str()), false);
-   
+
 }
 
 TEST(utils_file, test_util_copy_dir_recursive)
 {
-    char *path = (char*)"/tmp/test1/";   
+    char *path = (char*)"/tmp/test1/";
     char *src = (char*)"/tmp/test/";
     ASSERT_EQ(util_mkdir_p(path, FILE_PERMISSION_TEST), 0);
     ASSERT_EQ(util_mkdir_p(src, FILE_PERMISSION_TEST), 0);
-    ASSERT_EQ(util_copy_dir_recursive(path,src), 0);
+    ASSERT_EQ(util_copy_dir_recursive(path, src), 0);
     ASSERT_EQ(util_recursive_remove_path(path), 0);
     ASSERT_EQ(util_recursive_remove_path(src), 0);
 }
diff --git a/test/cutils/utils_mount_spec/utils_mount_spec_ut.cc b/test/cutils/utils_mount_spec/utils_mount_spec_ut.cc
index 0f60d397..77b4752c 100644
--- a/test/cutils/utils_mount_spec/utils_mount_spec_ut.cc
+++ b/test/cutils/utils_mount_spec/utils_mount_spec_ut.cc
@@ -18,7 +18,8 @@
 
 TEST(utils_mount_spec, test_util_valid_mount_spec)
 {
-    char *base_valid = (char *)"type=bind,source=/home,target=/vol3,readonly=true,bind-selinux-opts=z,bind-propagation=rprivate";
+    char *base_valid = (char *)
+                       "type=bind,source=/home,target=/vol3,readonly=true,bind-selinux-opts=z,bind-propagation=rprivate";
     char *oci_valid = (char *)"type=tmpfs,dst=/tmpfs,tmpfs-size=1m,tmpfs-mode=1700";
     char *invalid1 = (char *)"type=volume,src=vol,dst=/vol,ro=true,red=false";
     char *invalid2 = (char *)"type,src,dst";
@@ -35,7 +36,8 @@ TEST(utils_mount_spec, test_util_valid_mount_spec)
 
 TEST(utils_mount_spec, test_util_parse_mount_spec)
 {
-    char *base_valid = (char *)"type=bind,source=/home,target=/vol3,readonly=true,bind-selinux-opts=z,bind-propagation=rprivate";
+    char *base_valid = (char *)
+                       "type=bind,source=/home,target=/vol3,readonly=true,bind-selinux-opts=z,bind-propagation=rprivate";
     char *oci_valid = (char *)"type=tmpfs,dst=/tmpfs,tmpfs-size=1m,tmpfs-mode=1700";
     char *invalid1 = (char *)"type=volume,src=vol,dst=/vol,ro=true,red=false";
     char *invalid2 = (char *)"type,src,dst";
diff --git a/test/cutils/utils_pwgr/utils_pwgr_ut.cc b/test/cutils/utils_pwgr/utils_pwgr_ut.cc
index 2a6b7e08..431372d3 100644
--- a/test/cutils/utils_pwgr/utils_pwgr_ut.cc
+++ b/test/cutils/utils_pwgr/utils_pwgr_ut.cc
@@ -77,7 +77,9 @@ TEST(utils_pwgr, test_getgrent_r)
     FILE *f_gr = fopen(path.c_str(), "r");
     ASSERT_NE(f_gr, nullptr);
 
-    struct group gr{0};
+    struct group gr {
+        0
+    };
     struct group *pgr = nullptr;
     struct group *pgr_alter = &gr;
     char buf[BUFSIZ] = { 0 };
diff --git a/test/cutils/utils_utils/utils_utils_ut.cc b/test/cutils/utils_utils/utils_utils_ut.cc
index c8f38717..6c7ece24 100644
--- a/test/cutils/utils_utils/utils_utils_ut.cc
+++ b/test/cutils/utils_utils/utils_utils_ut.cc
@@ -134,7 +134,7 @@ TEST(utils_utils, test_util_env_ops)
     ASSERT_EQ(ret_len, 2);
     ASSERT_STREQ(ret[1], second_val.c_str());
 
-    
+
     got = util_env_get_val(ret, ret_len, key1.c_str(), key1.size());
     ASSERT_STREQ(got, "world");
     free(got);
@@ -272,7 +272,8 @@ TEST(utils_utils, test_convert_v2_runtime)
 }
 
 int global_total = 0;
-int retry_call_test(int success_idx) {
+int retry_call_test(int success_idx)
+{
     if (global_total == success_idx) {
         return 0;
     }
diff --git a/test/cutils/utils_verify/utils_verify_ut.cc b/test/cutils/utils_verify/utils_verify_ut.cc
index 9c4bf944..a68dfb66 100644
--- a/test/cutils/utils_verify/utils_verify_ut.cc
+++ b/test/cutils/utils_verify/utils_verify_ut.cc
@@ -159,7 +159,7 @@ TEST(utils_verify, test_util_valid_file)
 
     ASSERT_EQ(util_path_remove(isulad_dir.c_str()), 0);
 
-    ASSERT_EQ(util_valid_file(nullptr, S_IFDIR),false);
+    ASSERT_EQ(util_valid_file(nullptr, S_IFDIR), false);
 }
 
 TEST(utils_verify, test_util_valid_digest)
diff --git a/test/image/oci/storage/layers/storage_driver_ut.cc b/test/image/oci/storage/layers/storage_driver_ut.cc
index 650368d8..ae9f4df1 100644
--- a/test/image/oci/storage/layers/storage_driver_ut.cc
+++ b/test/image/oci/storage/layers/storage_driver_ut.cc
@@ -144,7 +144,8 @@ protected:
                             + root_dir + "/overlay/9c27e219663c25e0f28493790cc0b88bc973ba3b1686355f221c38a36978ac63/work ";
         ASSERT_EQ(system(mkdir.c_str()), 0);
 
-        struct storage_module_init_options *opts = (struct storage_module_init_options *)util_common_calloc_s(sizeof(struct storage_module_init_options));
+        struct storage_module_init_options *opts = (struct storage_module_init_options *)util_common_calloc_s(sizeof(
+                                                                                                                  struct storage_module_init_options));
         opts->storage_root = strdup(root_dir.c_str());
         opts->storage_run_root = strdup(run_dir.c_str());
         opts->driver_name = strdup("overlay");
diff --git a/test/sha256/sha256_ut.cc b/test/sha256/sha256_ut.cc
index 746220d7..2313ef0d 100644
--- a/test/sha256/sha256_ut.cc
+++ b/test/sha256/sha256_ut.cc
@@ -67,7 +67,7 @@ TEST(sha256, test_sha256_digest_str)
     EXPECT_STREQ(digest, "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
 
     digest = sha256_digest_str(
-            "^cvdgfdgghaswere3575676y&*`~cx,xfdgdvcvdfd][';./?.,<>|\\!@#$%^&*()_+=-090wvvs3sdfel33cxvdf***$");
+                 "^cvdgfdgghaswere3575676y&*`~cx,xfdgdvcvdfd][';./?.,<>|\\!@#$%^&*()_+=-090wvvs3sdfel33cxvdf***$");
     EXPECT_STREQ(digest, "899a57a99c14c047eab26f8d6719da256a0737f6c28728ba5777b4fc5398c657");
 }
 
-- 
2.25.1

