lcr/0010-remove-file-mode-check-in-ut.patch
jikai 37a4accb5d sync from openeuler
Signed-off-by: jikai <jikai11@huawei.com>
(cherry picked from commit 88f864b1b68c4f612409c7ef6df32c2c90e8f2e8)
2024-04-19 17:47:03 +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/10] 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