Skip to contentSkip to conversation

doc: add tests catalog page

PATCH Superseded Andrea Cervesato 4 participants 8 messages Feb 3, 2025

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 doc: add tests catalog page

From: Andrea Cervesato <[email protected]>

Add a new section in the LTP documentation website, where we list all tests which are available in LTP and supporting new API.

---
This patch-set is meant to introduce a new page in the LTP documentation, showing tests which are currently available with their description and information.

---
 doc/.gitignore             |   1 +
 doc/conf.py                | 101 +++++++++++++++++++++++++++++++++++++++++++--
 doc/index.rst              |   4 ++
 doc/users/test_catalog.rst |   7 ++++
 4 files changed, 109 insertions(+), 4 deletions(-)
doc/.gitignore +1 -0
index 173179852070f25acb6a729975df9d52d171b422..2b05a1ec368573778cfe7ee6a1cb5d6c5ecb0b5a 100644
@@ -1,4 +1,5 @@
 html/
 build/
 _static/syscalls.rst
+_static/tests.rst
 syscalls.tbl
doc/conf.py +97 -4

146 lines not on this page · raw message

doc/index.rst +4 -0
index b907ac36f0c9328c576d25dee5777d808c2e5119..c00a59d31345142e78deb74eacc9da2941291d76 100644
@@ -11,6 +11,7 @@
    users/setup_tests
    users/supported_systems
    users/stats
+   users/test_catalog
 
 .. toctree::
    :maxdepth: 3
@@ -54,6 +55,9 @@ For users
 :doc:`users/stats`
    Some LTP statistics
 
+:doc:`users/test_catalog`
+   The LTP test catalog
+
 For developers
 --------------
 
doc/users/test_catalog.rst new file +7 -0
new file mode 100644
index 0000000000000000000000000000000000000000..b1674f9dc614ea04a89cf084e92b72c6862a5f48
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Test catalog
+============
+
+.. include:: ../_static/tests.rst
+

---
base-commit: 728759506cbe08612183275b3543007d1c47f7f4
change-id: 20250131-doc_tests_list-1b82f51e43fd

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


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

Hi!

please consider this as a WIP. I'm searching for feedbacks before proceeding. What do you think?

Andrea

Quoted 226 lines · Andrea Cervesato

From: Andrea Cervesato <[email protected]>

Add a new section in the LTP documentation website, where we list all tests which are available in LTP and supporting new API.

---
This patch-set is meant to introduce a new page in the LTP documentation, showing tests which are currently available with their description and information.

---
  doc/.gitignore             |   1 +
  doc/conf.py                | 101 +++++++++++++++++++++++++++++++++++++++++++--
  doc/index.rst              |   4 ++
  doc/users/test_catalog.rst |   7 ++++
  4 files changed, 109 insertions(+), 4 deletions(-)
doc/.gitignore +1 -0
index 173179852070f25acb6a729975df9d52d171b422..2b05a1ec368573778cfe7ee6a1cb5d6c5ecb0b5a 100644
@@ -1,4 +1,5 @@
  html/
  build/
  _static/syscalls.rst
+_static/tests.rst
  syscalls.tbl
doc/conf.py +97 -4
index c6a84ea5810424ce6e1c21d81946c1819f10a3cc..2ecfeb80ece1e14f94b757f26fa5e08fb79f1c69 100644
@@ -5,6 +5,7 @@
 
  import os
  import re
+import json
  import socket
  import urllib.request
  import sphinx
@@ -17,6 +18,7 @@ copyright = '2024, Linux Test Project'
  author = 'Linux Test Project'
  release = '1.0'
  ltp_repo = 'https://github.com/linux-test-project/ltp'
+ltp_repo_base_url = f"{ltp_repo}/tree/master"
 
  # -- General configuration ---------------------------------------------------
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -25,7 +27,7 @@ extensions = [
      'linuxdoc.rstKernelDoc',
      'sphinxcontrib.spelling',
      'sphinx.ext.autosectionlabel',
-    'sphinx.ext.extlinks'
+    'sphinx.ext.extlinks',
  ]
 
  exclude_patterns = ["html*", '_static*']
@@ -138,7 +140,6 @@ def generate_syscalls_stats(_):
      if error:
          return
 
-    syscalls_base_url = f"{ltp_repo}/tree/master"
      text = [
          'Syscalls\n',
          '--------\n\n',
@@ -176,7 +177,7 @@ def generate_syscalls_stats(_):
              path = dirpath.replace('../', '')
              name = match.group('name')
 
-            ltp_syscalls[name] = f'{syscalls_base_url}/{path}'
+            ltp_syscalls[name] = f'{ltp_repo_base_url}/{path}'
 
      # compare kernel syscalls with LTP tested syscalls
      syscalls = {}
@@ -186,7 +187,7 @@ def generate_syscalls_stats(_):
 
          if kersc not in syscalls:
              if kersc in white_list:
-                syscalls[kersc] = f'{syscalls_base_url}/{white_list[kersc]}'
+                syscalls[kersc] = f'{ltp_repo_base_url}/{white_list[kersc]}'
                  continue
 
              syscalls[kersc] = None
@@ -256,6 +257,97 @@ def generate_syscalls_stats(_):
          stats.writelines(text)
 
 
+def generate_test_catalog(_):
+    """
+    Generate the test catalog from ltp.json metadata file.
+    """
+    output = '_static/tests.rst'
+    metadata_file = '../metadata/ltp.json'
+    cve_url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
+    commit_url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id="
+    timeout_def = 0
+    text = []
+
+    metadata = None
+    with open(metadata_file, 'r', encoding='utf-8') as data:
+        metadata = json.load(data)
+
+    timeout_def = metadata['defaults']['timeout']
+
+    for test_name, conf in metadata['tests'].items():
+        text.extend([
+            f'{test_name}\n',
+            len(test_name) * '-' + '\n'
+        ])
+
+        # source url location
+        test_fname = conf.get('fname', None)
+        if test_fname:
+            text.append(f"\n`source <{ltp_repo_base_url}/{test_fname}>`_\n\n")
+
+        # test description
+        desc = conf.get('doc', None)
+        if desc:
+            desc_text = []
+            for line in desc:
+                if line.startswith("[Descr"):
+                    desc_text.append("**Description**")
+                elif line.startswith("[Algo"):
+                    desc_text.append("**Algorithm**")
+                else:
+                    desc_text.append(line)
+
+            text.extend([
+                '\n'.join(desc_text),
+                '\n'
+            ])
+
+        timeout = conf.get('timeout', None)
+        if timeout:
+            text.append(f'\nTest timeout to {timeout} seconds.')
+        else:
+            text.append(f'\nTest timeout defaults to {timeout_def} seconds.')
+
+        text.append('\n\n')
+
+        # tags information
+        tags = conf.get('tags', None)
+        if tags:
+            text.extend([
+                '\n.. list-table::\n',
+                '   :widths: 50 50\n'
+                '   :header-rows: 1\n\n',
+                '   * - Tag\n',
+                '     - Info\n',
+            ])
+
+            for tag in tags:
+                tag_key = tag[0]
+                tag_val = tag[1]
+
+                if tag_key == 'CVE':
+                    tag_val = f'`{tag_val} <{cve_url}{tag_val}>`_'
+                elif tag_key == 'linux-git':
+                    tag_val = f'`{tag_val} <{commit_url}{tag_val}>`_'
+
+                text.extend([
+                    f'   * - {tag_key}\n',
+                    f'     - {tag_val}\n',
+                ])
+
+            text.append('\n')
+
+        # small separator between tests
+        text.extend([
+            '\n',
+            '.. raw:: html\n\n',
+            '    <hr>\n\n',
+        ])
+
+    with open(output, 'w+', encoding='utf-8') as new_tests:
+        new_tests.writelines(text)
+
+
  def setup(app):
      """
      Setup the current documentation, using self generated data and graphics
@@ -263,3 +355,4 @@ def setup(app):
      """
      app.add_css_file('custom.css')
      app.connect('builder-inited', generate_syscalls_stats)
+    app.connect('builder-inited', generate_test_catalog)
doc/index.rst +4 -0
index b907ac36f0c9328c576d25dee5777d808c2e5119..c00a59d31345142e78deb74eacc9da2941291d76 100644
@@ -11,6 +11,7 @@
     users/setup_tests
     users/supported_systems
     users/stats
+   users/test_catalog
 
  .. toctree::
     :maxdepth: 3
@@ -54,6 +55,9 @@ For users
  :doc:`users/stats`
     Some LTP statistics
 
+:doc:`users/test_catalog`
+   The LTP test catalog
+
  For developers
  --------------
 
doc/users/test_catalog.rst new file +7 -1
new file mode 100644
index 0000000000000000000000000000000000000000..b1674f9dc614ea04a89cf084e92b72c6862a5f48
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Test catalog
+============
+
+.. include:: ../_static/tests.rst
+
 
---

base-commit: 728759506cbe08612183275b3543007d1c47f7f4
change-id: 20250131-doc_tests_list-1b82f51e43fd

Best regards,

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

Hi!

Quoted 110 lines

Add a new section in the LTP documentation website, where we list all tests which are available in LTP and supporting new API.

---
This patch-set is meant to introduce a new page in the LTP documentation, showing tests which are currently available with their description and information.

---
 doc/.gitignore             |   1 +
 doc/conf.py                | 101 +++++++++++++++++++++++++++++++++++++++++++--
 doc/index.rst              |   4 ++
 doc/users/test_catalog.rst |   7 ++++
 4 files changed, 109 insertions(+), 4 deletions(-)
doc/.gitignore +1 -0
index 173179852070f25acb6a729975df9d52d171b422..2b05a1ec368573778cfe7ee6a1cb5d6c5ecb0b5a 100644
@@ -1,4 +1,5 @@
 html/
 build/
 _static/syscalls.rst
+_static/tests.rst
 syscalls.tbl
doc/conf.py +31 -4
index c6a84ea5810424ce6e1c21d81946c1819f10a3cc..2ecfeb80ece1e14f94b757f26fa5e08fb79f1c69 100644
@@ -5,6 +5,7 @@
 
 import os
 import re
+import json
 import socket
 import urllib.request
 import sphinx
@@ -17,6 +18,7 @@ copyright = '2024, Linux Test Project'
 author = 'Linux Test Project'
 release = '1.0'
 ltp_repo = 'https://github.com/linux-test-project/ltp'
+ltp_repo_base_url = f"{ltp_repo}/tree/master"
 
 # -- General configuration ---------------------------------------------------
 # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -25,7 +27,7 @@ extensions = [
     'linuxdoc.rstKernelDoc',
     'sphinxcontrib.spelling',
     'sphinx.ext.autosectionlabel',
-    'sphinx.ext.extlinks'
+    'sphinx.ext.extlinks',
 ]
 
 exclude_patterns = ["html*", '_static*']
@@ -138,7 +140,6 @@ def generate_syscalls_stats(_):
     if error:
         return
 
-    syscalls_base_url = f"{ltp_repo}/tree/master"
     text = [
         'Syscalls\n',
         '--------\n\n',
@@ -176,7 +177,7 @@ def generate_syscalls_stats(_):
             path = dirpath.replace('../', '')
             name = match.group('name')
 
-            ltp_syscalls[name] = f'{syscalls_base_url}/{path}'
+            ltp_syscalls[name] = f'{ltp_repo_base_url}/{path}'
 
     # compare kernel syscalls with LTP tested syscalls
     syscalls = {}
@@ -186,7 +187,7 @@ def generate_syscalls_stats(_):
 
         if kersc not in syscalls:
             if kersc in white_list:
-                syscalls[kersc] = f'{syscalls_base_url}/{white_list[kersc]}'
+                syscalls[kersc] = f'{ltp_repo_base_url}/{white_list[kersc]}'
                 continue
 
             syscalls[kersc] = None
@@ -256,6 +257,97 @@ def generate_syscalls_stats(_):
         stats.writelines(text)
 
 
+def generate_test_catalog(_):
+    """
+    Generate the test catalog from ltp.json metadata file.
+    """
+    output = '_static/tests.rst'
+    metadata_file = '../metadata/ltp.json'
+    cve_url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
+    commit_url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id="
+    timeout_def = 0
+    text = []
+
+    metadata = None
+    with open(metadata_file, 'r', encoding='utf-8') as data:
+        metadata = json.load(data)
+
+    timeout_def = metadata['defaults']['timeout']
+
+    for test_name, conf in metadata['tests'].items():
+        text.extend([
+            f'{test_name}\n',
+            len(test_name) * '-' + '\n'
+        ])
+
+        # source url location
+        test_fname = conf.get('fname', None)
+        if test_fname:

doc/conf.py def generate_syscalls_stats(_): · line 295

Quoted 10 lines
doc/conf.py +10 -0
+            text.append(f"\n`source <{ltp_repo_base_url}/{test_fname}>`_\n\n")
+
+        # test description
+        desc = conf.get('doc', None)
+        if desc:
+            desc_text = []
+            for line in desc:
+                if line.startswith("[Descr"):
+                    desc_text.append("**Description**")
+                elif line.startswith("[Algo"):

Huh, why not the whole [Description] and [Algorithm]?

Quoted 26 lines
doc/conf.py +26 -0
+                    desc_text.append("**Algorithm**")
+                else:
+                    desc_text.append(line)
+
+            text.extend([
+                '\n'.join(desc_text),
+                '\n'
+            ])
+
+        timeout = conf.get('timeout', None)
+        if timeout:
+            text.append(f'\nTest timeout to {timeout} seconds.')
+        else:
+            text.append(f'\nTest timeout defaults to {timeout_def} seconds.')
+
+        text.append('\n\n')
+
+        # tags information
+        tags = conf.get('tags', None)
+        if tags:
+            text.extend([
+                '\n.. list-table::\n',
+                '   :widths: 50 50\n'
+                '   :header-rows: 1\n\n',
+                '   * - Tag\n',
+                '     - Info\n',

doc/conf.py def generate_syscalls_stats(_): · line 331

Quoted 10 lines
doc/conf.py +10 -0
+            ])
+
+            for tag in tags:
+                tag_key = tag[0]
+                tag_val = tag[1]
+
+                if tag_key == 'CVE':
+                    tag_val = f'`{tag_val} <{cve_url}{tag_val}>`_'
+                elif tag_key == 'linux-git':
+                    tag_val = f'`{tag_val} <{commit_url}{tag_val}>`_'

We also have glibc-git and musl-git, see print_test_tags() in lib/tst_test.c

Quoted 73 lines
doc/conf.py +19 -0
+                text.extend([
+                    f'   * - {tag_key}\n',
+                    f'     - {tag_val}\n',
+                ])
+
+            text.append('\n')
+
+        # small separator between tests
+        text.extend([
+            '\n',
+            '.. raw:: html\n\n',
+            '    <hr>\n\n',
+        ])
+
+    with open(output, 'w+', encoding='utf-8') as new_tests:
+        new_tests.writelines(text)
+
+
 def setup(app):
     """
     Setup the current documentation, using self generated data and graphics
@@ -263,3 +355,4 @@ def setup(app):
     """
     app.add_css_file('custom.css')
     app.connect('builder-inited', generate_syscalls_stats)
+    app.connect('builder-inited', generate_test_catalog)
doc/index.rst +4 -0
index b907ac36f0c9328c576d25dee5777d808c2e5119..c00a59d31345142e78deb74eacc9da2941291d76 100644
@@ -11,6 +11,7 @@
    users/setup_tests
    users/supported_systems
    users/stats
+   users/test_catalog
 
 .. toctree::
    :maxdepth: 3
@@ -54,6 +55,9 @@ For users
 :doc:`users/stats`
    Some LTP statistics
 
+:doc:`users/test_catalog`
+   The LTP test catalog
+
 For developers
 --------------
 
doc/users/test_catalog.rst new file +7 -1
new file mode 100644
index 0000000000000000000000000000000000000000..b1674f9dc614ea04a89cf084e92b72c6862a5f48
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Test catalog
+============
+
+.. include:: ../_static/tests.rst
+
 
---

base-commit: 728759506cbe08612183275b3543007d1c47f7f4
change-id: 20250131-doc_tests_list-1b82f51e43fd

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 5 lines
Cyril Hrubis
[email protected]

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

Hi Cyril,

Quoted 114 lines · Cyril Hrubis

Hi!

Quoted 113 lines

Add a new section in the LTP documentation website, where we list all tests which are available in LTP and supporting new API.

---
This patch-set is meant to introduce a new page in the LTP documentation, showing tests which are currently available with their description and information.

---
  doc/.gitignore             |   1 +
  doc/conf.py                | 101 +++++++++++++++++++++++++++++++++++++++++++--
  doc/index.rst              |   4 ++
  doc/users/test_catalog.rst |   7 ++++
  4 files changed, 109 insertions(+), 4 deletions(-)
doc/.gitignore +1 -0
index 173179852070f25acb6a729975df9d52d171b422..2b05a1ec368573778cfe7ee6a1cb5d6c5ecb0b5a 100644
@@ -1,4 +1,5 @@
  html/
  build/
  _static/syscalls.rst
+_static/tests.rst
  syscalls.tbl
doc/conf.py +34 -4
index c6a84ea5810424ce6e1c21d81946c1819f10a3cc..2ecfeb80ece1e14f94b757f26fa5e08fb79f1c69 100644
@@ -5,6 +5,7 @@
 
  import os
  import re
+import json
  import socket
  import urllib.request
  import sphinx
@@ -17,6 +18,7 @@ copyright = '2024, Linux Test Project'
  author = 'Linux Test Project'
  release = '1.0'
  ltp_repo = 'https://github.com/linux-test-project/ltp'
+ltp_repo_base_url = f"{ltp_repo}/tree/master"
 
  # -- General configuration ---------------------------------------------------
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -25,7 +27,7 @@ extensions = [
      'linuxdoc.rstKernelDoc',
      'sphinxcontrib.spelling',
      'sphinx.ext.autosectionlabel',
-    'sphinx.ext.extlinks'
+    'sphinx.ext.extlinks',
  ]
 
  exclude_patterns = ["html*", '_static*']
@@ -138,7 +140,6 @@ def generate_syscalls_stats(_):
      if error:
          return
 
-    syscalls_base_url = f"{ltp_repo}/tree/master"
      text = [
          'Syscalls\n',
          '--------\n\n',
@@ -176,7 +177,7 @@ def generate_syscalls_stats(_):
              path = dirpath.replace('../', '')
              name = match.group('name')
 
-            ltp_syscalls[name] = f'{syscalls_base_url}/{path}'
+            ltp_syscalls[name] = f'{ltp_repo_base_url}/{path}'
 
      # compare kernel syscalls with LTP tested syscalls
      syscalls = {}
@@ -186,7 +187,7 @@ def generate_syscalls_stats(_):
 
          if kersc not in syscalls:
              if kersc in white_list:
-                syscalls[kersc] = f'{syscalls_base_url}/{white_list[kersc]}'
+                syscalls[kersc] = f'{ltp_repo_base_url}/{white_list[kersc]}'
                  continue
 
              syscalls[kersc] = None
@@ -256,6 +257,97 @@ def generate_syscalls_stats(_):
          stats.writelines(text)
 
 
+def generate_test_catalog(_):
+    """
+    Generate the test catalog from ltp.json metadata file.
+    """
+    output = '_static/tests.rst'
+    metadata_file = '../metadata/ltp.json'
+    cve_url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-"
+    commit_url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id="
+    timeout_def = 0
+    text = []
+
+    metadata = None
+    with open(metadata_file, 'r', encoding='utf-8') as data:
+        metadata = json.load(data)
+
+    timeout_def = metadata['defaults']['timeout']
+
+    for test_name, conf in metadata['tests'].items():
+        text.extend([
+            f'{test_name}\n',
+            len(test_name) * '-' + '\n'
+        ])
+
+        # source url location
+        test_fname = conf.get('fname', None)
+        if test_fname:
+            text.append(f"\n`source <{ltp_repo_base_url}/{test_fname}>`_\n\n")
+
+        # test description
Quoted 8 lines

doc/conf.py def generate_syscalls_stats(_): · line 295

Quoted 7 lines
doc/conf.py +7 -0
+        desc = conf.get('doc', None)
+        if desc:
+            desc_text = []
+            for line in desc:
+                if line.startswith("[Descr"):
+                    desc_text.append("**Description**")
+                elif line.startswith("[Algo"):

Huh, why not the whole [Description] and [Algorithm]?

Typos in the code :-) I just overlay it fixing the result. But yes, in the final version we need to use the full name. Maybe a comment there would have helped.

Quoted 31 lines
Quoted 31 lines
doc/conf.py +30 -0
+                    desc_text.append("**Algorithm**")
+                else:
+                    desc_text.append(line)
+
+            text.extend([
+                '\n'.join(desc_text),
+                '\n'
+            ])
+
+        timeout = conf.get('timeout', None)
+        if timeout:
+            text.append(f'\nTest timeout to {timeout} seconds.')
+        else:
+            text.append(f'\nTest timeout defaults to {timeout_def} seconds.')
+
+        text.append('\n\n')
+
+        # tags information
+        tags = conf.get('tags', None)
+        if tags:
+            text.extend([
+                '\n.. list-table::\n',
+                '   :widths: 50 50\n'
+                '   :header-rows: 1\n\n',
+                '   * - Tag\n',
+                '     - Info\n',
+            ])
+
+            for tag in tags:
+                tag_key = tag[0]
Quoted 8 lines

doc/conf.py def generate_syscalls_stats(_): · line 331

Quoted 6 lines
doc/conf.py +6 -0
+                tag_val = tag[1]
+
+                if tag_key == 'CVE':
+                    tag_val = f'`{tag_val} <{cve_url}{tag_val}>`_'
+                elif tag_key == 'linux-git':
+                    tag_val = f'`{tag_val} <{commit_url}{tag_val}>`_'

We also have glibc-git and musl-git, see print_test_tags() in lib/tst_test.c

Thanks for pointing it out

Quoted 66 lines
Quoted 66 lines
doc/conf.py +19 -0
+                text.extend([
+                    f'   * - {tag_key}\n',
+                    f'     - {tag_val}\n',
+                ])
+
+            text.append('\n')
+
+        # small separator between tests
+        text.extend([
+            '\n',
+            '.. raw:: html\n\n',
+            '    <hr>\n\n',
+        ])
+
+    with open(output, 'w+', encoding='utf-8') as new_tests:
+        new_tests.writelines(text)
+
+
  def setup(app):
      """
      Setup the current documentation, using self generated data and graphics
@@ -263,3 +355,4 @@ def setup(app):
      """
      app.add_css_file('custom.css')
      app.connect('builder-inited', generate_syscalls_stats)
+    app.connect('builder-inited', generate_test_catalog)
doc/index.rst +4 -0
index b907ac36f0c9328c576d25dee5777d808c2e5119..c00a59d31345142e78deb74eacc9da2941291d76 100644
@@ -11,6 +11,7 @@
     users/setup_tests
     users/supported_systems
     users/stats
+   users/test_catalog
 
  .. toctree::
     :maxdepth: 3
@@ -54,6 +55,9 @@ For users
  :doc:`users/stats`
     Some LTP statistics
 
+:doc:`users/test_catalog`
+   The LTP test catalog
+
  For developers
  --------------
 
doc/users/test_catalog.rst new file +7 -1
new file mode 100644
index 0000000000000000000000000000000000000000..b1674f9dc614ea04a89cf084e92b72c6862a5f48
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Test catalog
+============
+
+.. include:: ../_static/tests.rst
+
 
---

base-commit: 728759506cbe08612183275b3543007d1c47f7f4
change-id: 20250131-doc_tests_list-1b82f51e43fd

Quoted 7 lines
Quoted 7 lines

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


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

Andrea

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

I also have a question: what test configuration keys should be seen in the documentation tests list? I.e. needs_forks, needs_kconfigs, etc.

Andrea

Quoted 234 lines · Andrea Cervesato

Hi Cyril,

Quoted 110 lines · Cyril Hrubis

Hi!

Quoted 109 lines

Add a new section in the LTP documentation website, where we list all tests which are available in LTP and supporting new API.

---
This patch-set is meant to introduce a new page in the LTP documentation, showing tests which are currently available with their description and information.
---
  doc/.gitignore             |   1 +
  doc/conf.py                | 101
+++++++++++++++++++++++++++++++++++++++++++--
  doc/index.rst              |   4 ++ doc/users/test_catalog.rst |   7 ++++

  4 files changed, 109 insertions(+), 4 deletions(-)
doc/.gitignore +0 -0
index 173179852070f25acb6a729975df9d52d171b422..2b05a1ec368573778cfe7ee6a1cb5d6c5ecb0b5a 100644
@@ -1,4 +1,5 @@

  html/
  build/
  _static/syscalls.rst
+_static/tests.rst
  syscalls.tbl

doc/conf.py +0 -0
index c6a84ea5810424ce6e1c21d81946c1819f10a3cc..2ecfeb80ece1e14f94b757f26fa5e08fb79f1c69 100644
@@ -5,6 +5,7 @@

    import os
  import re
+import json
  import socket
  import urllib.request
  import sphinx

doc/conf.py +0 -0
@@ -17,6 +18,7 @@ copyright = '2024, Linux Test Project'

  author = 'Linux Test Project'
  release = '1.0'
  ltp_repo = 'https://github.com/linux-test-project/ltp' +ltp_repo_base_url = f"{ltp_repo}/tree/master"
    # -- General configuration
---------------------------------------------------
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

doc/conf.py +1 -1
@@ -25,7 +27,7 @@ extensions = [
       'linuxdoc.rstKernelDoc',
       'sphinxcontrib.spelling',
       'sphinx.ext.autosectionlabel',
-    'sphinx.ext.extlinks'
+    'sphinx.ext.extlinks',

  ]
    exclude_patterns = ["html*", '_static*']

doc/conf.py +0 -0
@@ -138,7 +140,6 @@ def generate_syscalls_stats(_):

      if error:
          return
  -    syscalls_base_url = f"{ltp_repo}/tree/master" text = [
          'Syscalls\n',
          '--------\n\n',

doc/conf.py +0 -0
@@ -176,7 +177,7 @@ def generate_syscalls_stats(_):
               path = dirpath.replace('../', '')
               name = match.group('name')

  -            ltp_syscalls[name] = f'{syscalls_base_url}/{path}' +            ltp_syscalls[name] = f'{ltp_repo_base_url}/{path}'

        # compare kernel syscalls with LTP tested syscalls
      syscalls = {}
doc/conf.py +0 -0
@@ -186,7 +187,7 @@ def generate_syscalls_stats(_):

            if kersc not in syscalls:
              if kersc in white_list:
-                syscalls[kersc] =
f'{syscalls_base_url}/{white_list[kersc]}'
+                syscalls[kersc] =
f'{ltp_repo_base_url}/{white_list[kersc]}'
                  continue
                syscalls[kersc] = None

doc/conf.py +0 -0
@@ -256,6 +257,97 @@ def generate_syscalls_stats(_):
           stats.writelines(text)

    +def generate_test_catalog(_):
+    """
+    Generate the test catalog from ltp.json metadata file.
+    """
+    output = '_static/tests.rst'
+    metadata_file = '../metadata/ltp.json'
+    cve_url = "https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-" +    commit_url = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=" +    timeout_def = 0
+    text = []

doc/conf.py +17 -0
+
+    metadata = None
+    with open(metadata_file, 'r', encoding='utf-8') as data:
+        metadata = json.load(data)
+
+    timeout_def = metadata['defaults']['timeout']
+
+    for test_name, conf in metadata['tests'].items():
+        text.extend([
+            f'{test_name}\n',
+            len(test_name) * '-' + '\n'
+        ])
+
+        # source url location
+        test_fname = conf.get('fname', None)
+        if test_fname:
+            text.append(f"\n`source 

<{ltp_repo_base_url}/{test_fname}>`_\n\n")
+
+        # test description

Quoted 8 lines
Quoted 7 lines

+        desc = conf.get('doc', None)
+        if desc:
+            desc_text = []
+            for line in desc:
+                if line.startswith("[Descr"):
+                    desc_text.append("**Description**") +                elif line.startswith("[Algo"):

Huh, why not the whole [Description] and [Algorithm]?

Typos in the code :-) I just overlay it fixing the result. But yes, in the final version we need to use the full name. Maybe a comment there would have helped.

Quoted 32 lines
Quoted 32 lines

+ desc_text.append("**Algorithm**")
+                else:
+                    desc_text.append(line)

doc/conf.py +11 -0
+
+            text.extend([
+                '\n'.join(desc_text),
+                '\n'
+            ])
+
+        timeout = conf.get('timeout', None)
+        if timeout:
+            text.append(f'\nTest timeout to {timeout} seconds.')
+        else:
+            text.append(f'\nTest timeout defaults to {timeout_def} 

seconds.')

doc/conf.py +16 -0
+
+        text.append('\n\n')
+
+        # tags information
+        tags = conf.get('tags', None)
+        if tags:
+            text.extend([
+                '\n.. list-table::\n',
+                '   :widths: 50 50\n'
+                '   :header-rows: 1\n\n',
+                '   * - Tag\n',
+                '     - Info\n',
+            ])
+
+            for tag in tags:
+                tag_key = tag[0]
Quoted 8 lines
Quoted 6 lines

+                tag_val = tag[1]
+
+                if tag_key == 'CVE':
+                    tag_val = f'{tag_val} <{cve_url}{tag_val}>_' +                elif tag_key == 'linux-git':
+                    tag_val = f'{tag_val} <{commit_url}{tag_val}>_'

We also have glibc-git and musl-git, see print_test_tags() in lib/tst_test.c

Thanks for pointing it out

Quoted 63 lines
Quoted 63 lines

+                text.extend([
+                    f'   * - {tag_key}\n',
+                    f'     - {tag_val}\n',
+                ])

doc/conf.py +14 -0
+
+            text.append('\n')
+
+        # small separator between tests
+        text.extend([
+            '\n',
+            '.. raw:: html\n\n',
+            '    <hr>\n\n',
+        ])
+
+    with open(output, 'w+', encoding='utf-8') as new_tests:
+        new_tests.writelines(text)
+
+

  def setup(app):
      """
      Setup the current documentation, using self generated data and graphics

doc/conf.py +0 -0
@@ -263,3 +355,4 @@ def setup(app):

      """
      app.add_css_file('custom.css') app.connect('builder-inited', generate_syscalls_stats) +    app.connect('builder-inited', generate_test_catalog)

doc/index.rst +0 -0
index b907ac36f0c9328c576d25dee5777d808c2e5119..c00a59d31345142e78deb74eacc9da2941291d76 100644
@@ -11,6 +11,7 @@

     users/setup_tests
     users/supported_systems
     users/stats
+   users/test_catalog
    .. toctree::
     :maxdepth: 3

doc/index.rst +0 -0
@@ -54,6 +55,9 @@ For users

  :doc:users/stats
     Some LTP statistics
  +:doc:users/test_catalog
+   The LTP test catalog
+
  For developers
  --------------
  diff --git a/doc/users/test_catalog.rst b/doc/users/test_catalog.rst
new file mode 100644
index 0000000000000000000000000000000000000000..b1674f9dc614ea04a89cf084e92b72c6862a5f48

doc/users/test_catalog.rst new file +7 -1
@@ -0,0 +1,7 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+Test catalog
+============
+
+.. include:: ../_static/tests.rst
+
 
---

base-commit: 728759506cbe08612183275b3543007d1c47f7f4
change-id: 20250131-doc_tests_list-1b82f51e43fd

Quoted 7 lines
Quoted 7 lines

Best regards,

Signature · 5 lines
Andrea Cervesato <[email protected]>


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

Andrea

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

Hi!

Quoted 3 lines

I also have a question: what test configuration keys should be seen in the documentation tests list?
I.e. needs_forks, needs_kconfigs, etc.

That's a good question. We should keep the information the tester is interested in, however we should add too much either.

I guess that we want group the data somewhat like:

- options (because command line options may be useful there)

- min_kver, needs_kconfigs, min_cpus, needs_drivers, needs_cmds... (because it may describe why tests are skipped)

- needs_cgroup_ctrls + cgroup knobs (for tests that use cgroups)

- all_filesystems, skip_filesystems, filesystems

- timeout, runtime (here as well, run for longer)

- needs_root maybe?
- needs_device maybe?

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#6 lore raw
Quoted 8 lines

Hi!

Quoted 3 lines

I also have a question: what test configuration keys should be seen in the documentation tests list?
I.e. needs_forks, needs_kconfigs, etc.

That's a good question. We should keep the information the tester is interested in, however we should add too much either.

Quoted 8 lines

I guess that we want group the data somewhat like:

- options (because command line options may be useful there)

- min_kver, needs_kconfigs, min_cpus, needs_drivers, needs_cmds... (because it may describe why tests are skipped)

- needs_cgroup_ctrls + cgroup knobs (for tests that use cgroups)

Also .needs_cgroup_ver, .needs_cgroup_nsdelegate

Quoted 6 lines

- all_filesystems, skip_filesystems, filesystems

- timeout, runtime (here as well, run for longer)

- needs_root maybe?
- needs_device maybe?

IMHO both can be interesting - you can list tests you loose if you don't use root or you don't have kernel with loop device configured.

Also there are more: .caps, .hugepages, .needs_hugetlbfs, .min_mem_avail, .min_swap_avail, .dev_min_size, .needs_abi_bits, .needs_overlay (at least).

Why not to show all the info like it was previously? We never know what the reader will be interested in.

If we are really not interested at all, I would just avoid few LTP true internals, e.g.: .needs_checkpoints, .forks_child, .child_needs_reinit.

Kind regards,
Petr

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

Hi!

Quoted 9 lines
Quoted 8 lines

I guess that we want group the data somewhat like:

- options (because command line options may be useful there)

- min_kver, needs_kconfigs, min_cpus, needs_drivers, needs_cmds... (because it may describe why tests are skipped)

- needs_cgroup_ctrls + cgroup knobs (for tests that use cgroups)

Also .needs_cgroup_ver, .needs_cgroup_nsdelegate

That should be covered by the "cgroup knobs"

Quoted 10 lines
Quoted 6 lines

- all_filesystems, skip_filesystems, filesystems

- timeout, runtime (here as well, run for longer)

- needs_root maybe?
- needs_device maybe?

IMHO both can be interesting - you can list tests you loose if you don't use root or you don't have kernel with loop device configured.

Also there are more: .caps, .hugepages, .needs_hugetlbfs, .min_mem_avail,

I guess that .caps is closer to be interanal than not.

Quoted 1 line

.min_swap_avail, .dev_min_size, .needs_abi_bits, .needs_overlay (at least).

And we also have supported_archs, that is probably interesting.

Quoted 2 lines

Why not to show all the info like it was previously? We never know what the reader will be interested in.

The chalenge here is to keep the page nicely formatted and generally well arranged, having less helps a bit there. So the idea is to skip the data that are generally mostly interesting to the test runner. The quesitos is where to draw the line.

Quoted 2 lines

If we are really not interested at all, I would just avoid few LTP true internals, e.g.: .needs_checkpoints, .forks_child, .child_needs_reinit.

These are really uninteresting to anone reading that documentation.

Signature · 5 lines
Cyril Hrubis
[email protected]

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