ci: Run pytest once for both LAVA and bin/ci

There's no need for these to be totally separate, and also for the LAVA
tests to have been disabled for months.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30978>
This commit is contained in:
Daniel Stone
2024-09-02 12:54:12 +01:00
committed by Marge Bot
parent 28aafcfaef
commit cc4db4bc36
10 changed files with 54 additions and 51 deletions

View File

@@ -212,9 +212,6 @@ debian-testing-msan:
LLVM_VERSION: 15
S3_ARTIFACT_NAME: debian-build-testing
script: |
section_start lava-pytest "lava-pytest"
.gitlab-ci/lava/lava-pytest.sh
section_end lava-pytest
.gitlab-ci/meson/build.sh
.gitlab-ci/prepare-artifacts.sh
timeout: 15m

View File

@@ -83,7 +83,7 @@ rm -rf $XORGMACROS_VERSION
. .gitlab-ci/container/build-bindgen.sh
python3 -m pip install --break-system-packages -r .gitlab-ci/lava/requirements.txt
python3 -m pip install --break-system-packages -r bin/ci/requirements.txt
############### Uninstall the build software

View File

@@ -16,7 +16,7 @@ variables:
DEBIAN_BASE_TAG: "20240729-rustc-bump"
DEBIAN_X86_64_BUILD_IMAGE_PATH: "debian/x86_64_build"
DEBIAN_BUILD_TAG: "20240909-filelock"
DEBIAN_BUILD_TAG: "20240909-pytest"
DEBIAN_X86_64_TEST_BASE_IMAGE: "debian/x86_64_test-base"
DEBIAN_ARM64_TEST_BASE_IMAGE: "debian/arm64_test-base"
@@ -30,7 +30,7 @@ variables:
DEBIAN_TEST_ANDROID_TAG: "20240906-deqp"
DEBIAN_TEST_GL_TAG: "20240906-deqp"
DEBIAN_TEST_VK_TAG: "20240906-deqp"
KERNEL_ROOTFS_TAG: "20240906-deqp"
KERNEL_ROOTFS_TAG: "20240909-pytest"
ALPINE_X86_64_BUILD_TAG: "20240814-var"
ALPINE_X86_64_LAVA_SSH_TAG: "20240401-wlproto"

View File

@@ -1,32 +0,0 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# © Collabora Limited
# Author: Guilherme Gallo <guilherme.gallo@collabora.com>
# This script runs unit/integration tests related with LAVA CI tools
# shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime.
# shellcheck disable=SC2086 # quoting PYTEST_VERBOSE makes us pass an empty path
set -exu
if [ -z "${CI_PROJECT_DIR:-}" ]; then
CI_PROJECT_DIR="$(dirname "${0}")/../../"
fi
if [ -z "${LAVA_PYTEST_VENV:-}" ]; then
LAVA_PYTEST_VENV="${CI_PROJECT_DIR}/.gitlab-ci/lava/.venv-pytest"
fi
# Use this script in a python virtualenv for isolation
python3 -m venv "${LAVA_PYTEST_VENV}"
. "${LAVA_PYTEST_VENV}"/bin/activate
python3 -m pip install --break-system-packages -r "${CI_PROJECT_DIR}/.gitlab-ci/lava/requirements-test.txt"
TEST_DIR=${CI_PROJECT_DIR}/.gitlab-ci/tests
PYTHONPATH="${TEST_DIR}:${PYTHONPATH}" python3 -m \
pytest "${TEST_DIR}" \
-W ignore::DeprecationWarning \
--junitxml=artifacts/ci_scripts_report.xml \
-m 'not slow' \
${PYTEST_VERBOSE:-}

View File

@@ -1,6 +0,0 @@
-r requirements.txt
freezegun==1.1.0
hypothesis==6.67.1
pytest==7.2.1
pytest-cov==3.0.0
PyYAML==5.3.1

View File

@@ -1,2 +0,0 @@
lavacli==1.5.2
fire==0.5.0

43
.gitlab-ci/run-pytest.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: MIT
# © Collabora Limited
# Author: Guilherme Gallo <guilherme.gallo@collabora.com>
# This script runs unit/integration tests related with LAVA CI tools
# shellcheck disable=SC1091 # The relative paths in this file only become valid at runtime.
# shellcheck disable=SC2086 # quoting PYTEST_VERBOSE makes us pass an empty path
. "${SCRIPTS_DIR}/setup-test-env.sh"
section_start pytest_setup "Setting up pytest environment"
set -exu
if [ -z "${CI_PROJECT_DIR:-}" ]; then
CI_PROJECT_DIR="$(dirname "${0}")/../"
fi
if [ -z "${MESA_PYTEST_VENV:-}" ]; then
MESA_PYTEST_VENV="${CI_PROJECT_DIR}/.venv-pytest"
fi
# Use this script in a python virtualenv for isolation
python3 -m venv "${MESA_PYTEST_VENV}"
. "${MESA_PYTEST_VENV}"/bin/activate
python3 -m pip install --break-system-packages -r "${CI_PROJECT_DIR}/bin/ci/requirements.txt"
python3 -m pip install --break-system-packages -r "${CI_PROJECT_DIR}/bin/ci/test/requirements.txt"
LIB_TEST_DIR=${CI_PROJECT_DIR}/.gitlab-ci/tests
SCRIPT_TEST_DIR=${CI_PROJECT_DIR}/bin/ci
uncollapsed_section_switch pytest "Running pytest"
PYTHONPATH="${LIB_TEST_DIR}:${SCRIPT_TEST_DIR}:${PYTHONPATH}" python3 -m \
pytest "${LIB_TEST_DIR}" "${SCRIPT_TEST_DIR}" \
-W ignore::DeprecationWarning \
--junitxml=artifacts/ci_scripts_report.xml \
-m 'not slow' \
${PYTEST_VERBOSE:-}
section_end pytest

View File

@@ -52,9 +52,7 @@ python-test:
GIT_STRATEGY: fetch
timeout: 10m
script:
- cd bin/ci
- pip install --break-system-packages -r test/requirements.txt
- PYTHONPATH=. pytest -v
- .gitlab-ci/run-pytest.sh
rules:
- !reference [.disable-farm-mr-rules, rules]
- !reference [.never-post-merge-rules, rules]

View File

@@ -1,13 +1,15 @@
PyYAML==6.*
colorama==0.4.*
filecache==0.81
filelock==3.*
fire==0.5.0
gql==3.*
kaleido==0.2.*
python-dateutil==2.*
lavacli==1.5.2
pandas==2.*
plotly==5.*
python-dateutil==2.*
python-gitlab==4.*
PyYAML==6.*
ruamel.yaml.clib==0.2.*
ruamel.yaml==0.17.*
tabulate==0.9.*

View File

@@ -1,5 +1,8 @@
filelock==3.12.4
fire==0.5.0
freezegun==1.1.0
hypothesis==6.67.1
mock==5.1.0
polars==0.19.3
pytest==7.4.2
pytest-cov==3.0.0