Skip to content

Commit b87303b

Browse files
committed
Set features explicitly
If no -F parameter is provided to yanglint, all features of all modules are automatically enabled. However, for some tests not all features shall be enabled. Therefore, add the possibility to specify the features per module. If features is not given, select all. Signed-off-by: Florian Kauer <florian.kauer@linutronix.de>
1 parent b6aa408 commit b87303b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

scripts/validate.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# SPDX-FileCopyrightText: 2024 Linutronix GmbH
44
# SPDX-License-Identifier: 0BSD
55

6+
import os
7+
import re
68
import sys
79
import yaml
810
import subprocess
@@ -15,6 +17,16 @@ def run_testcase(test):
1517
for model in test["models"]:
1618
yang_files.append(model["file"])
1719

20+
# Extract module name
21+
file_name = os.path.basename(model["file"])
22+
module_name = re.split("@|\.", file_name)[0]
23+
24+
yang_files.append("-F")
25+
if "features" in model:
26+
yang_files.append("{}:{}".format(module_name, ",".join(model["features"])))
27+
else:
28+
yang_files.append("{}:{}".format(module_name, "*"))
29+
1830
## Run yanglint
1931
command = ["yanglint"]
2032

0 commit comments

Comments
 (0)