Skip to content

Commit

Permalink
add named mps tests (#1408)
Browse files Browse the repository at this point in the history
* updates json tests for named mps

* update github actions

* delete changes in .gitignore

* update simtest version

* to test in 1st place named mps

* Update simtest.json

update simtest version

* fix named-mps tests

* Move named-mps

---------

Co-authored-by: Florian OMNES <[email protected]>
  • Loading branch information
a-zakir and flomnes authored Jul 28, 2023
1 parent db87c7b commit a623441
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 16 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ inputs:
os:
description: 'OS used for github action'
required: true

variant:
description: 'launch specific test'
required: false
default: "json"
runs:
using: "composite"
steps:
Expand All @@ -27,7 +30,7 @@ runs:
shell: bash {0}
run: |
cd _build
ctest -C Release --output-on-failure -R json
ctest -C Release --output-on-failure -R ${{inputs.variant}}
echo "RET_CODE=$?" >> $GITHUB_ENV
- name: Clean batches
Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ jobs:
run: |
cmake --build _build --config release -j2
# simtest
- name: Read simtest version
id: simtest-version
uses: notiz-dev/github-action-json-property@release
with:
path: 'simtest.json'
prop_path: 'version'

- name: Run named mps tests
if: ${{ env.IS_PUSH == 'true' }}
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-named-mps
os: ${{ matrix.test-platform }}
variant: "named-mps"

- name: Run unfeasibility-related tests
if: ${{ env.IS_PUSH == 'true' }}
run: |
Expand Down Expand Up @@ -130,14 +148,6 @@ jobs:
name: test-log
path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log

# simtest
- name: Read simtest version
id: simtest-version
uses: notiz-dev/github-action-json-property@release
with:
path: 'simtest.json'
prop_path: 'version'

- name: Run tests about infinity on BCs RHS
if: ${{ env.IS_PUSH == 'true' }}
uses: ./.github/workflows/run-tests
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@ jobs:
path: 'simtest.json'
prop_path: 'version'

- name: Run named mps tests
uses: ./.github/workflows/run-tests
with:
simtest-tag: ${{steps.simtest-version.outputs.prop}}
batch-name: valid-named-mps
os: ${{ matrix.test-platform }}
variant: "named-mps"

- name: Run tests for adequacy patch (CSR)
uses: ./.github/workflows/run-tests
with:
Expand Down
2 changes: 1 addition & 1 deletion simtest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "v8.6.1a"
"version": "v8.7.0"
}
2 changes: 1 addition & 1 deletion src/antares-deps
Submodule antares-deps updated 1 files
+1 −1 CMakeLists.txt
6 changes: 6 additions & 0 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ if(Python3_Interpreter_FOUND)
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/run-study-tests"
)

add_test(
NAME named-mps
COMMAND Python3::Interpreter -m pytest -m json --solver-path=$<TARGET_FILE:antares-solver> --named-mps-problems
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/run-study-tests"
)

# The Kirchhoff constraint builder is built only if BUILD_TOOLS=ON
if (BUILD_TOOLS)
add_test(
Expand Down
7 changes: 5 additions & 2 deletions src/tests/run-study-tests/actions_on_study/study_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
from utils.assertions import check

class study_run:
def __init__(self, study_path, solver_path, use_ortools, ortools_solver):
def __init__(self, study_path, solver_path, use_ortools, ortools_solver, named_mps_problems):
self.study_path = study_path
self.solver_path = solver_path
self.use_ortools = use_ortools
self.ortools_solver = ortools_solver
self.named_mps_problems = named_mps_problems
self.raise_exception_on_failure = True
self.return_code = 0

Expand All @@ -23,6 +24,8 @@ def run(self):
if self.use_ortools:
command.append('--use-ortools')
command.append('--ortools-solver=' + self.ortools_solver)
if self.named_mps_problems:
command.append('--named-mps-problems')
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
process.communicate()

Expand All @@ -38,4 +41,4 @@ def get_return_code(self):
return self.return_code

def success(self):
return self.return_code == 0
return self.return_code == 0
5 changes: 5 additions & 0 deletions src/tests/run-study-tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def pytest_addoption(parser):
parser.addoption("--use-ortools", action="store_true", default=False)
parser.addoption("--ortools-solver", action="store", default="sirius")
parser.addoption("--solver-path", action="store")
parser.addoption("--named-mps-problems", action="store_true", default=False)

@pytest.fixture()
def ortools_solver(request):
Expand All @@ -16,3 +17,7 @@ def use_ortools(request):
@pytest.fixture()
def solver_path(request):
return request.config.getoption("--solver-path")

@pytest.fixture()
def named_mps_problems(request):
return request.config.getoption("--named-mps-problems")
4 changes: 2 additions & 2 deletions src/tests/run-study-tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def resultsRemover(study_path):
return results_remover(study_path)

@pytest.fixture
def simulation(study_path, solver_path, use_ortools, ortools_solver):
return study_run(study_path, solver_path, use_ortools, ortools_solver)
def simulation(study_path, solver_path, use_ortools, ortools_solver, named_mps_problems):
return study_run(study_path, solver_path, use_ortools, ortools_solver, named_mps_problems)

@pytest.fixture(autouse=True)
def check_runner(simulation, resultsRemover):
Expand Down

0 comments on commit a623441

Please sign in to comment.