1 /* ---------------------------------------------------------------------- 2 LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator 3 https://www.lammps.org/ Sandia National Laboratories 4 Steve Plimpton, sjplimp@sandia.gov 5 6 Copyright (2003) Sandia Corporation. Under the terms of Contract 7 DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains 8 certain rights in this software. This software is distributed under 9 the GNU General Public License. 10 11 See the README file in the top-level LAMMPS directory. 12 ------------------------------------------------------------------------- */ 13 14 #include "../testing/utils.h" 15 #include "compressed_dump_test.h" 16 #include "fmt/format.h" 17 #include "utils.h" 18 #include "gmock/gmock.h" 19 #include "gtest/gtest.h" 20 21 #include <string> 22 23 const char *COMPRESS_SUFFIX = nullptr; 24 const char *COMPRESS_EXTENSION = nullptr; 25 char *COMPRESS_BINARY = nullptr; 26 bool verbose = false; 27 main(int argc,char ** argv)28int main(int argc, char **argv) 29 { 30 MPI_Init(&argc, &argv); 31 ::testing::InitGoogleMock(&argc, argv); 32 33 if (argc < 2) { 34 std::cerr << "usage: " << argv[0] << " (gz|zstd)\n\n" << std::endl; 35 return 1; 36 } 37 38 if (strcmp(argv[1], "gz") == 0) { 39 COMPRESS_SUFFIX = "gz"; 40 COMPRESS_EXTENSION = "gz"; 41 } else if (strcmp(argv[1], "zstd") == 0) { 42 COMPRESS_SUFFIX = "zstd"; 43 COMPRESS_EXTENSION = "zst"; 44 } else { 45 std::cerr << "usage: " << argv[0] << " (gz|zstd)\n\n" << std::endl; 46 return 1; 47 } 48 49 COMPRESS_BINARY = getenv("COMPRESS_BINARY"); 50 51 // handle arguments passed via environment variable 52 if (const char *var = getenv("TEST_ARGS")) { 53 std::vector<std::string> env = utils::split_words(var); 54 for (auto arg : env) { 55 if (arg == "-v") { 56 verbose = true; 57 } 58 } 59 } 60 61 if ((argc > 1) && (strcmp(argv[1], "-v") == 0)) verbose = true; 62 63 int rv = RUN_ALL_TESTS(); 64 MPI_Finalize(); 65 return rv; 66 } 67