Compare commits

...

4 Commits

Author SHA1 Message Date
Anas Nashif
1396bc2563 ci: integrate requirements into docs workflow.
Integrate into doc workflow.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-10-21 10:37:13 -04:00
Anas Nashif
5ff072896f doc: add requirements into doxygen
Script to convert requirements to dox.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-10-21 10:37:13 -04:00
Anas Nashif
81e57ce414 manifest: pull requirements in
Pull requirements in so we can convert them to dox and integrate with
doxygen.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-10-21 10:37:13 -04:00
Anas Nashif
c3693a0558 tests: kernel: add verification tag for tests
An example for creating traceability between tests and requirements.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-10-21 10:37:13 -04:00
6 changed files with 114 additions and 19 deletions

View File

@@ -110,11 +110,22 @@ jobs:
pip3 install west==${WEST_VERSION}
pip3 install cmake==${CMAKE_VERSION}
pip3 install coverxygen
pip3 install mlx.traceability strictdoc
- name: west setup
run: |
west init -l .
- name: prcoess requirements
run: |
west update reqmgmt
pushd ../tools/reqmgmt
strictdoc export . --formats json
popd
cp ../tools/reqmgmt/output/json/index.json doc/requirements/requirements.json
python3 doc/requirements/create_req.py --json doc/requirements/requirements.json --output doc/requirements/requirements.dox
- name: build-docs
shell: bash
run: |
@@ -135,17 +146,10 @@ jobs:
SPHINXOPTS_EXTRA="-q -t publish" \
make -C doc ${DOC_TARGET}
# API documentation coverage
python3 -m coverxygen --xml-dir doc/_build/html/doxygen/xml/ --src-dir include/ --output doc-coverage.info
# deprecated page causing issues
lcov --remove doc-coverage.info \*/deprecated > new.info
genhtml --no-function-coverage --no-branch-coverage new.info -o coverage-report
- name: compress-docs
run: |
tar --use-compress-program="xz -T0" -cf html-output.tar.xz --directory=doc/_build html
tar --use-compress-program="xz -T0" -cf api-output.tar.xz --directory=doc/_build html/doxygen/html
tar --use-compress-program="xz -T0" -cf api-coverage.tar.xz coverage-report
- name: upload-build
uses: actions/upload-artifact@v4
@@ -153,12 +157,6 @@ jobs:
name: html-output
path: html-output.tar.xz
- name: upload-api-coverage
uses: actions/upload-artifact@v4
with:
name: api-coverage
path: api-coverage.tar.xz
- name: process-pr
if: github.event_name == 'pull_request'
run: |

View File

@@ -4359,6 +4359,15 @@ West:
labels:
- "area: West"
"West project: reqmgmt":
status: maintained
maintainers:
- nashif
- simhein
files: []
labels:
- "area: Requirements"
"West project: acpica":
status: maintained
maintainers:

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3
# Copyright (c) 2024 Intel Corp.
# SPDX-License-Identifier: Apache-2.0
import sys
import argparse
import json
HEADER = """
/**
@page Requirements
@tableofcontents
"""
FOOTER = """
*/
"""
def debug(msg):
print("DEBUG: {}".format(msg))
def parse_nodes(nodes, grouped):
for n in nodes:
if n['TYPE'] in ['TEXT'] :
continue
elif n['TYPE'] in ['SECTION'] :
grouped = parse_nodes(n['NODES'], grouped)
else:
rid = n.get('UID')
name = n['TITLE']
text= n['STATEMENT']
group = n.get('COMPONENT', None)
if not group:
debug("No group for {}".format(rid))
continue
if not grouped.get(group, None):
grouped[group] = []
grouped[group].append({'rid': rid, 'req': text, 'name': name })
return grouped
def parse_strictdoc_json(filename):
grouped = dict()
with open(filename) as fp:
data = json.load(fp)
docs = data.get('DOCUMENTS')
for d in docs:
parse_nodes(d['NODES'], grouped)
return grouped
def write_dox(grouped, output="requirements.dox"):
with open(output, "w") as req:
req.write(HEADER)
counter = 0
for r in grouped.keys():
comp = grouped[r]
counter += 1
req.write(f"\n@section REQSEC{counter} {r}\n\n")
for c in comp:
req.write("@subsection {} {}: {}\n{}\n\n\n".format(c['rid'], c['rid'], c['name'], c['req']))
req.write(FOOTER)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Create doxygen requirements page', allow_abbrev=False)
parser.add_argument('--json', help='JSON file to parse')
parser.add_argument('--output', help='Output file to write to')
args = parser.parse_args()
if args.json:
filename = args.json
write_dox(parse_strictdoc_json(filename), args.output)
else:
sys.exit("no input given")

View File

@@ -282,7 +282,7 @@ TAB_SIZE = 8
ALIASES = "rst=\verbatim embed:rst:leading-asterisk" \
endrst=\endverbatim \
"kconfig{1}=\htmlonly <code>\1</code> \endhtmlonly \xmlonly <verbatim>embed:rst:inline :kconfig:option:`\1`</verbatim> \endxmlonly" \
"req{1}=\ref ZEPH_\1 \"ZEPH-\1\"" \
"req{1}=\ref ZEP-\1 \"ZEP-\1\"" \
"satisfy{1}=\xrefitem satisfy \"Satisfies requirement\" \"Requirement Implementation\" \1" \
"verify{1}=\xrefitem verify \"Verifies requirement\" \"Requirement Verification\" \1" \
"kconfig_dep{1}=\attention Available only when the following Kconfig option is enabled: \kconfig{\1}." \
@@ -980,7 +980,14 @@ INPUT = @ZEPHYR_BASE@/doc/_doxygen/mainpage.md \
@ZEPHYR_BASE@/include/ \
@ZEPHYR_BASE@/lib/libc/minimal/include/ \
@ZEPHYR_BASE@/subsys/testsuite/include/ \
@ZEPHYR_BASE@/subsys/testsuite/ztest/include/
@ZEPHYR_BASE@/subsys/testsuite/ztest/include/ \
@ZEPHYR_BASE@/tests/kernel/semaphore/ \
@ZEPHYR_BASE@/tests/kernel/threads/ \
@ZEPHYR_BASE@/tests/kernel/mutex/ \
@ZEPHYR_BASE@/kernel/sem.c \
@ZEPHYR_BASE@/kernel/thread.c \
@ZEPHYR_BASE@/kernel/sched.c \
@ZEPHYR_BASE@/doc/requirements/requirements.dox
# This tag can be used to specify the character encoding of the source files
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses
@@ -1064,9 +1071,7 @@ EXCLUDE_PATTERNS =
# ANamespace::AClass, ANamespace::*Test
EXCLUDE_SYMBOLS = _* \
*.__unnamed__ \
z_* \
Z_*
*.__unnamed__
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
@@ -1182,7 +1187,7 @@ SOURCE_BROWSER = NO
# documentation.
# The default value is: NO.
INLINE_SOURCES = NO
INLINE_SOURCES = YES
# Setting the STRIP_CODE_COMMENTS tag to YES will instruct Doxygen to hide any
# special comment blocks from generated source code fragments. Normal C, C++ and
@@ -2507,7 +2512,9 @@ PREDEFINED = __DOXYGEN__ \
CONFIG_UART_INTERRUPT_DRIVEN \
CONFIG_UART_ASYNC_API \
CONFIG_USERSPACE \
CONFIG_ZTEST \
CONFIG_USE_SWITCH \
CONFIG_MULTITHREADING \
NET_MGMT_DEFINE_REQUEST_HANDLER(x)= \
DEVICE_DEFINE()= \
BUILD_ASSERT()= \

View File

@@ -64,6 +64,7 @@ void thread2_set_prio_test(void *p1, void *p2, void *p3)
* @brief Test the k_thread_priority_set() API
*
* @see k_thread_priority_set(), k_thread_priority_get()
* @verify{@req{SRS-1-2}}
*/
ZTEST(threads_lifecycle, test_threads_priority_set)
{

View File

@@ -29,6 +29,9 @@ manifest:
#
# Please add items below based on alphabetical order
projects:
- name: reqmgmt
revision: 1f96a9f17559547900c697e86adb9cc04e16af74
path: tools/reqmgmt
- name: acpica
revision: 8d24867bc9c9d81c81eeac59391cda59333affd4
path: modules/lib/acpica