Skip to contentSkip to conversation

Azure CI: Save pytest output automatically

PATCH In review Tom Rini 2 participants 6 messages Feb 28, 2023 – Mar 22, 2023

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/2 Azure CI: Save pytest output automatically

Enable use of the python-azurepipelines package which provides automatic formatting and uploading of the pytest output.

---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.azure-pipelines.yml +2 -1
index f6609bbd6bd1..609020fa5498 100644
@@ -194,10 +194,11 @@ stages:
           virtualenv -p /usr/bin/python3 /tmp/venv
           . /tmp/venv/bin/activate
           pip install -r test/py/requirements.txt
+          pip install pytest-azurepipelines
           export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
           export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
           # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
-          ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
+          ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR";
           # the below corresponds to .gitlab-ci.yml "after_script"
           rm -rf /tmp/uboot-test-hooks /tmp/venv
           EOF
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 Azure CI: Be explicit about pytest cache directory

The default pytest cache directory is in a read-only directory in Azure, which results in a warning on the build page. Use the pytest command line option to set the cache dir to somewhere writable.

---
 .azure-pipelines.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.azure-pipelines.yml +1 -1
index 609020fa5498..e0c499f8a407 100644
@@ -198,7 +198,7 @@ stages:
           export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
           export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
           # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
-          ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR";
+          ./test/py/test.py -ra -o cache_dir="$UBOOT_TRAVIS_BUILD_DIR"/.pytest_cache --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR";
           # the below corresponds to .gitlab-ci.yml "after_script"
           rm -rf /tmp/uboot-test-hooks /tmp/venv
           EOF
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] Azure CI: Be explicit about pytest cache directory

Quoted 9 lines · Tom Rini

The default pytest cache directory is in a read-only directory in Azure, which results in a warning on the build page. Use the pytest command line option to set the cache dir to somewhere writable.

---
 .azure-pipelines.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
author
#3 lore raw

Re: [PATCH 2/2] Azure CI: Be explicit about pytest cache directory

In reply to Tom Rini
Quoted 6 lines · Tom Rini

The default pytest cache directory is in a read-only directory in Azure, which results in a warning on the build page. Use the pytest command line option to set the cache dir to somewhere writable.

Applied to u-boot/next, thanks!

Signature · 1 line
Tom
Reviewed-by on v1 1/2
#4 lore raw
In reply to Tom Rini
Quoted 8 lines · Tom Rini

Enable use of the python-azurepipelines package which provides automatic formatting and uploading of the pytest output.

---
 .azure-pipelines.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 21 lines
.azure-pipelines.yml +2 -2
index f6609bbd6bd1..609020fa5498 100644
@@ -194,10 +194,11 @@ stages:
           virtualenv -p /usr/bin/python3 /tmp/venv
           . /tmp/venv/bin/activate
           pip install -r test/py/requirements.txt
+          pip install pytest-azurepipelines
           export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
           export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
           # "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
-          ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR";
+          ./test/py/test.py -ra --bd ${TEST_PY_BD} ${TEST_PY_ID} ${TEST_PY_TEST_SPEC:+"-k ${TEST_PY_TEST_SPEC}"} --build-dir "$UBOOT_TRAVIS_BUILD_DIR" --report-dir "$UBOOT_TRAVIS_BUILD_DIR";
           # the below corresponds to .gitlab-ci.yml "after_script"
           rm -rf /tmp/uboot-test-hooks /tmp/venv
           EOF
--

2.34.1