math_opt: only run SCIP tests if enabled by flokli · Pull Request #4745 · google/or-tools
Usage of SCIP library can be disabled in CMake build by setting -DUSE_SCIP=OFF. However, the tests were still run unconditionally, showing test failures like this: ``` /build/source/ortools/math_opt/solver_tests/test_models_test.cc:29: Failure Value of: Solve(*model, SolverType::kGscip) Expected: is OK and has a value that (is an object whose field `termination` (is an object whose field `reason` is equal to optimal) and (is an object whose field `problem_status` (is an object whose field `primal_status` is equal to feasible) and (is an object whose field `dual_status` is equal to feasible) and (is an object whose field `primal_or_dual_infeasible` is equal to false))) and (is an object whose property `has_primal_feasible_solution` is equal to true) and (is an object whose property `objective_value` is approximately 9 (absolute error <= 1.0000000000000001e-05)) Actual: [INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled], which has status INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled [ FAILED ] SmallModelTest.Integer (2 ms) [ RUN ] SmallModelTest.Continuous [ OK ] SmallModelTest.Continuous (1 ms) [----------] 2 tests from SmallModelTest (3 ms total) [----------] 2 tests from DenseIndependentSetTest [ RUN ] DenseIndependentSetTest.Integer /build/source/ortools/math_opt/solver_tests/test_models_test.cc:40: Failure Value of: Solve(*model, SolverType::kGscip) Expected: is OK and has a value that (is an object whose field `termination` (is an object whose field `reason` is equal to optimal) and (is an object whose field `problem_status` (is an object whose field `primal_status` is equal to feasible) and (is an object whose field `dual_status` is equal to feasible) and (is an object whose field `primal_or_dual_infeasible` is equal to false))) and (is an object whose property `has_primal_feasible_solution` is equal to true) and (is an object whose property `objective_value` is approximately 7 (absolute error <= 1.0000000000000001e-05)) Actual: [INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled], which has status INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled [ FAILED ] DenseIndependentSetTest.Integer (0 ms) [ RUN ] DenseIndependentSetTest.Continuous [ OK ] DenseIndependentSetTest.Continuous (1 ms) [----------] 2 tests from DenseIndependentSetTest (2 ms total) [----------] 1 test from DenseIndependentSetHint5Test [ RUN ] DenseIndependentSetHint5Test.HintIsFeasibleWithObjective5 /build/source/ortools/math_opt/solver_tests/test_models_test.cc:59: Failure Value of: Solve(*model, SolverType::kGscip) Expected: is OK and has a value that (is an object whose field `termination` (is an object whose field `reason` is equal to optimal) and (is an object whose field `problem_status` (is an object whose field `primal_status` is equal to feasible) and (is an object whose field `dual_status` is equal to feasible) and (is an object whose field `primal_or_dual_infeasible` is equal to false))) and (is an object whose property `has_primal_feasible_solution` is equal to true) and (is an object whose property `objective_value` is approximately 5 (absolute error <= 1.0000000000000001e-05)) Actual: [INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled], which has status INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled [ FAILED ] DenseIndependentSetHint5Test.HintIsFeasibleWithObjective5 (0 ms) [----------] 1 test from DenseIndependentSetHint5Test (0 ms total) [----------] 2 tests from IndependentSetCompleteGraphTest [ RUN ] IndependentSetCompleteGraphTest.Integer /build/source/ortools/math_opt/solver_tests/test_models_test.cc:65: Failure Value of: Solve(*model, SolverType::kGscip) Expected: is OK and has a value that (is an object whose field `termination` (is an object whose field `reason` is equal to optimal) and (is an object whose field `problem_status` (is an object whose field `primal_status` is equal to feasible) and (is an object whose field `dual_status` is equal to feasible) and (is an object whose field `primal_or_dual_infeasible` is equal to false))) and (is an object whose property `has_primal_feasible_solution` is equal to true) and (is an object whose property `objective_value` is approximately 1 (absolute error <= 1.0000000000000001e-05)) Actual: [INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled], which has status INVALID_ARGUMENT: solver type SOLVER_TYPE_GSCIP is not registered, support for this solver has not been compiled [ FAILED ] IndependentSetCompleteGraphTest.Integer (0 ms) ``` Fix this, by conditionalizing these tests on USE_SCIP.
flokli added a commit to flokli/nixpkgs that referenced this pull request
Aug 18, 2025This needs google/or-tools#4745 to skip SCIP tests if built without SCIP (which we currently do). The tests currently still fail on aarch64-linux (google/or-tools#4746), so we only enable for x86_64-linux. It can be re-tested with a more recent version once or-tools is updated.
flokli added a commit to flokli/nixpkgs that referenced this pull request
Oct 8, 2025This adds a new argument, withScip, defaulting to true, which will configure or-tools with SCIP support. or-tools usually is built with SCIP support, and only tested like this, see google/or-tools#4745. However, SCIP only was introduced to nixpkgs March 2025, that's probably why or-tools in nixpkgs came without it so far. If built with SCIP support, we need to propagate scip itself, otherwise downstream cmake consumers need to set SCIP_ROOT explicitly.
work-jdannenberg pushed a commit to work-jdannenberg/nixpkgs that referenced this pull request
Oct 10, 2025This adds a new argument, withScip, defaulting to true, which will configure or-tools with SCIP support. or-tools usually is built with SCIP support, and only tested like this, see google/or-tools#4745. However, SCIP only was introduced to nixpkgs March 2025, that's probably why or-tools in nixpkgs came without it so far. If built with SCIP support, we need to propagate scip itself, otherwise downstream cmake consumers need to set SCIP_ROOT explicitly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters