doc: pytest: fix hook script env vars
cover doc: pytest: fix hook script env vars
When I tried to follow the docs and make some hook scripts, I found that the environment variables mentioned there were not actually being set. It turns out there was a typo and they were missing an underscore in U_BOOT. And I also noticed that some more variables we set in the environment, so there is a 2nd patch to document those as well.
---
David Lechner (2):
doc: pytest: fix hook script environment variable names
doc: pytest: add missing hook script env vars
doc/develop/pytest/usage.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
---
base-commit: c5e6d2ab7eba68cbfb600cdc131c0c375ced2ec9
change-id: 20251124-doc-pytest-fix-script-env-vars-03141d1cbc9c
Best regards,
Signature · 1 line
David Lechner <[email protected]>
PATCH 1/2 doc: pytest: fix hook script environment variable names
Fix the names of environment variables set for hook scripts. These have a U_BOOT_ prefix, not UBOOT_.
--- doc/develop/pytest/usage.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
doc/develop/pytest/usage.rst +7 -7
@@ -315,14 +315,14 @@ Environment variables The following environment variables are set when running hook scripts: -- ``UBOOT_BOARD_TYPE`` the board type being tested. -- ``UBOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none +- ``U_BOOT_BOARD_TYPE`` the board type being tested. +- ``U_BOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none was specified. -- ``UBOOT_SOURCE_DIR`` the U-Boot source directory. -- ``UBOOT_TEST_PY_DIR`` the full path to ``test/py/`` in the source directory. -- ``UBOOT_BUILD_DIR`` the U-Boot build directory. -- ``UBOOT_RESULT_DIR`` the test result directory. -- ``UBOOT_PERSISTENT_DATA_DIR`` the test persistent data directory. +- ``U_BOOT_SOURCE_DIR`` the U-Boot source directory. +- ``U_BOOT_TEST_PY_DIR`` the full path to ``test/py/`` in the source directory. +- ``U_BOOT_BUILD_DIR`` the U-Boot build directory. +- ``U_BOOT_RESULT_DIR`` the test result directory. +- ``U_BOOT_PERSISTENT_DATA_DIR`` the test persistent data directory. u-boot-test-console '''''''''''''''''''
Signature · 1 line
2.43.0
Re: [PATCH 1/2] doc: pytest: fix hook script environment variable names
Quoted 13 lines · David Lechner
Fix the names of environment variables set for hook scripts. These have a
U_BOOT_prefix, notUBOOT_.Signed-off-by David Lechner <[email protected]>--- doc/develop/pytest/usage.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)doc/develop/pytest/usage.rst +0
-0
doc/develop/pytest/usage.rst Environment variables · line 318
Quoted 6 lines
doc/develop/pytest/usage.rst +1
-2@@ -315,14 +315,14 @@ Environment variables The following environment variables are set when running hook scripts: -- ``UBOOT_BOARD_TYPE`` the board type being tested. -- ``UBOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none +- ``U_BOOT_BOARD_TYPE`` the board type being tested.
I checked for the variable names in U-Boot origin/next and u-boot-test-hooks.
I could not find U_BOOT_BOARD_TYPE via grep.
doc/develop/pytest/usage.rst Environment variables · line 321
Quoted 8 lines
doc/develop/pytest/usage.rst +2
-5+- ``U_BOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none was specified. -- ``UBOOT_SOURCE_DIR`` the U-Boot source directory. -- ``UBOOT_TEST_PY_DIR`` the full path to ``test/py/`` in the source directory. -- ``UBOOT_BUILD_DIR`` the U-Boot build directory. -- ``UBOOT_RESULT_DIR`` the test result directory. -- ``UBOOT_PERSISTENT_DATA_DIR`` the test persistent data directory. +- ``U_BOOT_SOURCE_DIR`` the U-Boot source directory.
ok
doc/develop/pytest/usage.rst Environment variables · line 322
Quoted 1 line
doc/develop/pytest/usage.rst +1
-0+- ``U_BOOT_TEST_PY_DIR`` the full path to ``test/py/`` in the source directory.
U_BOOT_TEST_PY_DIR does not exist.
There is a variable TEST_PY_DIR used in test/py/conftest.py.
doc/develop/pytest/usage.rst Environment variables · line 323
Quoted 1 line
doc/develop/pytest/usage.rst +1
-0+- ``U_BOOT_BUILD_DIR`` the U-Boot build directory.
ok
doc/develop/pytest/usage.rst Environment variables · line 324
Quoted 1 line
doc/develop/pytest/usage.rst +1
-0+- ``U_BOOT_RESULT_DIR`` the test result directory.
U_BOOT_RESULT_DIR does not exist.
doc/develop/pytest/usage.rst Environment variables · line 325
Quoted 1 line
doc/develop/pytest/usage.rst +1
-0+- ``U_BOOT_PERSISTENT_DATA_DIR`` the test persistent data directory.
U_BOOT_BUILD_DIR_EXTRA (used in test/py/conftest.py:167) is missing in the list.
Best regards
Heinrich
Quoted 4 lines
doc/develop/pytest/usage.rst +0
-0u-boot-test-console '''''''''''''''''''
Re: [PATCH 1/2] doc: pytest: fix hook script environment variable names
Quoted 21 lines · Heinrich Schuchardt
Quoted 13 lines · David Lechner
Fix the names of environment variables set for hook scripts. These have a
U_BOOT_prefix, notUBOOT_.Signed-off-by David Lechner <[email protected]>---
doc/develop/pytest/usage.rst| 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)doc/develop/pytest/usage.rst +0
-0@@ -315,14 +315,14 @@ Environment variablesQuoted 4 lines
The following environment variables are set when running hook scripts:
-- ``UBOOT_BOARD_TYPE`` the board type being tested.
-- ``UBOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none +- ``U_BOOT_BOARD_TYPE`` the board type being tested.I checked for the variable names in U-Boot origin/next and u-boot-test-hooks.
Quoted 1 line
I could not find
U_BOOT_BOARD_TYPEvia grep.
It is because of:
env_vars = (
'board_type',
'board_type_extra',
'board_identity',
'source_dir',
'test_py_dir',
'build_dir',
'build_dir_extra',
'result_dir',
'persistent_data_dir',
)
for v in env_vars:
os.environ['U_BOOT_' + v.upper()] = getattr(ubconfig, v)Between this and the next patch, the docs should match this list now.
PATCH 2/2 doc: pytest: add missing hook script env vars
In reply to David LechnerAdd the _EXTRA variants of U_BOOT_BUILD_DIR and U_BOOT_RESULT_DIR to the list of environment variables set for hook scripts.
These were added in commit 8f2a9fa7d6e7 ("test: Support testing with two board-builds") but were not documented.
--- doc/develop/pytest/usage.rst | 2 ++ 1 file changed, 2 insertions(+)
doc/develop/pytest/usage.rst +2 -0
@@ -316,11 +316,13 @@ Environment variables The following environment variables are set when running hook scripts: - ``U_BOOT_BOARD_TYPE`` the board type being tested. +- ``U_BOOT_BOARD_TYPE_EXTRA`` the 2nd board type being tested, if applicable. - ``U_BOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none was specified. - ``U_BOOT_SOURCE_DIR`` the U-Boot source directory. - ``U_BOOT_TEST_PY_DIR`` the full path to ``test/py/`` in the source directory. - ``U_BOOT_BUILD_DIR`` the U-Boot build directory. +- ``U_BOOT_BUILD_DIR_EXTRA`` the 2nd U-Boot build directory, if applicable. - ``U_BOOT_RESULT_DIR`` the test result directory. - ``U_BOOT_PERSISTENT_DATA_DIR`` the test persistent data directory.
Signature · 1 line
2.43.0
Re: [PATCH 2/2] doc: pytest: add missing hook script env vars
Quoted 16 lines · David Lechner
Add the
_EXTRAvariants ofU_BOOT_BUILD_DIRandU_BOOT_RESULT_DIRto the list of environment variables set for hook scripts.These were added in commit
8f2a9fa7d6e7("test: Support testing with two board-builds") but were not documented.Signed-off-by David Lechner <[email protected]>--- doc/develop/pytest/usage.rst | 2 ++ 1 file changed, 2 insertions(+)doc/develop/pytest/usage.rst +0
-0
doc/develop/pytest/usage.rst Environment variables · line 319
Quoted 4 lines
doc/develop/pytest/usage.rst +1
-0@@ -316,11 +316,13 @@ Environment variables The following environment variables are set when running hook scripts: - ``U_BOOT_BOARD_TYPE`` the board type being tested. +- ``U_BOOT_BOARD_TYPE_EXTRA`` the 2nd board type being tested, if applicable.
I cannot find the two strings above in U-Boot. The mentioned patch adds 'board_type_extra'. Where is U_BOOT_ prepended to the capitalized string?
Best regards
Heinrich
Quoted 10 lines
doc/develop/pytest/usage.rst +1
-0- ``U_BOOT_BOARD_IDENTITY`` the board identity being tested, or ``na`` if none was specified. - ``U_BOOT_SOURCE_DIR`` the U-Boot source directory. - ``U_BOOT_TEST_PY_DIR`` the full path to ``test/py/`` in the source directory. - ``U_BOOT_BUILD_DIR`` the U-Boot build directory. +- ``U_BOOT_BUILD_DIR_EXTRA`` the 2nd U-Boot build directory, if applicable. - ``U_BOOT_RESULT_DIR`` the test result directory. - ``U_BOOT_PERSISTENT_DATA_DIR`` the test persistent data directory.
Re: [PATCH 2/2] doc: pytest: add missing hook script env vars
Quoted 12 lines · Heinrich Schuchardt
Quoted 11 lines · David Lechner
Add the
_EXTRAvariants ofU_BOOT_BUILD_DIRandU_BOOT_RESULT_DIRto the list of environment variables set for hook scripts.These were added in commit
8f2a9fa7d6e7("test: Support testing with two board-builds") but were not documented.Signed-off-by David Lechner <[email protected]>---
doc/develop/pytest/usage.rst| 2 ++1 file changed, 2 insertions(+)
Quoted 11 lines
Quoted 8 lines
doc/develop/pytest/usage.rst +0
-0@@ -316,11 +316,13 @@ Environment variablesThe following environment variables are set when running hook scripts:
- ``U_BOOT_BOARD_TYPE`` the board type being tested.
+- ``U_BOOT_BOARD_TYPE_EXTRA`` the 2nd board type being tested, if applicable.I cannot find the two strings above in U-Boot. The mentioned patch adds '
board_type_extra'. Where isU_BOOT_prepended to the capitalized string?
Same answer as the other patch, it comes from:
env_vars = (
'board_type',
'board_type_extra',
'board_identity',
'source_dir',
'test_py_dir',
'build_dir',
'build_dir_extra',
'result_dir',
'persistent_data_dir',
)
for v in env_vars:
os.environ['U_BOOT_' + v.upper()] = getattr(ubconfig, v)in test/py/conftest.py (around line 340).