diff --git a/unittest/formats/CMakeLists.txt b/unittest/formats/CMakeLists.txt index 7b19bfde46..cd02aed6b0 100644 --- a/unittest/formats/CMakeLists.txt +++ b/unittest/formats/CMakeLists.txt @@ -52,11 +52,10 @@ if(PKG_COMPRESS) set_tests_properties(DumpCustomGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") set_tests_properties(DumpCustomGZ PROPERTIES ENVIRONMENT "GZIP_BINARY=${GZIP_BINARY}") - add_executable(test_dump_cfg_gz test_dump_cfg_gz.cpp) - target_link_libraries(test_dump_cfg_gz PRIVATE lammps GTest::GMock GTest::GTest) - add_test(NAME DumpCfgGZ COMMAND test_dump_cfg_gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(DumpCfgGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") - set_tests_properties(DumpCfgGZ PROPERTIES ENVIRONMENT "GZIP_BINARY=${GZIP_BINARY}") + add_executable(test_dump_cfg_compressed test_dump_cfg_compressed.cpp) + target_link_libraries(test_dump_cfg_compressed PRIVATE lammps GTest::GMock GTest::GTest) + add_test(NAME DumpCfgGZ COMMAND test_dump_cfg_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_tests_properties(DumpCfgGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}") add_executable(test_dump_xyz_gz test_dump_xyz_gz.cpp) target_link_libraries(test_dump_xyz_gz PRIVATE lammps GTest::GMock GTest::GTest) @@ -84,11 +83,8 @@ if(PKG_COMPRESS) set_tests_properties(DumpCustomZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") set_tests_properties(DumpCustomZstd PROPERTIES ENVIRONMENT "ZSTD_BINARY=${ZSTD_BINARY}") - add_executable(test_dump_cfg_zstd test_dump_cfg_zstd.cpp) - target_link_libraries(test_dump_cfg_zstd PRIVATE lammps GTest::GMock GTest::GTest) - add_test(NAME DumpCfgZstd COMMAND test_dump_cfg_zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - set_tests_properties(DumpCfgZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}") - set_tests_properties(DumpCfgZstd PROPERTIES ENVIRONMENT "ZSTD_BINARY=${ZSTD_BINARY}") + add_test(NAME DumpCfgZstd COMMAND test_dump_cfg_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + set_tests_properties(DumpCfgZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}") add_executable(test_dump_xyz_zstd test_dump_xyz_zstd.cpp) target_link_libraries(test_dump_xyz_zstd PRIVATE lammps GTest::GMock GTest::GTest) diff --git a/unittest/formats/compressed_dump_test.h b/unittest/formats/compressed_dump_test.h index 80b8550060..c731a3b1b9 100644 --- a/unittest/formats/compressed_dump_test.h +++ b/unittest/formats/compressed_dump_test.h @@ -64,25 +64,28 @@ public: } void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file, - std::string dump_modify_options, int ntimesteps) + std::string dump_options, std::string dump_modify_options, int ntimesteps) { generate_text_and_compressed_dump(text_file, compressed_file, + dump_options, dump_options, dump_modify_options, dump_modify_options, ntimesteps); } void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file, - std::string text_options, std::string compressed_options, int ntimesteps) + std::string text_options, std::string compressed_options, + std::string text_modify_options, std::string compressed_modify_options, + int ntimesteps) { if (!verbose) ::testing::internal::CaptureStdout(); - command(fmt::format("dump id0 all {} 1 {}", dump_style, text_file)); - command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_file)); + command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, text_options)); + command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file, compressed_options)); - if (!text_options.empty()) { - command(fmt::format("dump_modify id0 {}", text_options)); + if (!text_modify_options.empty()) { + command(fmt::format("dump_modify id0 {}", text_modify_options)); } - if (!compressed_options.empty()) { - command(fmt::format("dump_modify id1 {}", compressed_options)); + if (!compressed_modify_options.empty()) { + command(fmt::format("dump_modify id1 {}", compressed_modify_options)); } command(fmt::format("run {}", ntimesteps)); diff --git a/unittest/formats/test_dump_atom_compressed.cpp b/unittest/formats/test_dump_atom_compressed.cpp index e33366801e..3360872f9e 100644 --- a/unittest/formats/test_dump_atom_compressed.cpp +++ b/unittest/formats/test_dump_atom_compressed.cpp @@ -40,7 +40,7 @@ TEST_F(DumpAtomCompressTest, compressed_run0) auto text_file = text_dump_filename("run0.melt"); auto compressed_file = compressed_dump_filename("run0.melt"); - generate_text_and_compressed_dump(text_file, compressed_file, "", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0); TearDown(); @@ -71,7 +71,7 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_run1) auto compressed_file_0 = compressed_dump_filename(base_name_0); auto compressed_file_1 = compressed_dump_filename(base_name_1); - generate_text_and_compressed_dump(text_file, compressed_file, "", 1); + generate_text_and_compressed_dump(text_file, compressed_file, "", "", 1); TearDown(); @@ -107,7 +107,7 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_pad_run1) auto compressed_file_0 = compressed_dump_filename(base_name_0); auto compressed_file_1 = compressed_dump_filename(base_name_1); - generate_text_and_compressed_dump(text_file, compressed_file, "pad 3", 1); + generate_text_and_compressed_dump(text_file, compressed_file, "", "pad 3", 1); TearDown(); @@ -151,7 +151,7 @@ TEST_F(DumpAtomCompressTest, compressed_multi_file_with_maxfiles_run1) auto compressed_file_1 = compressed_dump_filename(base_name_1); auto compressed_file_2 = compressed_dump_filename(base_name_2); - generate_text_and_compressed_dump(text_file, compressed_file, "maxfiles 2", 2); + generate_text_and_compressed_dump(text_file, compressed_file, "", "maxfiles 2", 2); TearDown(); @@ -188,8 +188,7 @@ TEST_F(DumpAtomCompressTest, compressed_with_units_run0) auto text_file = text_dump_filename(base_name); auto compressed_file = compressed_dump_filename(base_name); - generate_text_and_compressed_dump(text_file, compressed_file, "scale no units yes", - 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0); TearDown(); @@ -213,7 +212,7 @@ TEST_F(DumpAtomCompressTest, compressed_with_time_run0) auto text_file = text_dump_filename(base_name); auto compressed_file = compressed_dump_filename(base_name); - generate_text_and_compressed_dump(text_file, compressed_file, "scale no time yes", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0); TearDown(); @@ -238,7 +237,7 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_run0) auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); - generate_text_and_compressed_dump(text_file, compressed_file, "", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "", 0); TearDown(); @@ -263,7 +262,7 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_units_run0) auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); - generate_text_and_compressed_dump(text_file, compressed_file, "scale no units yes", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no units yes", 0); TearDown(); @@ -288,7 +287,7 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_time_run0) auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); - generate_text_and_compressed_dump(text_file, compressed_file, "scale no time yes", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "scale no time yes", 0); TearDown(); @@ -313,7 +312,7 @@ TEST_F(DumpAtomCompressTest, compressed_triclinic_with_image_run0) auto compressed_file = compressed_dump_filename(base_name); enable_triclinic(); - generate_text_and_compressed_dump(text_file, compressed_file, "image yes", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "image yes", 0); TearDown(); @@ -359,7 +358,7 @@ TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0) auto text_file = text_dump_filename(base_name); auto compressed_file = compressed_dump_filename(base_name); - generate_text_and_compressed_dump(text_file, compressed_file, "", "compression_level 3", 0); + generate_text_and_compressed_dump(text_file, compressed_file, "", "", "", "compression_level 3", 0); TearDown(); diff --git a/unittest/formats/test_dump_cfg_compressed.cpp b/unittest/formats/test_dump_cfg_compressed.cpp new file mode 100644 index 0000000000..d06eabe57b --- /dev/null +++ b/unittest/formats/test_dump_cfg_compressed.cpp @@ -0,0 +1,132 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://lammps.sandia.gov/, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "../testing/utils.h" +#include "compressed_dump_test.h" +#include "fmt/format.h" +#include "utils.h" +#include "gmock/gmock.h" +#include "gtest/gtest.h" + +#include + + +using ::testing::Eq; + +class DumpCfgCompressTest : public CompressedDumpTest { +public: + DumpCfgCompressTest() : CompressedDumpTest("cfg") { + } +}; + +//------------------------------------------------------------------------------------------------- +// compressed files +//------------------------------------------------------------------------------------------------- + +TEST_F(DumpCfgCompressTest, compressed_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "run*.melt.cfg"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + + auto base_name_0 = "run0.melt.cfg"; + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + + generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0); + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + +TEST_F(DumpCfgCompressTest, compressed_unwrap_run0) +{ + if (!COMPRESS_BINARY) GTEST_SKIP(); + + auto base_name = "unwrap_run*.melt.cfg"; + auto text_files = text_dump_filename(base_name); + auto compressed_files = compressed_dump_filename(base_name); + + auto base_name_0 = "unwrap_run0.melt.cfg"; + auto text_file_0 = text_dump_filename(base_name_0); + auto compressed_file_0 = compressed_dump_filename(base_name_0); + auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; + + generate_text_and_compressed_dump(text_files, compressed_files, fields, "", 0); + + TearDown(); + + ASSERT_FILE_EXISTS(text_file_0); + ASSERT_FILE_EXISTS(compressed_file_0); + + auto converted_file_0 = convert_compressed_to_text(compressed_file_0); + + ASSERT_FILE_EXISTS(converted_file_0); + ASSERT_FILE_EQUAL(text_file_0, converted_file_0); + delete_file(text_file_0); + delete_file(compressed_file_0); + delete_file(converted_file_0); +} + +int main(int argc, char **argv) +{ + MPI_Init(&argc, &argv); + ::testing::InitGoogleMock(&argc, argv); + + if (argc < 2) { + std::cerr << "usage: " << argv[0] << " (gz|zstd)\n\n" << std::endl; + return 1; + } + + if(strcmp(argv[1], "gz") == 0) { + COMPRESS_SUFFIX = "gz"; + COMPRESS_EXTENSION = "gz"; + } else if(strcmp(argv[1], "zstd") == 0) { + COMPRESS_SUFFIX = "zstd"; + COMPRESS_EXTENSION = "zst"; + } else { + std::cerr << "usage: " << argv[0] << " (gz|zstd)\n\n" << std::endl; + return 1; + } + + COMPRESS_BINARY = getenv("COMPRESS_BINARY"); + + // handle arguments passed via environment variable + if (const char *var = getenv("TEST_ARGS")) { + std::vector env = utils::split_words(var); + for (auto arg : env) { + if (arg == "-v") { + verbose = true; + } + } + } + + if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; + + int rv = RUN_ALL_TESTS(); + MPI_Finalize(); + return rv; +} diff --git a/unittest/formats/test_dump_cfg_gz.cpp b/unittest/formats/test_dump_cfg_gz.cpp deleted file mode 100644 index ced307dc0a..0000000000 --- a/unittest/formats/test_dump_cfg_gz.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://lammps.sandia.gov/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "../testing/core.h" -#include "../testing/systems/melt.h" -#include "../testing/utils.h" -#include "fmt/format.h" -#include "utils.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -char *GZIP_BINARY = nullptr; - -using ::testing::Eq; - -class DumpCfgGZTest : public MeltTest { - std::string dump_style = "cfg"; - -public: - void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file, - std::string compression_style, std::string fields, - std::string dump_modify_options, int ntimesteps) - { - if (!verbose) ::testing::internal::CaptureStdout(); - command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, fields)); - command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file, fields)); - - if (!dump_modify_options.empty()) { - command(fmt::format("dump_modify id0 {}", dump_modify_options)); - command(fmt::format("dump_modify id1 {}", dump_modify_options)); - } - - command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - std::string convert_compressed_to_text(std::string compressed_file) - { - if (!verbose) ::testing::internal::CaptureStdout(); - std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.')); - std::string cmdline = - fmt::format("{} -d -c {} > {}", GZIP_BINARY, compressed_file, converted_file); - system(cmdline.c_str()); - if (!verbose) ::testing::internal::GetCapturedStdout(); - return converted_file; - } -}; - -TEST_F(DumpCfgGZTest, compressed_run0) -{ - if (!GZIP_BINARY) GTEST_SKIP(); - - auto text_files = "dump_cfg_gz_text_run*.melt.cfg"; - auto compressed_files = "dump_cfg_gz_compressed_run*.melt.cfg.gz"; - auto text_file = "dump_cfg_gz_text_run0.melt.cfg"; - auto compressed_file = "dump_cfg_gz_compressed_run0.melt.cfg.gz"; - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; - - generate_text_and_compressed_dump(text_files, compressed_files, "cfg/gz", fields, "", 0); - - TearDown(); - - ASSERT_FILE_EXISTS(text_file); - ASSERT_FILE_EXISTS(compressed_file); - - auto converted_file = convert_compressed_to_text(compressed_file); - - ASSERT_FILE_EXISTS(converted_file); - ASSERT_FILE_EQUAL(text_file, converted_file); - delete_file(text_file); - delete_file(compressed_file); - delete_file(converted_file); -} - -TEST_F(DumpCfgGZTest, compressed_unwrap_run0) -{ - if (!GZIP_BINARY) GTEST_SKIP(); - - auto text_files = "dump_cfg_unwrap_gz_text_run*.melt.cfg"; - auto compressed_files = "dump_cfg_unwrap_gz_compressed_run*.melt.cfg.gz"; - auto text_file = "dump_cfg_unwrap_gz_text_run0.melt.cfg"; - auto compressed_file = "dump_cfg_unwrap_gz_compressed_run0.melt.cfg.gz"; - auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; - - generate_text_and_compressed_dump(text_files, compressed_files, "cfg/gz", fields, "", 0); - - TearDown(); - - ASSERT_FILE_EXISTS(text_file); - ASSERT_FILE_EXISTS(compressed_file); - - auto converted_file = convert_compressed_to_text(compressed_file); - - ASSERT_FILE_EXISTS(converted_file); - ASSERT_FILE_EQUAL(text_file, converted_file); - delete_file(text_file); - delete_file(compressed_file); - delete_file(converted_file); -} - -int main(int argc, char **argv) -{ - MPI_Init(&argc, &argv); - ::testing::InitGoogleMock(&argc, argv); - - // handle arguments passed via environment variable - if (const char *var = getenv("TEST_ARGS")) { - std::vector env = utils::split_words(var); - for (auto arg : env) { - if (arg == "-v") { - verbose = true; - } - } - } - - GZIP_BINARY = getenv("GZIP_BINARY"); - - if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; - - int rv = RUN_ALL_TESTS(); - MPI_Finalize(); - return rv; -} diff --git a/unittest/formats/test_dump_cfg_zstd.cpp b/unittest/formats/test_dump_cfg_zstd.cpp deleted file mode 100644 index c13a3d5eaf..0000000000 --- a/unittest/formats/test_dump_cfg_zstd.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://lammps.sandia.gov/, Sandia National Laboratories - Steve Plimpton, sjplimp@sandia.gov - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -#include "../testing/core.h" -#include "../testing/systems/melt.h" -#include "../testing/utils.h" -#include "fmt/format.h" -#include "utils.h" -#include "gmock/gmock.h" -#include "gtest/gtest.h" - -char *ZSTD_BINARY = nullptr; - -using ::testing::Eq; - -class DumpCfgZstdTest : public MeltTest { - std::string dump_style = "cfg"; - -public: - void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file, - std::string compression_style, std::string fields, - std::string dump_modify_options, int ntimesteps) - { - if (!verbose) ::testing::internal::CaptureStdout(); - command(fmt::format("dump id0 all {} 1 {} {}", dump_style, text_file, fields)); - command(fmt::format("dump id1 all {} 1 {} {}", compression_style, compressed_file, fields)); - - if (!dump_modify_options.empty()) { - command(fmt::format("dump_modify id0 {}", dump_modify_options)); - command(fmt::format("dump_modify id1 {}", dump_modify_options)); - } - - command(fmt::format("run {}", ntimesteps)); - if (!verbose) ::testing::internal::GetCapturedStdout(); - } - - std::string convert_compressed_to_text(std::string compressed_file) - { - if (!verbose) ::testing::internal::CaptureStdout(); - std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.')); - std::string cmdline = - fmt::format("{} -d -c {} > {}", ZSTD_BINARY, compressed_file, converted_file); - system(cmdline.c_str()); - if (!verbose) ::testing::internal::GetCapturedStdout(); - return converted_file; - } -}; - -TEST_F(DumpCfgZstdTest, compressed_run0) -{ - if (!ZSTD_BINARY) GTEST_SKIP(); - - auto text_files = "dump_cfg_zstd_text_run*.melt.cfg"; - auto compressed_files = "dump_cfg_zstd_compressed_run*.melt.cfg.zst"; - auto text_file = "dump_cfg_zstd_text_run0.melt.cfg"; - auto compressed_file = "dump_cfg_zstd_compressed_run0.melt.cfg.zst"; - auto fields = "mass type xs ys zs id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; - - generate_text_and_compressed_dump(text_files, compressed_files, "cfg/zstd", fields, "", 0); - - TearDown(); - - ASSERT_FILE_EXISTS(text_file); - ASSERT_FILE_EXISTS(compressed_file); - - auto converted_file = convert_compressed_to_text(compressed_file); - - ASSERT_FILE_EXISTS(converted_file); - ASSERT_FILE_EQUAL(text_file, converted_file); - delete_file(text_file); - delete_file(compressed_file); - delete_file(converted_file); -} - -TEST_F(DumpCfgZstdTest, compressed_unwrap_run0) -{ - if (!ZSTD_BINARY) GTEST_SKIP(); - - auto text_files = "dump_cfg_unwrap_zstd_text_run*.melt.cfg"; - auto compressed_files = "dump_cfg_unwrap_zstd_compressed_run*.melt.cfg.zst"; - auto text_file = "dump_cfg_unwrap_zstd_text_run0.melt.cfg"; - auto compressed_file = "dump_cfg_unwrap_zstd_compressed_run0.melt.cfg.zst"; - auto fields = "mass type xsu ysu zsu id proc procp1 x y z ix iy iz vx vy vz fx fy fz"; - - generate_text_and_compressed_dump(text_files, compressed_files, "cfg/zstd", fields, "", 0); - - TearDown(); - - ASSERT_FILE_EXISTS(text_file); - ASSERT_FILE_EXISTS(compressed_file); - - auto converted_file = convert_compressed_to_text(compressed_file); - - ASSERT_FILE_EXISTS(converted_file); - ASSERT_FILE_EQUAL(text_file, converted_file); - delete_file(text_file); - delete_file(compressed_file); - delete_file(converted_file); -} - -int main(int argc, char **argv) -{ - MPI_Init(&argc, &argv); - ::testing::InitGoogleMock(&argc, argv); - - // handle arguments passed via environment variable - if (const char *var = getenv("TEST_ARGS")) { - std::vector env = utils::split_words(var); - for (auto arg : env) { - if (arg == "-v") { - verbose = true; - } - } - } - - ZSTD_BINARY = getenv("ZSTD_BINARY"); - - if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; - - int rv = RUN_ALL_TESTS(); - MPI_Finalize(); - return rv; -}