aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralevitskii <alevitskii@yandex-team.com>2024-06-11 13:38:33 +0300
committeralevitskii <alevitskii@yandex-team.com>2024-06-12 10:34:44 +0300
commit9849aa39f829a1c7ed002973666db0f11b07b2a5 (patch)
tree535775b2fd40dbdd4c452dac33d89aea59cce931
parent67e7cccc330744cdb98035e309f626c1f63afb84 (diff)
downloadydb-9849aa39f829a1c7ed002973666db0f11b07b2a5.tar.gz
Stricter trimming in dart files
Stricter trimming in dart files b8eeb48ccf1ed0341d21160679810952f71aeff4
-rw-r--r--build/plugins/nots.py3
-rw-r--r--build/plugins/ytest.py20
2 files changed, 11 insertions, 12 deletions
diff --git a/build/plugins/nots.py b/build/plugins/nots.py
index 909efcb546..0d233ff835 100644
--- a/build/plugins/nots.py
+++ b/build/plugins/nots.py
@@ -486,8 +486,7 @@ def _add_test(unit, test_type, test_files, deps=None, test_record=None, test_cwd
if test_record:
full_test_record.update(test_record)
- # this kind of dart is very sensitive to missing fields, so we disable trimming
- data = ytest.dump_test(unit, full_test_record, trim_falsy_fields=False)
+ data = ytest.dump_test(unit, full_test_record)
if data:
unit.set_property(["DART_DATA", data])
diff --git a/build/plugins/ytest.py b/build/plugins/ytest.py
index 73abe040f6..9ebea4379e 100644
--- a/build/plugins/ytest.py
+++ b/build/plugins/ytest.py
@@ -80,6 +80,10 @@ def validate_test(unit, kw):
errors = []
warnings = []
+ mandatory_fields = {"SCRIPT-REL-PATH", "SOURCE-FOLDER-PATH", "TEST-NAME"}
+ for field in mandatory_fields - valid_kw.keys():
+ errors.append(f"Mandatory field {field!r} is not set in DART")
+
if valid_kw.get('SCRIPT-REL-PATH') == 'boost.test':
project_path = valid_kw.get('BUILD-FOLDER-PATH', "")
if not project_path.startswith(
@@ -333,12 +337,8 @@ def validate_test(unit, kw):
return valid_kw, warnings, errors
-def dump_test(unit, kw, trim_falsy_fields=True):
- if trim_falsy_fields:
- # "SCRIPT-REL-PATH", "SOURCE-FOLDER-PATH", "TEST-NAME" are required to distinguish dart files
- # TODO remove "TEST-FILES", "FILES" once defaults are moved to tests suites
- dont_trim = ("SCRIPT-REL-PATH", "SOURCE-FOLDER-PATH", "TEST-NAME", "TEST-FILES", "FILES")
- kw = {k: v for k, v in kw.items() if k in dont_trim or v and (not isinstance(v, (str, bytes)) or v.strip())}
+def dump_test(unit, kw):
+ kw = {k: v for k, v in kw.items() if v and (not isinstance(v, str | bytes) or v.strip())}
valid_kw, warnings, errors = validate_test(unit, kw)
for w in warnings:
unit.message(['warn', w])
@@ -403,14 +403,14 @@ def implies(a, b):
def match_coverage_extractor_requirements(unit):
- # we shouldn't add test if
+ # we add test if
return all(
(
- # tests are not requested
+ # tests are requested
unit.get("TESTS_REQUESTED") == "yes",
- # build doesn't imply clang coverage, which supports segment extraction from the binaries
+ # build implies clang coverage, which supports segment extraction from the binaries
unit.get("CLANG_COVERAGE") == "yes",
- # contrib wasn't requested
+ # contrib was requested
implies(
_common.get_norm_unit_path(unit).startswith("contrib/"), unit.get("ENABLE_CONTRIB_COVERAGE") == "yes"
),