From 91e0d790072939ed34f689d982a9c65ccd19c42a Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 10 Jan 2020 21:41:09 +0300 Subject: [PATCH] Removed old ZSTD test --- utils/compressor/CMakeLists.txt | 12 ------ utils/compressor/zstd_test.cpp | 68 --------------------------------- 2 files changed, 80 deletions(-) delete mode 100644 utils/compressor/zstd_test.cpp diff --git a/utils/compressor/CMakeLists.txt b/utils/compressor/CMakeLists.txt index c032054187b..3498640acd1 100644 --- a/utils/compressor/CMakeLists.txt +++ b/utils/compressor/CMakeLists.txt @@ -1,17 +1,5 @@ -find_package (Threads) - -add_executable (zstd_test zstd_test.cpp) -if(ZSTD_LIBRARY) - target_link_libraries(zstd_test PRIVATE ${ZSTD_LIBRARY}) -endif() -target_link_libraries (zstd_test PRIVATE common) - add_executable (mutator mutator.cpp) target_link_libraries(mutator PRIVATE clickhouse_common_io) add_executable (decompress_perf decompress_perf.cpp) target_link_libraries(decompress_perf PRIVATE dbms ${LZ4_LIBRARY}) - -if (NOT USE_INTERNAL_ZSTD_LIBRARY AND ZSTD_INCLUDE_DIR) - target_include_directories (zstd_test BEFORE PRIVATE ${ZSTD_INCLUDE_DIR}) -endif () diff --git a/utils/compressor/zstd_test.cpp b/utils/compressor/zstd_test.cpp deleted file mode 100644 index 01016830e7d..00000000000 --- a/utils/compressor/zstd_test.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include - - -int main(int argc, char ** argv) -{ - bool compress = argc == 1; - - const size_t size = 1048576; - std::vector src_buf(size); - std::vector dst_buf; - - size_t pos = 0; - while (true) - { - ssize_t read_res = read(STDIN_FILENO, &src_buf[pos], size - pos); - if (read_res < 0) - throw std::runtime_error("Cannot read from stdin"); - if (read_res == 0) - break; - pos += read_res; - } - - src_buf.resize(pos); - - size_t zstd_res; - - if (compress) - { - dst_buf.resize(ZSTD_compressBound(src_buf.size())); - - zstd_res = ZSTD_compress( - &dst_buf[0], - dst_buf.size(), - &src_buf[0], - src_buf.size(), - 1); - } - else - { - dst_buf.resize(size); - - zstd_res = ZSTD_decompress( - &dst_buf[0], - dst_buf.size(), - &src_buf[0], - src_buf.size()); - } - - if (ZSTD_isError(zstd_res)) - throw std::runtime_error(ZSTD_getErrorName(zstd_res)); - - dst_buf.resize(zstd_res); - - pos = 0; - while (pos < dst_buf.size()) - { - ssize_t write_res = write(STDOUT_FILENO, &dst_buf[pos], dst_buf.size()); - if (write_res <= 0) - throw std::runtime_error("Cannot write to stdout"); - pos += write_res; - } - - return 0; -}