sanitycheck: use test instead of section
The section terminology was relevant with the ini syntax, with yaml we
can call this a test and avoid confusion and make the code more
readable.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/scripts/sanitycheck b/scripts/sanitycheck
index 15ef3ac..4e7697b 100755
--- a/scripts/sanitycheck
+++ b/scripts/sanitycheck
@@ -1057,15 +1057,12 @@
raise ConfigurationError(
self.filename, "unknown type '%s'" % value)
- def section(self, name):
- return self.tests.get(name, {})
+ def get_test(self, name, valid_keys):
+ """Get a dictionary representing the keys/values within a test
- def get_section(self, section, valid_keys):
- """Get a dictionary representing the keys/values within a section
-
- @param section The section in the .yaml file to retrieve data from
+ @param name The test in the .yaml file to retrieve data from
@param valid_keys A dictionary representing the intended semantics
- for this section. Each key in this dictionary is a key that could
+ for this test. Each key in this dictionary is a key that could
be specified, if a key is given in the .yaml file which isn't in
here, it will generate an error. Each value in this dictionary
is another dictionary containing metadata:
@@ -1081,19 +1078,19 @@
"required" - If true, raise an error if not defined. If false
and "default" isn't specified, a type conversion will be
done on an empty string
- @return A dictionary containing the section key-value pairs with
+ @return A dictionary containing the test key-value pairs with
type conversion and default values filled in per valid_keys
"""
d = {}
for k, v in self.common.items():
d[k] = v
- for k, v in self.section(section).items():
+ for k, v in self.tests[name].items():
if k not in valid_keys:
raise ConfigurationError(
self.filename,
"Unknown config key '%s' in definition for '%s'" %
- (k, section))
+ (k, name))
if k in d:
if isinstance(d[k], str):
@@ -1110,8 +1107,8 @@
if required:
raise ConfigurationError(
self.filename,
- "missing required value for '%s' in section '%s'" %
- (k, section))
+ "missing required value for '%s' in test '%s'" %
+ (k, name))
else:
if "default" in kinfo:
default = kinfo["default"]
@@ -1123,8 +1120,8 @@
d[k] = self._cast_value(d[k], kinfo["type"])
except ValueError as ve:
raise ConfigurationError(
- self.filename, "bad %s value '%s' for key '%s' in section '%s'" %
- (kinfo["type"], d[k], k, section))
+ self.filename, "bad %s value '%s' for key '%s' in name '%s'" %
+ (kinfo["type"], d[k], k, name))
return d
@@ -1358,7 +1355,7 @@
workdir = os.path.relpath(dirpath, testcase_root)
for name, section in parsed_data.tests.items():
- tc_dict = parsed_data.get_section(
+ tc_dict = parsed_data.get_test(
name, testcase_valid_keys)
tc = TestCase(testcase_root, workdir, name, tc_dict,
yaml_path)