diff --git a/sycl/test-e2e/E2EExpr.py b/sycl/test-e2e/E2EExpr.py index dd8aecb7212d9..dc1be96784d5b 100644 --- a/sycl/test-e2e/E2EExpr.py +++ b/sycl/test-e2e/E2EExpr.py @@ -36,9 +36,16 @@ class E2EExpr(BooleanExpression): "vulkan", "hip_options", "cuda_options", + "host=None", + "target=None", + "shell", + "non-root-user", + "llvm-spirv", + "llvm-link", "true", "false", "pdtracker", + "ze_debug", } def __init__(self, string, variables, build_only_mode, final_unknown_value): @@ -66,14 +73,10 @@ def evaluate(string, variables, build_only_mode, final_unknown_value=True): def parseMATCH(self): token = self.token BooleanExpression.parseMATCH(self) - if token not in self.build_specific_features and self.build_only_mode: + if token not in E2EExpr.build_specific_features and self.build_only_mode: self.unknown = True else: self.unknown = False - if self.value and self.unknown: - raise ValueError( - 'Runtime feature "' + token + '" evaluated to True in build-only' - ) def parseAND(self): self.parseNOT() @@ -113,6 +116,18 @@ def parseAll(self): self.expect(BooleanExpression.END) return self.final_unknown_value if self.unknown else self.value + @staticmethod + def check_build_features(variables): + rt_features = [x for x in variables if x not in E2EExpr.build_specific_features] + if rt_features: + raise ValueError( + "Runtime features: " + + str(rt_features) + + " evaluated to True in build-only\n" + + "If this is a new build specific feature append it to:" + + "`build_specific_features` in `sycl/test-e2e/E2EExpr.py`" + ) + import unittest @@ -165,11 +180,12 @@ def test_basic(self): self.assertFalse( UnsupportedBuildEval("linux && (vulkan && rt_feature)", {"linux"}) ) - # runtime feature is present in build-only + # Check that no runtime features are present in build-only with self.assertRaises(ValueError): - RequiresBuildEval("rt_feature", {"rt_feature"}) + E2EExpr.check_build_features({"rt-feature"}) with self.assertRaises(ValueError): - UnsupportedBuildEval("rt_feature", {"rt_feature"}) + E2EExpr.check_build_features({"build-only", "rt-feature"}) + E2EExpr.check_build_features({"build-mode"}) if __name__ == "__main__": diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index 2d1aef9020c55..019a08f446220 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -1098,6 +1098,12 @@ def get_sycl_ls_verbose(sycl_device, env): clangxx += config.cxx_flags config.substitutions.append(("%clangxx", clangxx)) +# Check that no runtime features are available when in build-only +from E2EExpr import E2EExpr + +if config.test_mode == "build-only": + E2EExpr.check_build_features(config.available_features) + if lit_config.params.get("print_features", False): lit_config.note( "Global features: {}".format(" ".join(sorted(config.available_features)))