Improve gmxapi C++ test coverage for failed mdrun.
authorM. Eric Irrgang <ericirrgang@gmail.com>
Tue, 1 Dec 2020 14:11:48 +0000 (17:11 +0300)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 3 Dec 2020 08:53:20 +0000 (08:53 +0000)
Make sure that we test the C++ API to confirm that non-zero mdrun exit
codes are detected when using SIGINT. No additional test execution is
needed. We just add a little more rigor to an existing test.

Ref #3394

src/api/cpp/tests/runner.cpp

index d96760836ee2d1906f67d89bc365d8201213f4e7..4e7f94b33250739e65ee50eadfb14294c5a8d97e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2018, by the GROMACS development team, led by
+ * Copyright (c) 2018,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -95,7 +95,8 @@ TEST_F(GmxApiTest, RunnerReinitialize)
         // Try to simulate an interrupt signal to catch.
         gmx_set_stop_condition(gmx_stop_cond_next_ns);
 
-        session->run();
+        auto status = session->run();
+        EXPECT_FALSE(status.success());
 
         // If this assertion fails, it is not an error, but it indicates expected behavior has
         // changed and we need to consider the impact of whatever changes caused this.
@@ -119,7 +120,8 @@ TEST_F(GmxApiTest, RunnerReinitialize)
         // Launching a session should clear the stop condition.
         EXPECT_EQ(gmx_get_stop_condition(), gmx_stop_cond_none);
 
-        session->run();
+        auto status = session->run();
+        EXPECT_TRUE(status.success());
 
         // Stop condition should still be clear.
         EXPECT_EQ(gmx_get_stop_condition(), gmx_stop_cond_none);