diff --git a/dbms/src/IO/tests/gtest_aio_seek_back_after_eof.cpp b/dbms/src/IO/tests/gtest_aio_seek_back_after_eof.cpp index b65c7c0c5d6..35c2db70564 100644 --- a/dbms/src/IO/tests/gtest_aio_seek_back_after_eof.cpp +++ b/dbms/src/IO/tests/gtest_aio_seek_back_after_eof.cpp @@ -6,17 +6,28 @@ #include #include #include +#include namespace { std::string createTmpFileForEOFtest() { char pattern[] = "/tmp/fileXXXXXX"; - char * dir = ::mkdtemp(pattern); - return std::string(dir) + "/foo"; + if (char * dir = ::mkdtemp(pattern); dir) + { + return std::string(dir) + "/foo"; + } + else + { + /// We have no tmp in docker + /// So we have to use root + std::string almost_rand_dir = std::string{"/"} + std::to_string(rand()) + "foo"; + return almost_rand_dir; + } + } -void prepare_for_eof(std::string & filename, std::string & buf) +void prepareForEOF(std::string & filename, std::string & buf) { static const std::string symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; @@ -28,7 +39,7 @@ void prepare_for_eof(std::string & filename, std::string & buf) for (size_t i = 0; i < n; ++i) buf += symbols[i % symbols.length()]; - std::ofstream out(filename.c_str()); + std::ofstream out(filename); out << buf; } @@ -39,7 +50,7 @@ TEST(ReadBufferAIOTest, TestReadAfterAIO) using namespace DB; std::string data; std::string file_path; - prepare_for_eof(file_path, data); + prepareForEOF(file_path, data); ReadBufferAIO testbuf(file_path); std::string newdata; diff --git a/docker/test/unit/Dockerfile b/docker/test/unit/Dockerfile index 5d947938852..ae5ea1820b0 100644 --- a/docker/test/unit/Dockerfile +++ b/docker/test/unit/Dockerfile @@ -3,6 +3,7 @@ FROM yandex/clickhouse-stateless-test ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get install gdb CMD ln -s /usr/lib/llvm-8/bin/llvm-symbolizer /usr/bin/llvm-symbolizer; \ echo "TSAN_OPTIONS='halt_on_error=1 history_size=7'" >> /etc/environment; \ @@ -12,4 +13,4 @@ CMD ln -s /usr/lib/llvm-8/bin/llvm-symbolizer /usr/bin/llvm-symbolizer; \ echo "TSAN_SYMBOLIZER_PATH=/usr/lib/llvm-8/bin/llvm-symbolizer" >> /etc/environment; \ echo "LLVM_SYMBOLIZER_PATH=/usr/lib/llvm-6.0/bin/llvm-symbolizer" >> /etc/environment; \ service zookeeper start && sleep 7 && /usr/share/zookeeper/bin/zkCli.sh -server localhost:2181 -create create /clickhouse_test ''; \ - /unit_tests_dbms | tee test_output/test_result.txt + gdb -q -ex 'set print inferior-events off' -ex 'set confirm off' -ex 'set print thread-events off' -ex run -ex bt -ex quit --args ./unit_tests_dbms | tee test_output/test_result.txt