lcr/0010-remove-file-mode-check-in-ut.patch
jikai 754dcd5242 sync from upstream
Signed-off-by: jikai <jikai11@huawei.com>
(cherry picked from commit 35815058031561339484cdbdff29d3c4beef7a99)
2024-06-11 19:20:32 +08:00

43 lines
1.3 KiB
Diff

From e7db434109376a88013d739c81c71dd1db86e3a5 Mon Sep 17 00:00:00 2001
From: jikai <jikai11@huawei.com>
Date: Fri, 19 Apr 2024 04:04:12 +0000
Subject: [PATCH 10/14] remove file mode check in ut
Signed-off-by: jikai <jikai11@huawei.com>
---
tests/utils_file_ut.cpp | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/tests/utils_file_ut.cpp b/tests/utils_file_ut.cpp
index 7e98bd8..351a498 100644
--- a/tests/utils_file_ut.cpp
+++ b/tests/utils_file_ut.cpp
@@ -137,8 +137,8 @@ TEST(utils_file_testcase, test_isula_dir_recursive_remove)
TEST(utils_file_testcase, test_isula_file_open_and_remove)
{
std::string path = "/tmp/test";
- struct stat buf;
- int nret;
+ // struct stat buf;
+ // int nret;
int fd;
ASSERT_EQ(isula_file_open(nullptr, O_RDONLY, 0), -1);
@@ -151,9 +151,10 @@ TEST(utils_file_testcase, test_isula_file_open_and_remove)
fd = isula_file_open(path.c_str(), O_RDONLY | O_CREAT, 0640);
ASSERT_NE(fd, -1);
- nret = stat(path.c_str(), &buf);
- ASSERT_EQ(nret, 0);
- ASSERT_EQ(buf.st_mode&0640, 0640);
+ // for some env, the umask set might lead the mode not to be 0644
+ // nret = stat(path.c_str(), &buf);
+ // ASSERT_EQ(nret, 0);
+ // ASSERT_EQ(buf.st_mode&0640, 0640);
close(fd);
ASSERT_EQ(isula_path_remove(path.c_str()), 0);
}
--
2.34.1