From f695540eeeb222df922ece8ceb88ad35b9beeff8 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 18 Feb 2025 10:53:08 +0100 Subject: [PATCH] enable cucumber tests --- .github/workflows/ubuntu.yml | 166 +++++++++++++++++- .github/workflows/windows-vcpkg.yml | 10 +- .../steps/common_steps/modeler_utils.py | 14 +- 3 files changed, 178 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 9c76f11884..9adb59ae69 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -145,10 +145,172 @@ jobs: - name: Init submodule Antares_Simulator_Tests_NR run: | git submodule update --init --remote --recursive src/tests/resources/Antares_Simulator_Tests_NR - + + - name: Run named mps tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-named-mps + os: ${{ env.os }} + variant: "named-mps" + + - name: Run cucumber on short-tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/cucumber-tests + with: + feature: "features/solver-features/short_tests.feature" + + - name: Run unfeasibility-related tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + run: | + cd _build + ctest -C Release --output-on-failure -R "^unfeasible$" + + - name: Run unit and end-to-end tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + run: | + cd _build + ctest -C Release --output-on-failure -L "unit|end-to-end" + + + - name: Upload logs for failed tests + if: ${{ failure() }} + uses: actions/upload-artifact@v4 + with: + name: test-log + path: ${{ github.workspace }}/_build/Testing/Temporary/LastTest.log + + - name: Run tests about infinity on BCs RHS + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v830 + os: ${{ env.os }} + + - name: Run MILP with CBC + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-milp + variant: "milp-cbc" + os: ${{ env.os }} + + - name: Run tests on adequacy patch (CSR) + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: adequacy-patch-CSR + os: ${{ env.os }} + + - name: Run tests introduced in 8.6.0 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v860 + os: ${{ env.os }} + + - name: Run tests introduced in 8.7.0 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v870 + os: ${{ env.os }} + + - name: Run tests introduced in 9.1.0 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v910 + os: ${{ env.os }} + + - name: Run tests introduced in 9.2.0 + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-v920 + os: ${{ env.os }} + + - name: Run short-tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: short-tests + os: ${{ env.os }} + + + - name: Run mps tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-mps + os: ${{ env.os }} + + - name: Run parallel tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: valid-parallel + os: ${{ env.os }} + variant: "parallel" + + - name: Run tests for time series generator tool + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: ts-generator + os: ${{ env.os }} + variant: "tsgenerator" + + - name: Run medium-tests + if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: medium-tests + os: ${{ env.os }} + + - name: Run cucumber on medium-tests + uses: ./.github/workflows/cucumber-tests + with: + feature: "features/solver-features/medium_tests.feature" + + - name: Run long-tests-1 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: long-tests-1 + os: ${{ env.os }} + + - name: Run long-tests-2 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: long-tests-2 + os: ${{ env.os }} + + - name: Run long-tests-3 + if: ${{ env.RUN_EXTENDED_TESTS == 'true' && !cancelled() }} + uses: ./.github/workflows/run-tests + with: + simtest-tag: ${{ env.SIMTEST }} + batch-name: long-tests-3 + os: ${{ env.os }} - name: Run cucumber on modeler - if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} #tmp uses: ./.github/workflows/cucumber-tests with: feature: "features/modeler-features" diff --git a/.github/workflows/windows-vcpkg.yml b/.github/workflows/windows-vcpkg.yml index 0fda647b68..6efec90c43 100644 --- a/.github/workflows/windows-vcpkg.yml +++ b/.github/workflows/windows-vcpkg.yml @@ -157,6 +157,12 @@ jobs: os: ${{ env.os }} variant: "named-mps" + - name: Run cucumber on short-tests + if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }} + uses: ./.github/workflows/cucumber-tests + with: + feature: "features/solver-features/short_tests.feature" + - name: Run unfeasibility-related tests if: ${{ env.RUN_SIMPLE_TESTS == 'true' && ! cancelled() }} run: | @@ -241,10 +247,6 @@ jobs: batch-name: short-tests os: ${{ env.os }} - - name: Run cucumber on short-tests - uses: ./.github/workflows/cucumber-tests - with: - feature: "features/solver-features/short_tests.feature" - name: Run mps tests if: ${{ env.RUN_SIMPLE_TESTS == 'true' && !cancelled() }} diff --git a/src/tests/cucumber/features/steps/common_steps/modeler_utils.py b/src/tests/cucumber/features/steps/common_steps/modeler_utils.py index b2fb4e9eb2..639e07e497 100644 --- a/src/tests/cucumber/features/steps/common_steps/modeler_utils.py +++ b/src/tests/cucumber/features/steps/common_steps/modeler_utils.py @@ -9,13 +9,15 @@ def run_modeler(context): print(f"Running command: {command}") process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = process.communicate() - print("*********************** Begin stdout ***********************") - print(out.replace(b'\r\n', b'\n').decode('utf-8')) - print("*********************** End stdout ***********************") - print("*********************** Begin stderr ***********************") - print(err.replace(b'\r\n', b'\n').decode('utf-8')) - print("*********************** End stderr ***********************") + if process.returncode != 0: + print("*********************** Begin stdout ***********************") + print(out.replace(b'\r\n', b'\n').decode('utf-8')) + print("*********************** End stdout ***********************") + + print("*********************** Begin stderr ***********************") + print(err.replace(b'\r\n', b'\n').decode('utf-8')) + print("*********************** End stderr ***********************") context.return_code = process.returncode