1 Star 0 Fork 47

JingWoo/src-iSulad

forked from src-openEuler/iSulad 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0004-run-storage-layers-ut-with-non-root.patch 2.54 KB
一键复制 编辑 原始数据 按行查看 历史
JingWoo 提交于 2022-10-31 15:36 +08:00 . sync from openEuler
From 8c33633d26ec5d5eb9b5ad415afc114cf6c232f3 Mon Sep 17 00:00:00 2001
From: haozi007 <[email protected]>
Date: Tue, 11 Oct 2022 20:34:18 +0800
Subject: [PATCH 04/35] run storage layers ut with non-root
Signed-off-by: haozi007 <[email protected]>
---
test/CMakeLists.txt | 2 ++
test/image/oci/storage/layers/storage_layers_ut.cc | 10 ++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 940de5ce..a36f68c5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,5 +1,7 @@
project(iSulad_UT)
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
+
function(gmock_find_library _name)
find_library(${_name}
NAMES ${ARGN}
diff --git a/test/image/oci/storage/layers/storage_layers_ut.cc b/test/image/oci/storage/layers/storage_layers_ut.cc
index 0b481a95..87dfb4a1 100644
--- a/test/image/oci/storage/layers/storage_layers_ut.cc
+++ b/test/image/oci/storage/layers/storage_layers_ut.cc
@@ -153,7 +153,8 @@ protected:
MockDriverQuota_SetMock(&m_driver_quota_mock);
struct storage_module_init_options opts = {0};
- std::string isulad_dir = "/var/lib/isulad/";
+ std::string isulad_dir = "/tmp/isulad/";
+ mkdir(isulad_dir.c_str(), 0755);
std::string root_dir = isulad_dir + "data";
std::string run_dir = isulad_dir + "data/run";
std::string data_dir = GetDirectory() + "/data";
@@ -167,6 +168,9 @@ protected:
ASSERT_STRNE(util_clean_path(run_dir.c_str(), real_run_path, sizeof(real_run_path)), nullptr);
opts.storage_run_root = strdup(real_run_path);
opts.driver_name = strdup("overlay");
+ opts.driver_opts = static_cast<char **>(util_smart_calloc_s(sizeof(char *), 1));
+ opts.driver_opts[0] = strdup("overlay2.skip_mount_home=true");
+ opts.driver_opts_len = 1;
EXPECT_CALL(m_driver_quota_mock, QuotaCtl(_, _, _, _)).WillRepeatedly(Invoke(invokeQuotaCtl));
ASSERT_EQ(layer_store_init(&opts), 0);
@@ -174,6 +178,8 @@ protected:
free(opts.storage_root);
free(opts.storage_run_root);
free(opts.driver_name);
+ free(opts.driver_opts[0]);
+ free(opts.driver_opts);
}
void TearDown() override
@@ -183,7 +189,7 @@ protected:
layer_store_exit();
layer_store_cleanup();
- std::string rm_command = "rm -rf /var/lib/isulad/data";
+ std::string rm_command = "rm -rf /tmp/isulad/";
ASSERT_EQ(system(rm_command.c_str()), 0);
}
--
2.37.3
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jingwoo/src-iSulad.git
[email protected]:jingwoo/src-iSulad.git
jingwoo
src-iSulad
src-iSulad
master

搜索帮助