Unify dump atom/gz and atom/zstd tests
This commit is contained in:
@ -40,11 +40,11 @@ set_tests_properties(DumpAtom PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS
|
|||||||
if(PKG_COMPRESS)
|
if(PKG_COMPRESS)
|
||||||
find_program(GZIP_BINARY NAMES gzip REQUIRED)
|
find_program(GZIP_BINARY NAMES gzip REQUIRED)
|
||||||
|
|
||||||
add_executable(test_dump_atom_gz test_dump_atom_gz.cpp)
|
add_executable(test_dump_atom_compressed test_dump_atom_compressed.cpp)
|
||||||
target_link_libraries(test_dump_atom_gz PRIVATE lammps GTest::GMock GTest::GTest)
|
target_link_libraries(test_dump_atom_compressed PRIVATE lammps GTest::GMock GTest::GTest)
|
||||||
add_test(NAME DumpAtomGZ COMMAND test_dump_atom_gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
set_tests_properties(DumpAtomGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
add_test(NAME DumpAtomGZ COMMAND test_dump_atom_compressed gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
set_tests_properties(DumpAtomGZ PROPERTIES ENVIRONMENT "GZIP_BINARY=${GZIP_BINARY}")
|
set_tests_properties(DumpAtomGZ PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${GZIP_BINARY}")
|
||||||
|
|
||||||
add_executable(test_dump_custom_gz test_dump_custom_gz.cpp)
|
add_executable(test_dump_custom_gz test_dump_custom_gz.cpp)
|
||||||
target_link_libraries(test_dump_custom_gz PRIVATE lammps GTest::GMock GTest::GTest)
|
target_link_libraries(test_dump_custom_gz PRIVATE lammps GTest::GMock GTest::GTest)
|
||||||
@ -75,11 +75,8 @@ if(PKG_COMPRESS)
|
|||||||
find_program(ZSTD_BINARY NAMES zstd)
|
find_program(ZSTD_BINARY NAMES zstd)
|
||||||
|
|
||||||
if(Zstd_FOUND AND ZSTD_BINARY)
|
if(Zstd_FOUND AND ZSTD_BINARY)
|
||||||
add_executable(test_dump_atom_zstd test_dump_atom_zstd.cpp)
|
add_test(NAME DumpAtomZstd COMMAND test_dump_atom_compressed zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
target_link_libraries(test_dump_atom_zstd PRIVATE lammps GTest::GMock GTest::GTest)
|
set_tests_properties(DumpAtomZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR};COMPRESS_BINARY=${ZSTD_BINARY}")
|
||||||
add_test(NAME DumpAtomZstd COMMAND test_dump_atom_zstd WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
set_tests_properties(DumpAtomZstd PROPERTIES ENVIRONMENT "LAMMPS_POTENTIALS=${LAMMPS_POTENTIALS_DIR}")
|
|
||||||
set_tests_properties(DumpAtomZstd PROPERTIES ENVIRONMENT "ZSTD_BINARY=${ZSTD_BINARY}")
|
|
||||||
|
|
||||||
add_executable(test_dump_custom_zstd test_dump_custom_zstd.cpp)
|
add_executable(test_dump_custom_zstd test_dump_custom_zstd.cpp)
|
||||||
target_link_libraries(test_dump_custom_zstd PRIVATE lammps GTest::GMock GTest::GTest)
|
target_link_libraries(test_dump_custom_zstd PRIVATE lammps GTest::GMock GTest::GTest)
|
||||||
|
|||||||
@ -21,14 +21,36 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
char *GZIP_BINARY = nullptr;
|
const char * COMPRESS_SUFFIX = nullptr;
|
||||||
|
const char * COMPRESS_EXTENSION = nullptr;
|
||||||
|
char * COMPRESS_BINARY = nullptr;
|
||||||
|
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
|
|
||||||
class DumpAtomGZTest : public MeltTest {
|
class DumpAtomCompressTest : public MeltTest {
|
||||||
|
protected:
|
||||||
std::string dump_style = "atom";
|
std::string dump_style = "atom";
|
||||||
|
std::string compression_style = "";
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void SetUp() override
|
||||||
|
{
|
||||||
|
MeltTest::SetUp();
|
||||||
|
compression_style = fmt::format("{}/{}", dump_style, COMPRESS_SUFFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string text_dump_filename(std::string ident) {
|
||||||
|
return fmt::format("dump_{}_text_{}", COMPRESS_SUFFIX, ident);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string compressed_dump_filename(std::string ident) {
|
||||||
|
return fmt::format("dump_{}_compressed_{}.{}", COMPRESS_SUFFIX, ident, COMPRESS_EXTENSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string converted_dump_filename(std::string ident) {
|
||||||
|
return fmt::format("dump_{}_compressed_{}", COMPRESS_SUFFIX, ident);
|
||||||
|
}
|
||||||
|
|
||||||
void enable_triclinic()
|
void enable_triclinic()
|
||||||
{
|
{
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
@ -50,15 +72,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
||||||
std::string compression_style,
|
|
||||||
std::string dump_modify_options, int ntimesteps)
|
std::string dump_modify_options, int ntimesteps)
|
||||||
{
|
{
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, compression_style,
|
generate_text_and_compressed_dump(text_file, compressed_file,
|
||||||
dump_modify_options, dump_modify_options, ntimesteps);
|
dump_modify_options, dump_modify_options, ntimesteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
||||||
std::string compression_style,
|
|
||||||
std::string text_options, std::string compressed_options, int ntimesteps)
|
std::string text_options, std::string compressed_options, int ntimesteps)
|
||||||
{
|
{
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
@ -82,7 +102,7 @@ public:
|
|||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
if (!verbose) ::testing::internal::CaptureStdout();
|
||||||
std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.'));
|
std::string converted_file = compressed_file.substr(0, compressed_file.find_last_of('.'));
|
||||||
std::string cmdline =
|
std::string cmdline =
|
||||||
fmt::format("{} -d -c {} > {}", GZIP_BINARY, compressed_file, converted_file);
|
fmt::format("{} -d -c {} > {}", COMPRESS_BINARY, compressed_file, converted_file);
|
||||||
system(cmdline.c_str());
|
system(cmdline.c_str());
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
if (!verbose) ::testing::internal::GetCapturedStdout();
|
||||||
return converted_file;
|
return converted_file;
|
||||||
@ -90,17 +110,17 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
// GZ compressed files
|
// compressed files
|
||||||
//-------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_run0)
|
TEST_F(DumpAtomCompressTest, compressed_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_run0.melt";
|
auto text_file = text_dump_filename("run0.melt");
|
||||||
auto compressed_file = "dump_gz_compressed_run0.melt.gz";
|
auto compressed_file = compressed_dump_filename("run0.melt");
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/gz", "", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -109,7 +129,7 @@ TEST_F(DumpAtomGZTest, compressed_run0)
|
|||||||
|
|
||||||
auto converted_file = convert_compressed_to_text(compressed_file);
|
auto converted_file = convert_compressed_to_text(compressed_file);
|
||||||
|
|
||||||
ASSERT_THAT(converted_file, Eq("dump_gz_compressed_run0.melt"));
|
ASSERT_THAT(converted_file, Eq(converted_dump_filename("run0.melt")));
|
||||||
ASSERT_FILE_EXISTS(converted_file);
|
ASSERT_FILE_EXISTS(converted_file);
|
||||||
ASSERT_FILE_EQUAL(text_file, converted_file);
|
ASSERT_FILE_EQUAL(text_file, converted_file);
|
||||||
delete_file(text_file);
|
delete_file(text_file);
|
||||||
@ -117,31 +137,29 @@ TEST_F(DumpAtomGZTest, compressed_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_multi_file_run1)
|
TEST_F(DumpAtomCompressTest, compressed_multi_file_run1)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_multi_file_run1_*.melt";
|
auto base_name = "multi_file_run1_*.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_multi_file_run1_*.melt.gz";
|
auto base_name_0 = "multi_file_run1_0.melt";
|
||||||
auto text_file_0 = "dump_gz_text_multi_file_run1_0.melt";
|
auto base_name_1 = "multi_file_run1_1.melt";
|
||||||
auto text_file_1 = "dump_gz_text_multi_file_run1_1.melt";
|
auto text_file = text_dump_filename(base_name);
|
||||||
auto compressed_file_0 = "dump_gz_compressed_multi_file_run1_0.melt.gz";
|
auto text_file_0 = text_dump_filename(base_name_0);
|
||||||
auto compressed_file_1 = "dump_gz_compressed_multi_file_run1_1.melt.gz";
|
auto text_file_1 = text_dump_filename(base_name_1);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
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, "atom/gz", "", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", 1);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
ASSERT_FILE_EXISTS(text_file_0);
|
|
||||||
ASSERT_FILE_EXISTS(text_file_1);
|
|
||||||
ASSERT_FILE_EXISTS(compressed_file_0);
|
|
||||||
ASSERT_FILE_EXISTS(compressed_file_1);
|
|
||||||
|
|
||||||
auto converted_file_0 = convert_compressed_to_text(compressed_file_0);
|
auto converted_file_0 = convert_compressed_to_text(compressed_file_0);
|
||||||
auto converted_file_1 = convert_compressed_to_text(compressed_file_1);
|
auto converted_file_1 = convert_compressed_to_text(compressed_file_1);
|
||||||
|
|
||||||
ASSERT_THAT(converted_file_0, Eq("dump_gz_compressed_multi_file_run1_0.melt"));
|
ASSERT_THAT(converted_file_0, Eq(converted_dump_filename(base_name_0)));
|
||||||
ASSERT_THAT(converted_file_1, Eq("dump_gz_compressed_multi_file_run1_1.melt"));
|
ASSERT_THAT(converted_file_1, Eq(converted_dump_filename(base_name_1)));
|
||||||
ASSERT_FILE_EXISTS(converted_file_0);
|
ASSERT_FILE_EXISTS(converted_file_0);
|
||||||
ASSERT_FILE_EXISTS(converted_file_1);
|
ASSERT_FILE_EXISTS(converted_file_1);
|
||||||
ASSERT_FILE_EQUAL(text_file_0, converted_file_0);
|
ASSERT_FILE_EQUAL(text_file_0, converted_file_0);
|
||||||
@ -155,18 +173,21 @@ TEST_F(DumpAtomGZTest, compressed_multi_file_run1)
|
|||||||
delete_file(converted_file_1);
|
delete_file(converted_file_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_multi_file_with_pad_run1)
|
TEST_F(DumpAtomCompressTest, compressed_multi_file_with_pad_run1)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_multi_file_pad_run1_*.melt";
|
auto base_name = "multi_file_pad_run1_*.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_multi_file_pad_run1_*.melt.gz";
|
auto base_name_0 = "multi_file_pad_run1_000.melt";
|
||||||
auto text_file_0 = "dump_gz_text_multi_file_pad_run1_000.melt";
|
auto base_name_1 = "multi_file_pad_run1_001.melt";
|
||||||
auto text_file_1 = "dump_gz_text_multi_file_pad_run1_001.melt";
|
auto text_file = text_dump_filename(base_name);
|
||||||
auto compressed_file_0 = "dump_gz_compressed_multi_file_pad_run1_000.melt.gz";
|
auto text_file_0 = text_dump_filename(base_name_0);
|
||||||
auto compressed_file_1 = "dump_gz_compressed_multi_file_pad_run1_001.melt.gz";
|
auto text_file_1 = text_dump_filename(base_name_1);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
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, "atom/gz", "pad 3", 1);
|
generate_text_and_compressed_dump(text_file, compressed_file, "pad 3", 1);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -178,8 +199,8 @@ TEST_F(DumpAtomGZTest, compressed_multi_file_with_pad_run1)
|
|||||||
auto converted_file_0 = convert_compressed_to_text(compressed_file_0);
|
auto converted_file_0 = convert_compressed_to_text(compressed_file_0);
|
||||||
auto converted_file_1 = convert_compressed_to_text(compressed_file_1);
|
auto converted_file_1 = convert_compressed_to_text(compressed_file_1);
|
||||||
|
|
||||||
ASSERT_THAT(converted_file_0, Eq("dump_gz_compressed_multi_file_pad_run1_000.melt"));
|
ASSERT_THAT(converted_file_0, Eq(converted_dump_filename(base_name_0)));
|
||||||
ASSERT_THAT(converted_file_1, Eq("dump_gz_compressed_multi_file_pad_run1_001.melt"));
|
ASSERT_THAT(converted_file_1, Eq(converted_dump_filename(base_name_1)));
|
||||||
ASSERT_FILE_EXISTS(converted_file_0);
|
ASSERT_FILE_EXISTS(converted_file_0);
|
||||||
ASSERT_FILE_EXISTS(converted_file_1);
|
ASSERT_FILE_EXISTS(converted_file_1);
|
||||||
ASSERT_FILE_EQUAL(text_file_0, converted_file_0);
|
ASSERT_FILE_EQUAL(text_file_0, converted_file_0);
|
||||||
@ -193,20 +214,24 @@ TEST_F(DumpAtomGZTest, compressed_multi_file_with_pad_run1)
|
|||||||
delete_file(converted_file_1);
|
delete_file(converted_file_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_multi_file_with_maxfiles_run1)
|
TEST_F(DumpAtomCompressTest, compressed_multi_file_with_maxfiles_run1)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_multi_file_run1_*.melt";
|
auto base_name = "multi_file_maxfiles_run1_*.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_multi_file_run1_*.melt.gz";
|
auto base_name_0 = "multi_file_maxfiles_run1_0.melt";
|
||||||
auto text_file_0 = "dump_gz_text_multi_file_run1_0.melt";
|
auto base_name_1 = "multi_file_maxfiles_run1_1.melt";
|
||||||
auto text_file_1 = "dump_gz_text_multi_file_run1_1.melt";
|
auto base_name_2 = "multi_file_maxfiles_run1_2.melt";
|
||||||
auto text_file_2 = "dump_gz_text_multi_file_run1_2.melt";
|
auto text_file = text_dump_filename(base_name);
|
||||||
auto compressed_file_0 = "dump_gz_compressed_multi_file_run1_0.melt.gz";
|
auto text_file_0 = text_dump_filename(base_name_0);
|
||||||
auto compressed_file_1 = "dump_gz_compressed_multi_file_run1_1.melt.gz";
|
auto text_file_1 = text_dump_filename(base_name_1);
|
||||||
auto compressed_file_2 = "dump_gz_compressed_multi_file_run1_2.melt.gz";
|
auto text_file_2 = text_dump_filename(base_name_2);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
auto compressed_file_0 = compressed_dump_filename(base_name_0);
|
||||||
|
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, "atom/gz", "maxfiles 2", 2);
|
generate_text_and_compressed_dump(text_file, compressed_file, "maxfiles 2", 2);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -220,8 +245,8 @@ TEST_F(DumpAtomGZTest, compressed_multi_file_with_maxfiles_run1)
|
|||||||
auto converted_file_1 = convert_compressed_to_text(compressed_file_1);
|
auto converted_file_1 = convert_compressed_to_text(compressed_file_1);
|
||||||
auto converted_file_2 = convert_compressed_to_text(compressed_file_2);
|
auto converted_file_2 = convert_compressed_to_text(compressed_file_2);
|
||||||
|
|
||||||
ASSERT_THAT(converted_file_1, Eq("dump_gz_compressed_multi_file_run1_1.melt"));
|
ASSERT_THAT(converted_file_1, Eq(converted_dump_filename(base_name_1)));
|
||||||
ASSERT_THAT(converted_file_2, Eq("dump_gz_compressed_multi_file_run1_2.melt"));
|
ASSERT_THAT(converted_file_2, Eq(converted_dump_filename(base_name_2)));
|
||||||
ASSERT_FILE_EXISTS(converted_file_1);
|
ASSERT_FILE_EXISTS(converted_file_1);
|
||||||
ASSERT_FILE_EXISTS(converted_file_2);
|
ASSERT_FILE_EXISTS(converted_file_2);
|
||||||
ASSERT_FILE_EQUAL(text_file_1, converted_file_1);
|
ASSERT_FILE_EQUAL(text_file_1, converted_file_1);
|
||||||
@ -235,14 +260,15 @@ TEST_F(DumpAtomGZTest, compressed_multi_file_with_maxfiles_run1)
|
|||||||
delete_file(converted_file_2);
|
delete_file(converted_file_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_with_units_run0)
|
TEST_F(DumpAtomCompressTest, compressed_with_units_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_with_units_run0.melt";
|
auto base_name = "with_units_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_with_units_run0.melt.gz";
|
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, "atom/gz", "scale no units yes",
|
generate_text_and_compressed_dump(text_file, compressed_file, "scale no units yes",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
@ -259,15 +285,15 @@ TEST_F(DumpAtomGZTest, compressed_with_units_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_with_time_run0)
|
TEST_F(DumpAtomCompressTest, compressed_with_time_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_with_time_run0.melt";
|
auto base_name = "with_time_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_with_time_run0.melt.gz";
|
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, "atom/gz", "scale no time yes",
|
generate_text_and_compressed_dump(text_file, compressed_file, "scale no time yes", 0);
|
||||||
0);
|
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -283,15 +309,16 @@ TEST_F(DumpAtomGZTest, compressed_with_time_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_triclinic_run0)
|
TEST_F(DumpAtomCompressTest, compressed_triclinic_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_tri_run0.melt";
|
auto base_name = "tri_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_tri_run0.melt.gz";
|
auto text_file = text_dump_filename(base_name);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
enable_triclinic();
|
enable_triclinic();
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/gz", "", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -307,16 +334,16 @@ TEST_F(DumpAtomGZTest, compressed_triclinic_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_triclinic_with_units_run0)
|
TEST_F(DumpAtomCompressTest, compressed_triclinic_with_units_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_tri_with_units_run0.melt";
|
auto base_name = "tri_with_units_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_tri_with_units_run0.melt.gz";
|
auto text_file = text_dump_filename(base_name);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
enable_triclinic();
|
enable_triclinic();
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/gz", "scale no units yes",
|
generate_text_and_compressed_dump(text_file, compressed_file, "scale no units yes", 0);
|
||||||
0);
|
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -332,16 +359,16 @@ TEST_F(DumpAtomGZTest, compressed_triclinic_with_units_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_triclinic_with_time_run0)
|
TEST_F(DumpAtomCompressTest, compressed_triclinic_with_time_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_tri_with_time_run0.melt";
|
auto base_name = "tri_with_time_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_tri_with_time_run0.melt.gz";
|
auto text_file = text_dump_filename(base_name);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
enable_triclinic();
|
enable_triclinic();
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/gz", "scale no time yes",
|
generate_text_and_compressed_dump(text_file, compressed_file, "scale no time yes", 0);
|
||||||
0);
|
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -357,15 +384,16 @@ TEST_F(DumpAtomGZTest, compressed_triclinic_with_time_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_triclinic_with_image_run0)
|
TEST_F(DumpAtomCompressTest, compressed_triclinic_with_image_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_tri_with_image_run0.melt";
|
auto base_name = "tri_with_image_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_tri_with_image_run0.melt.gz";
|
auto text_file = text_dump_filename(base_name);
|
||||||
|
auto compressed_file = compressed_dump_filename(base_name);
|
||||||
|
|
||||||
enable_triclinic();
|
enable_triclinic();
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/gz", "image yes", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "image yes", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -381,32 +409,37 @@ TEST_F(DumpAtomGZTest, compressed_triclinic_with_image_run0)
|
|||||||
delete_file(converted_file);
|
delete_file(converted_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_modify_bad_param)
|
TEST_F(DumpAtomCompressTest, compressed_modify_bad_param)
|
||||||
{
|
{
|
||||||
command("dump id1 all atom/gz 1 dump_gz_text_modify_bad_param_run0_*.melt.gz");
|
if (compression_style != "atom/gz") GTEST_SKIP();
|
||||||
|
|
||||||
|
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_bad_param_run0_*.melt")));
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
|
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
|
||||||
command("dump_modify id1 compression_level 12");
|
command("dump_modify id1 compression_level 12");
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_modify_multi_bad_param)
|
TEST_F(DumpAtomCompressTest, compressed_modify_multi_bad_param)
|
||||||
{
|
{
|
||||||
command("dump id1 all atom/gz 1 dump_gz_text_modify_bad_param_run0_*.melt.gz");
|
if (compression_style != "atom/gz") GTEST_SKIP();
|
||||||
|
|
||||||
|
command(fmt::format("dump id1 all {} 1 {}", compression_style, compressed_dump_filename("modify_multi_bad_param_run0_*.melt")));
|
||||||
|
|
||||||
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
|
TEST_FAILURE(".*ERROR: Illegal dump_modify command: compression level must in the range of.*",
|
||||||
command("dump_modify id1 pad 3 compression_level 12");
|
command("dump_modify id1 pad 3 compression_level 12");
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(DumpAtomGZTest, compressed_modify_clevel_run0)
|
TEST_F(DumpAtomCompressTest, compressed_modify_clevel_run0)
|
||||||
{
|
{
|
||||||
if (!GZIP_BINARY) GTEST_SKIP();
|
if (!COMPRESS_BINARY) GTEST_SKIP();
|
||||||
|
|
||||||
auto text_file = "dump_gz_text_modify_clevel_run0.melt";
|
auto base_name = "modify_clevel_run0.melt";
|
||||||
auto compressed_file = "dump_gz_compressed_modify_clevel_run0.melt.gz";
|
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, "atom/gz", "", "compression_level 3", 0);
|
generate_text_and_compressed_dump(text_file, compressed_file, "", "compression_level 3", 0);
|
||||||
|
|
||||||
TearDown();
|
TearDown();
|
||||||
|
|
||||||
@ -415,7 +448,7 @@ TEST_F(DumpAtomGZTest, compressed_modify_clevel_run0)
|
|||||||
|
|
||||||
auto converted_file = convert_compressed_to_text(compressed_file);
|
auto converted_file = convert_compressed_to_text(compressed_file);
|
||||||
|
|
||||||
ASSERT_THAT(converted_file, Eq("dump_gz_compressed_modify_clevel_run0.melt"));
|
ASSERT_THAT(converted_file, Eq(converted_dump_filename(base_name)));
|
||||||
ASSERT_FILE_EXISTS(converted_file);
|
ASSERT_FILE_EXISTS(converted_file);
|
||||||
ASSERT_FILE_EQUAL(text_file, converted_file);
|
ASSERT_FILE_EQUAL(text_file, converted_file);
|
||||||
delete_file(text_file);
|
delete_file(text_file);
|
||||||
@ -428,6 +461,24 @@ int main(int argc, char **argv)
|
|||||||
MPI_Init(&argc, &argv);
|
MPI_Init(&argc, &argv);
|
||||||
::testing::InitGoogleMock(&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
|
// handle arguments passed via environment variable
|
||||||
if (const char *var = getenv("TEST_ARGS")) {
|
if (const char *var = getenv("TEST_ARGS")) {
|
||||||
std::vector<std::string> env = utils::split_words(var);
|
std::vector<std::string> env = utils::split_words(var);
|
||||||
@ -438,8 +489,6 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GZIP_BINARY = getenv("GZIP_BINARY");
|
|
||||||
|
|
||||||
if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true;
|
if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true;
|
||||||
|
|
||||||
int rv = RUN_ALL_TESTS();
|
int rv = RUN_ALL_TESTS();
|
||||||
@ -1,284 +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"
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
char *ZSTD_BINARY = nullptr;
|
|
||||||
|
|
||||||
using ::testing::Eq;
|
|
||||||
|
|
||||||
class DumpAtomZSTDTest : public MeltTest {
|
|
||||||
std::string dump_style = "atom";
|
|
||||||
|
|
||||||
public:
|
|
||||||
void enable_triclinic()
|
|
||||||
{
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
|
||||||
command("change_box all triclinic");
|
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
|
||||||
}
|
|
||||||
|
|
||||||
void generate_dump(std::string dump_file, std::string dump_modify_options, int ntimesteps)
|
|
||||||
{
|
|
||||||
if (!verbose) ::testing::internal::CaptureStdout();
|
|
||||||
command(fmt::format("dump id all {} 1 {}", dump_style, dump_file));
|
|
||||||
|
|
||||||
if (!dump_modify_options.empty()) {
|
|
||||||
command(fmt::format("dump_modify id {}", dump_modify_options));
|
|
||||||
}
|
|
||||||
|
|
||||||
command(fmt::format("run {}", ntimesteps));
|
|
||||||
if (!verbose) ::testing::internal::GetCapturedStdout();
|
|
||||||
}
|
|
||||||
|
|
||||||
void generate_text_and_compressed_dump(std::string text_file, std::string compressed_file,
|
|
||||||
std::string compression_style,
|
|
||||||
std::string dump_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));
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
|
||||||
// ZSTD compressed files
|
|
||||||
//-------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
TEST_F(DumpAtomZSTDTest, compressed_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_run0.melt.zst";
|
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "", 0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
TearDown();
|
|
||||||
|
|
||||||
ASSERT_FILE_EXISTS(text_file);
|
|
||||||
ASSERT_FILE_EXISTS(compressed_file);
|
|
||||||
|
|
||||||
auto converted_file = convert_compressed_to_text(compressed_file);
|
|
||||||
|
|
||||||
ASSERT_THAT(converted_file, Eq("dump_zstd_compressed_run0.melt"));
|
|
||||||
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(DumpAtomZSTDTest, compressed_with_units_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_with_units_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_with_units_run0.melt.zst";
|
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "scale no units yes",
|
|
||||||
0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
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(DumpAtomZSTDTest, compressed_with_time_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_with_time_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_with_time_run0.melt.zst";
|
|
||||||
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "scale no time yes",
|
|
||||||
0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
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(DumpAtomZSTDTest, compressed_triclinic_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_tri_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_tri_run0.melt.zst";
|
|
||||||
|
|
||||||
enable_triclinic();
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "", 0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
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(DumpAtomZSTDTest, compressed_triclinic_with_units_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_tri_with_units_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_tri_with_units_run0.melt.zst";
|
|
||||||
|
|
||||||
enable_triclinic();
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "scale no units yes",
|
|
||||||
0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
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(DumpAtomZSTDTest, compressed_triclinic_with_time_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_tri_with_time_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_tri_with_time_run0.melt.zst";
|
|
||||||
|
|
||||||
enable_triclinic();
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "scale no time yes",
|
|
||||||
0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
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(DumpAtomZSTDTest, compressed_triclinic_with_image_run0)
|
|
||||||
{
|
|
||||||
if (!ZSTD_BINARY) GTEST_SKIP();
|
|
||||||
|
|
||||||
auto text_file = "dump_zstd_text_tri_with_image_run0.melt";
|
|
||||||
auto compressed_file = "dump_zstd_compressed_tri_with_image_run0.melt.zst";
|
|
||||||
|
|
||||||
enable_triclinic();
|
|
||||||
generate_text_and_compressed_dump(text_file, compressed_file, "atom/zstd", "image yes", 0);
|
|
||||||
|
|
||||||
// make sure file is closed
|
|
||||||
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<std::string> 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;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user