Skip to content

Commit

Permalink
disable XPress tests if the license is not correctly installed
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed Jan 29, 2025
1 parent 780dc3d commit bfb987f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ortools/math_opt/solvers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ if(USE_XPRESS)
SOURCES
"xpress_solver_test.cc"
LINK_LIBRARIES
GTest::gmock
GTest::gmock_main
GTest::gtest
absl::status
ortools::math_opt_matchers
"$<LINK_LIBRARY:WHOLE_ARCHIVE,ortools::math_opt_callback_tests>"
Expand Down
14 changes: 13 additions & 1 deletion ortools/math_opt/solvers/xpress_solver_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "ortools/math_opt/solver_tests/qp_tests.h"
#include "ortools/math_opt/solver_tests/second_order_cone_tests.h"
#include "ortools/math_opt/solver_tests/status_tests.h"
#include "ortools/xpress/environment.h"

namespace operations_research {
namespace math_opt {
Expand Down Expand Up @@ -243,4 +244,15 @@ INSTANTIATE_TEST_SUITE_P(XpressStatusTest, StatusTest,

} // namespace
} // namespace math_opt
} // namespace operations_research
} // namespace operations_research

GTEST_API_ int main(int argc, char **argv) {
printf("Running main() from %s\n", __FILE__);
testing::InitGoogleTest(&argc, argv);
if (operations_research::XpressIsCorrectlyInstalled()) {
return RUN_ALL_TESTS();
} else {
LOG(INFO) << "XPress MP is not correctly installed, skipping";
return EXIT_SUCCESS;
}
}

0 comments on commit bfb987f

Please sign in to comment.