make finding plugins for testing multi-config compatible

This commit is contained in:
Axel Kohlmeyer
2021-10-21 19:22:01 -04:00
parent e75757007e
commit 6ad03498c3
2 changed files with 9 additions and 14 deletions

View File

@ -384,7 +384,12 @@ TEST_F(SimpleCommandsTest, Units)
#if defined(LMP_PLUGIN)
TEST_F(SimpleCommandsTest, Plugin)
{
std::string loadfmt("plugin load {}plugin.so");
const char *bindir = getenv("LAMMPS_PLUGIN_BIN_DIR");
const char *config = getenv("CMAKE_CONFIG_TYPE");
if (!bindir) GTEST_SKIP();
std::string loadfmt = platform::path_join("plugin load ", bindir);
if (config) loadfmt = platform::path_join(loadfmt, config);
loadfmt = platform::path_join(loadfmt, "{}plugin.so");
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, "hello"));
auto text = ::testing::internal::GetCapturedStdout();
@ -395,7 +400,7 @@ TEST_F(SimpleCommandsTest, Plugin)
lmp->input->one(fmt::format(loadfmt, "xxx"));
text = ::testing::internal::GetCapturedStdout();
if (verbose) std::cout << text;
ASSERT_THAT(text, MatchesRegex(".*Open of file xxx.* failed.*"));
ASSERT_THAT(text, MatchesRegex(".*Open of file .*xxx.* failed.*"));
::testing::internal::CaptureStdout();
lmp->input->one(fmt::format(loadfmt, "nve2"));