Skip to contentSkip to conversation

doc: Add basic shell test description

PATCH In review Cyril Hrubis 2 participants 3 messages Nov 24, 2025 – Nov 25, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 doc: Add basic shell test description

---
 doc/conf.py                        |  1 +
 doc/developers/api_shell_tests.rst | 91 ++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+)

Changes in v2:

- fixed typos
- added links as requested by Petr

doc/conf.py +1 -0
index 86f6fe2b7..e8488bff7 100644
@@ -34,6 +34,7 @@ exclude_patterns = ["html*", '_static*', '.venv*']
 extlinks = {
     'repo': (f'{ltp_repo}/%s', '%s'),
     'master': (f'{ltp_repo}/blob/master/%s', '%s'),
+    'shell_lib': (f'{ltp_repo}/blob/master/testcases/lib/%s', '%s'),
     'git_man': ('https://git-scm.com/docs/git-%s', 'git %s'),
     'man2': ('https://man7.org/linux/man-pages/man2/%s.2.html', '%s(2)'),
     'man3': ('https://man7.org/linux/man-pages/man3/%s.3.html', '%s(3)'),
doc/developers/api_shell_tests.rst +91 -0

94 lines not on this page · raw message

Signature · 5 lines
2.51.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Cyril,

TL;DR You already add my RBT (thanks), please amend your patch with the diff below.

...

Quoted 1 line

+ 'shell_lib': (f'{ltp_repo}/blob/master/testcases/lib/%s', '%s'),

+1. I was thinking about it previously for C helpers, then I preferred to show full path. I guess I'll later use 'shell_lib' prefix for these. I suppose we can keep lib/*.c path, but sure, we could also (later) add 'lib' and 'include'.

I wish extlinks module allow to pass more params than just one.

...

doc/developers/api_shell_tests.rst line 90

Quoted 2 lines
doc/developers/api_shell_tests.rst +2 -0
+The test setup and cleanup functions are optional and passed via variables.
+Similarily to the C API the setup is executed exactly once at the start of the

Similarily => Similarly

doc/developers/api_shell_tests.rst line 92

Quoted 2 lines
doc/developers/api_shell_tests.rst +2 -0
+test and the test cleanup is executed at the test end or when test was
+interrupted by ref:`tst_brk`.

=> missing leading ':' causes text "by ref:tst_brk."

interrupted by :ref:tst_brk.

doc/developers/api_shell_tests.rst line 95

Quoted 3 lines
doc/developers/api_shell_tests.rst +3 -0
+
+   .. literalinclude:: ../../testcases/lib/tests/shell_loader_setup_cleanup.sh
+   :language: shell

+1, nice feature. "language : shell" require another level of indentation, otherwise it just shows as a test below code.

Kind regards,
Petr

+++ doc/developers/api_shell_tests.rst
@@ -87,9 +87,9 @@ Test setup and cleanup
----------------------

The test setup and cleanup functions are optional and passed via variables.
-Similarily to the C API the setup is executed exactly once at the start of the +Similarly to the C API the setup is executed exactly once at the start of the
test and the test cleanup is executed at the test end or when test was
-interrupted by ref:tst_brk.
+interrupted by :ref:tst_brk.

.. literalinclude:: ../../testcases/lib/tests/shell_loader_setup_cleanup.sh
- :language: shell
+ :language: shell

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi!

Quoted 4 lines
Quoted 1 line

+ 'shell_lib': (f'{ltp_repo}/blob/master/testcases/lib/%s', '%s'),

+1. I was thinking about it previously for C helpers, then I preferred to show full path. I guess I'll later use 'shell_lib' prefix for these. I suppose we can keep lib/*.c path, but sure, we could also (later) add 'lib' and 'include'.

Well this is going to be easier to maintain if we ever decided to move the content of the testcases/lib into a top level directory, where it probably belongs.

Quoted 1 line

I wish extlinks module allow to pass more params than just one.

Yes.

Quoted 4 lines

+++ doc/developers/api_shell_tests.rst

(quoted diff) +0 -0
@@ -87,9 +87,9 @@ Test setup and cleanup
 ----------------------
 

Review Test setup and cleanup · line 95

Quoted 10 lines
(quoted diff) +3 -3
 The test setup and cleanup functions are optional and passed via variables.
-Similarily to the C API the setup is executed exactly once at the start of the
+Similarly to the C API the setup is executed exactly once at the start of the
 test and the test cleanup is executed at the test end or when test was
-interrupted by ref:`tst_brk`.
+interrupted by :ref:`tst_brk`.
 
    .. literalinclude:: ../../testcases/lib/tests/shell_loader_setup_cleanup.sh
-   :language: shell
+      :language: shell

Fixed and pushed, thanks.

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp