[rtems-central commit] validation: Support test cases in build objects
Sebastian Huber
sebh at rtems.org
Wed Jul 21 17:20:21 UTC 2021
Module: rtems-central
Branch: master
Commit: 5f3d5fa8b31ef62e81d3a4377e84b2369f2cb87b
Changeset: http://git.rtems.org/rtems-central/commit/?id=5f3d5fa8b31ef62e81d3a4377e84b2369f2cb87b
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jul 15 15:32:49 2021 +0200
validation: Support test cases in build objects
---
rtemsspec/tests/spec-validation/obj.yml | 14 ++++++++++++++
rtemsspec/tests/spec-validation/tp.yml | 5 +++--
rtemsspec/validation.py | 12 +++++++++++-
3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/rtemsspec/tests/spec-validation/obj.yml b/rtemsspec/tests/spec-validation/obj.yml
new file mode 100644
index 0000000..9a38b6a
--- /dev/null
+++ b/rtemsspec/tests/spec-validation/obj.yml
@@ -0,0 +1,14 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: objects
+cflags: []
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
+cppflags: []
+cxxflags: []
+enabled-by: true
+includes: []
+install: []
+links: []
+source:
+- tc12.c
+type: build
diff --git a/rtemsspec/tests/spec-validation/tp.yml b/rtemsspec/tests/spec-validation/tp.yml
index 825ee2e..6fb5932 100644
--- a/rtemsspec/tests/spec-validation/tp.yml
+++ b/rtemsspec/tests/spec-validation/tp.yml
@@ -1,8 +1,9 @@
build-type: test-program
enabled-by: true
-links: []
+links:
+- role: build-dependency
+ uid: obj
source:
-- tc12.c
- tc34.c
- ts.c
- action2.c
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 24efc21..0d96117 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -24,6 +24,8 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
+# pylint: disable=too-many-lines
+
import itertools
import os
import re
@@ -896,12 +898,20 @@ class _SourceFile:
content.write(os.path.join(base_directory, self._file))
+def _gather_build_source_files(item: Item, files: List[str]):
+ for parent in item.parents("build-dependency"):
+ _gather_build_source_files(parent, files)
+ files.extend(item.data.get("source", []))
+
+
class _TestProgram:
""" A test program. """
def __init__(self, item: Item):
""" Initializes a test program. """
self._item = item
self._source_files = [] # type: List[_SourceFile]
+ self._build_source_files = [] # type: List[str]
+ _gather_build_source_files(item, self._build_source_files)
@property
def source_files(self) -> List[_SourceFile]:
@@ -913,7 +923,7 @@ class _TestProgram:
Adds the source files of the test program which are present in the
source file map.
"""
- for filename in self._item["source"]:
+ for filename in self._build_source_files:
source_file = source_files.get(filename, None)
if source_file is not None:
self._source_files.append(source_file)
More information about the vc
mailing list