From 0ddfc3df840414a35cdef095bf89f62d35797a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Sat, 15 May 2021 02:13:45 +0200 Subject: [PATCH] TestReadAfterAIO: Use the local path instead of /tmp for temporal files /tmp might be mounted as tmpfs (default in ArchLinux) which is incompatible with O_DIRECT (https://lore.kernel.org/lkml/459D290B.1040703@tmr.com/t/), making the test fail: ``` [ RUN ] ReadBufferAIOTest.TestReadAfterAIO unknown file: Failure C++ exception with description "Cannot open file /tmp/filei6ZsCa/foo, errno: 22, strerror: Invalid argument" thrown in the test body. [ FAILED ] ReadBufferAIOTest.TestReadAfterAIO (0 ms) ``` Instead create the tmp folder in the local path and delete it at the end --- src/IO/tests/gtest_aio_seek_back_after_eof.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/IO/tests/gtest_aio_seek_back_after_eof.cpp b/src/IO/tests/gtest_aio_seek_back_after_eof.cpp index 5f1c1c0b945..41cf3c5d146 100644 --- a/src/IO/tests/gtest_aio_seek_back_after_eof.cpp +++ b/src/IO/tests/gtest_aio_seek_back_after_eof.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -14,7 +15,7 @@ namespace { std::string createTmpFileForEOFtest() { - char pattern[] = "/tmp/fileXXXXXX"; + char pattern[] = "./EOFtestFolderXXXXXX"; if (char * dir = ::mkdtemp(pattern); dir) { return std::string(dir) + "/foo"; @@ -78,6 +79,11 @@ TEST(ReadBufferAIOTest, TestReadAfterAIO) size_t read_after_eof_big = testbuf.read(repeatdata.data(), repeatdata.size()); EXPECT_EQ(read_after_eof_big, data.length()); EXPECT_TRUE(testbuf.eof()); + + if (file_path[0] != '/') + { + std::filesystem::remove_all(file_path.substr(0, file_path.size() - 4)); + } } #endif