[yocto] [yocto-autobuilder-helper v2] scripts/run-toaster-tests.py: run via pytest and fix environment setup

2023-12-01 Thread Alexander Lussier-Cullen
Strip quotes from directory variables as they caused path errors.
Add environment variable for the toaster artifact directory.
Migrate from tox and django tools to using pytest.
Install python module requirements from the script as this is no
longer handled by tox.

Signed-off-by: Alexander Lussier-Cullen 

CC: Richard Purdie 
---
 scripts/run-toaster-tests | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/scripts/run-toaster-tests b/scripts/run-toaster-tests
index 516965e..b694e37 100755
--- a/scripts/run-toaster-tests
+++ b/scripts/run-toaster-tests
@@ -16,13 +16,15 @@ pokydir=$(realpath "$2")
 cd $builddir
 
 bitbake -e > bbenv
-export SSTATE_DIR=$(grep '^SSTATE_DIR=' bbenv | cut -d "=" -f2-)
-export DL_DIR=$(grep '^DL_DIR=' bbenv | cut -d "=" -f2-)
+export SSTATE_DIR=$(grep '^SSTATE_DIR=' bbenv | cut -d "=" -f2- | sed -e 
's/^"//' -e 's/"$//')
+export DL_DIR=$(grep '^DL_DIR=' bbenv | cut -d "=" -f2- | sed -e 's/^"//' -e 
's/"$//')
 export TOASTER_DJANGO_TMPDIR=$builddir
+export TOASTER_DIR=$builddir
 
 mkdir -p toaster_logs
+
 python3 -m venv venv --without-pip --system-site-packages
 source venv/bin/activate
-python3 -m pip install tox
+python3 -m pip install -r $pokydir/bitbake/toaster-requirements.txt -r 
$pokydir/bitbake/lib/toaster/tests/toaster-tests-requirements.txt
 
-tox -c $pokydir/bitbake/lib/toaster/tox.ini
+python3 -m pytest -c $pokydir/bitbake/lib/toaster/pytest.ini 
$pokydir/bitbake/lib/toaster/tests/
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61789): https://lists.yoctoproject.org/g/yocto/message/61789
Mute This Topic: https://lists.yoctoproject.org/mt/102916819/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[yocto] [yocto-autobuilder-helper] scripts/run-toaster-tests.py: run via pytest and fix environment setup

2023-11-30 Thread Alexander Lussier-Cullen
Signed-off-by: Alexander Lussier-Cullen 

---
 scripts/run-toaster-tests | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/run-toaster-tests b/scripts/run-toaster-tests
index 516965e..08528c7 100755
--- a/scripts/run-toaster-tests
+++ b/scripts/run-toaster-tests
@@ -16,13 +16,18 @@ pokydir=$(realpath "$2")
 cd $builddir
 
 bitbake -e > bbenv
-export SSTATE_DIR=$(grep '^SSTATE_DIR=' bbenv | cut -d "=" -f2-)
-export DL_DIR=$(grep '^DL_DIR=' bbenv | cut -d "=" -f2-)
+export SSTATE_DIR=$(grep '^SSTATE_DIR=' bbenv | cut -d "=" -f2- | sed -e 
's/^"//' -e 's/"$//')
+export DL_DIR=$(grep '^DL_DIR=' bbenv | cut -d "=" -f2- | sed -e 's/^"//' -e 
's/"$//')
 export TOASTER_DJANGO_TMPDIR=$builddir
+export TOASTER_DIR=$builddir
 
 mkdir -p toaster_logs
+
 python3 -m venv venv --without-pip --system-site-packages
 source venv/bin/activate
-python3 -m pip install tox
+python3 -m pip install -r $pokydir/bitbake/toaster-requirements.txt -r 
$pokydir/bitbake/lib/toaster/tests/toaster-tests-requirements.txt
+# reactivate venv to make sure packages are all properly initialized
+deactivate && source venv/bin/activate
+
+pytest -c $pokydir/bitbake/lib/toaster/pytest.ini 
$pokydir/bitbake/lib/toaster/tests/
 
-tox -c $pokydir/bitbake/lib/toaster/tox.ini
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61779): https://lists.yoctoproject.org/g/yocto/message/61779
Mute This Topic: https://lists.yoctoproject.org/mt/102893736/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[yocto] [yocto-autobuilder-helper] scripts/run-toaster-tests.py: Add environment variables

2023-11-23 Thread Alexander Lussier-Cullen
Pass the toaster test environment SSTATE_DIR and DL_DIR for faster
builds and TOASTER_DJANGO_TMPDIR to remove problematic temp files
from the root level '/tmp' directory.

Signed-off-by: Alexander Lussier-Cullen 

---
 scripts/run-toaster-tests | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/scripts/run-toaster-tests b/scripts/run-toaster-tests
index a785c36..516965e 100755
--- a/scripts/run-toaster-tests
+++ b/scripts/run-toaster-tests
@@ -14,6 +14,12 @@ builddir=$(realpath "$1")
 pokydir=$(realpath "$2")
 
 cd $builddir
+
+bitbake -e > bbenv
+export SSTATE_DIR=$(grep '^SSTATE_DIR=' bbenv | cut -d "=" -f2-)
+export DL_DIR=$(grep '^DL_DIR=' bbenv | cut -d "=" -f2-)
+export TOASTER_DJANGO_TMPDIR=$builddir
+
 mkdir -p toaster_logs
 python3 -m venv venv --without-pip --system-site-packages
 source venv/bin/activate
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61743): https://lists.yoctoproject.org/g/yocto/message/61743
Mute This Topic: https://lists.yoctoproject.org/mt/102768032/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[yocto] [yocto-autobuilder-helper] Add toaster test builder

2023-11-13 Thread Alexander Lussier-Cullen
From: Alexander Lussier-Cullen 

Add a toaster test builder that runs the tox test suite using a new
run-toaster-tests script.

Signed-off-by: Alexander Lussier-Cullen 

CC: richard.pur...@linuxfoundation.org
---
 config.json   |  3 +++
 scripts/run-toaster-tests | 22 ++
 2 files changed, 25 insertions(+)
 create mode 100644 scripts/run-toaster-tests

diff --git a/config.json b/config.json
index d10a3a8..0c581d1 100644
--- a/config.json
+++ b/config.json
@@ -1675,6 +1675,9 @@
 "step1" : {
 "BBTARGETS" : "core-image-patchtest"
 }
+},
+"toaster" : {
+"EXTRACMDS" : ["${SCRIPTSDIR}/run-toaster-tests ${HELPERBUILDDIR} 
${HELPERBUILDDIR}/.."]
 }
 },
 "repo-defaults" : {
diff --git a/scripts/run-toaster-tests b/scripts/run-toaster-tests
new file mode 100644
index 000..a785c36
--- /dev/null
+++ b/scripts/run-toaster-tests
@@ -0,0 +1,22 @@
+#!/bin/bash
+#
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Called with $1 as the build directory
+# $2 as the path to poky
+
+set -e
+set -u
+set -o pipefail
+set -x
+
+builddir=$(realpath "$1")
+pokydir=$(realpath "$2")
+
+cd $builddir
+mkdir -p toaster_logs
+python3 -m venv venv --without-pip --system-site-packages
+source venv/bin/activate
+python3 -m pip install tox
+
+tox -c $pokydir/bitbake/lib/toaster/tox.ini
-- 
2.34.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#61669): https://lists.yoctoproject.org/g/yocto/message/61669
Mute This Topic: https://lists.yoctoproject.org/mt/102567727/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-