Skip to content

Commit cbfebdd

Browse files
authored
Merge pull request #2276 from ERGO-Code/fix-2269
Fixed the meson build failures in TestLpSolvers.cpp
2 parents d74194d + 340a6b9 commit cbfebdd

File tree

1 file changed

+24
-33
lines changed

1 file changed

+24
-33
lines changed

check/TestLpSolvers.cpp

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,9 @@ bool fileExists(const std::string& file_name) {
407407

408408
TEST_CASE("highs-files-lp", "[highs_lp_solver]") {
409409
Highs h;
410-
std::string write_solution_file = "temp.sol";
411-
std::string write_basis_file = "temp.bas";
412-
std::string write_model_file = "temp.mps";
410+
std::string write_solution_file = "lp-temp.sol";
411+
std::string write_basis_file = "lp-temp.bas";
412+
std::string write_model_file = "lp-temp.mps";
413413
h.setOptionValue("output_flag", dev_run);
414414
std::string model_file =
415415
std::string(HIGHS_DIR) + "/check/instances/avgas.mps";
@@ -429,10 +429,12 @@ TEST_CASE("highs-files-lp", "[highs_lp_solver]") {
429429
h.setOptionValue("write_basis_file", "");
430430
h.setOptionValue("write_model_file", "");
431431

432+
h.setOptionValue("read_basis_file", write_basis_file);
433+
432434
REQUIRE(h.readModel(write_model_file) == HighsStatus::kOk);
433435

434-
h.setOptionValue("read_basis_file", write_basis_file);
435436
h.run();
437+
436438
REQUIRE(h.getInfo().simplex_iteration_count == 0);
437439

438440
std::remove(write_model_file.c_str());
@@ -442,9 +444,9 @@ TEST_CASE("highs-files-lp", "[highs_lp_solver]") {
442444

443445
TEST_CASE("highs-files-mip", "[highs_lp_solver]") {
444446
Highs h;
445-
std::string write_solution_file = "temp.sol";
446-
std::string write_basis_file = "temp.bas";
447-
std::string write_model_file = "temp.mps";
447+
std::string write_solution_file = "mip-temp.sol";
448+
std::string write_basis_file = "mip-temp.bas";
449+
std::string write_model_file = "mip-temp.mps";
448450
h.setOptionValue("output_flag", dev_run);
449451
std::string model_file =
450452
std::string(HIGHS_DIR) + "/check/instances/flugpl.mps";
@@ -454,34 +456,23 @@ TEST_CASE("highs-files-mip", "[highs_lp_solver]") {
454456
h.setOptionValue("write_model_file", write_model_file);
455457

456458
h.run();
457-
// Removed to get back to meson build CI test passing
458-
//
459-
// const int64_t mip_node_count = h.getInfo().mip_node_count;
460-
461-
// Ideally we'd check that the files have been created, but this
462-
// causes the meson build CI test to fail
463-
//
464-
// REQUIRE(fileExists(write_model_file));
465-
// REQUIRE(fileExists(write_solution_file));
466-
467-
// However, std::remove returning zero is a test for existence
468-
//
469-
// But this also causes the meson build CI test to fail!
470-
// REQUIRE(std::remove(write_model_file.c_str()) == 0);
471-
// REQUIRE(std::remove(write_solution_file.c_str()) == 0);
472-
// REQUIRE(std::remove(write_basis_file.c_str()) != 0);
473-
474-
// Removed to get back to meson build CI test passing
475-
//
476-
// REQUIRE(h.readModel(write_model_file) == HighsStatus::kOk);
477-
// h.setOptionValue("read_solution_file", write_solution_file);
478-
// HighsStatus run_status = h.run();
479-
//
480-
// This appears to cause the meson build CI test to fail
481-
// REQUIRE(run_status == HighsStatus::kOk);
459+
460+
const int64_t mip_node_count = h.getInfo().mip_node_count;
461+
462+
REQUIRE(fileExists(write_model_file));
463+
REQUIRE(fileExists(write_solution_file));
464+
465+
h.setOptionValue("solution_file", "");
466+
h.setOptionValue("write_model_file", "");
467+
468+
REQUIRE(h.readModel(write_model_file) == HighsStatus::kOk);
469+
h.setOptionValue("read_solution_file", write_solution_file);
470+
HighsStatus run_status = h.run();
471+
472+
REQUIRE(run_status == HighsStatus::kOk);
482473

483474
// This also causes the meson build CI test to fail!
484-
// REQUIRE(h.getInfo().mip_node_count < mip_node_count);
475+
REQUIRE(h.getInfo().mip_node_count < mip_node_count);
485476

486477
std::remove(write_model_file.c_str());
487478
std::remove(write_solution_file.c_str());

0 commit comments

Comments
 (0)