|
| 1 | +load("//conformance/src/test/java/dev/cel/conformance:conformance_test.bzl", "conformance_test") |
| 2 | + |
| 3 | +package(default_applicable_licenses = [ |
| 4 | + "//:license", |
| 5 | +]) |
| 6 | + |
| 7 | +exports_files([ |
| 8 | + "conformance_test.bzl", |
| 9 | + "conformance_test.sh", |
| 10 | +]) |
| 11 | + |
| 12 | +java_library( |
| 13 | + name = "run", |
| 14 | + testonly = True, |
| 15 | + srcs = glob(["*.java"]), |
| 16 | + deps = [ |
| 17 | + "//:java_truth", |
| 18 | + "//checker:checker_builder", |
| 19 | + "//common", |
| 20 | + "//common:compiler_common", |
| 21 | + "//common:options", |
| 22 | + "//common/internal:default_instance_message_factory", |
| 23 | + "//common/types", |
| 24 | + "//common/types:type_providers", |
| 25 | + "//compiler", |
| 26 | + "//extensions", |
| 27 | + "//extensions:optional_library", |
| 28 | + "//parser", |
| 29 | + "//parser:macro", |
| 30 | + "//parser:parser_builder", |
| 31 | + "//runtime", |
| 32 | + "@@protobuf~//java/core", |
| 33 | + "@cel_spec//proto/cel/expr:expr_java_proto", |
| 34 | + "@cel_spec//proto/test/v1:simple_java_proto", |
| 35 | + "@cel_spec//proto/test/v1/proto2:test_all_types_java_proto", |
| 36 | + "@cel_spec//proto/test/v1/proto3:test_all_types_java_proto", |
| 37 | + "@com_google_googleapis//google/api/expr/v1alpha1:expr_java_proto", |
| 38 | + "@maven//:com_google_guava_guava", |
| 39 | + "@maven//:com_google_truth_extensions_truth_proto_extension", |
| 40 | + "@maven//:junit_junit", |
| 41 | + ], |
| 42 | +) |
| 43 | + |
| 44 | +_ALL_TESTS = [ |
| 45 | + "@cel_spec//tests/simple:testdata/basic.textproto", |
| 46 | + "@cel_spec//tests/simple:testdata/bindings_ext.textproto", |
| 47 | + "@cel_spec//tests/simple:testdata/comparisons.textproto", |
| 48 | + "@cel_spec//tests/simple:testdata/conversions.textproto", |
| 49 | + "@cel_spec//tests/simple:testdata/dynamic.textproto", |
| 50 | + "@cel_spec//tests/simple:testdata/encoders_ext.textproto", |
| 51 | + "@cel_spec//tests/simple:testdata/enums.textproto", |
| 52 | + "@cel_spec//tests/simple:testdata/fields.textproto", |
| 53 | + "@cel_spec//tests/simple:testdata/fp_math.textproto", |
| 54 | + "@cel_spec//tests/simple:testdata/integer_math.textproto", |
| 55 | + "@cel_spec//tests/simple:testdata/lists.textproto", |
| 56 | + "@cel_spec//tests/simple:testdata/logic.textproto", |
| 57 | + "@cel_spec//tests/simple:testdata/macros.textproto", |
| 58 | + "@cel_spec//tests/simple:testdata/math_ext.textproto", |
| 59 | + "@cel_spec//tests/simple:testdata/namespace.textproto", |
| 60 | + "@cel_spec//tests/simple:testdata/optionals.textproto", |
| 61 | + "@cel_spec//tests/simple:testdata/parse.textproto", |
| 62 | + "@cel_spec//tests/simple:testdata/plumbing.textproto", |
| 63 | + "@cel_spec//tests/simple:testdata/proto2.textproto", |
| 64 | + "@cel_spec//tests/simple:testdata/proto3.textproto", |
| 65 | + "@cel_spec//tests/simple:testdata/proto2_ext.textproto", |
| 66 | + "@cel_spec//tests/simple:testdata/string.textproto", |
| 67 | + "@cel_spec//tests/simple:testdata/string_ext.textproto", |
| 68 | + "@cel_spec//tests/simple:testdata/timestamps.textproto", |
| 69 | + "@cel_spec//tests/simple:testdata/unknowns.textproto", |
| 70 | + "@cel_spec//tests/simple:testdata/wrappers.textproto", |
| 71 | +] |
| 72 | + |
| 73 | +_TESTS_TO_SKIP = [ |
| 74 | + # Tests which require spec changes. |
| 75 | + # TODO: Deprecate Duration.get_milliseconds |
| 76 | + "timestamps/duration_converters/get_milliseconds", |
| 77 | + |
| 78 | + # Broken test cases which should be supported. |
| 79 | + # TODO: Invalid bytes to string conversion should error. |
| 80 | + "conversions/string/bytes_invalid", |
| 81 | + # TODO: Support setting / getting enum values out of the defined enum value range. |
| 82 | + "enums/legacy_proto2/select_big,select_neg", |
| 83 | + "enums/legacy_proto2/assign_standalone_int_big,assign_standalone_int_neg", |
| 84 | + # TODO: Generate errors on enum value assignment overflows for proto3. |
| 85 | + "enums/legacy_proto3/assign_standalone_int_too_big,assign_standalone_int_too_neg", |
| 86 | + # TODO: Ensure overflow occurs on conversions of double values which might not work properly on all platforms. |
| 87 | + "conversions/int/double_int_min_range", |
| 88 | + # TODO: Duration and timestamp operations should error on overflow. |
| 89 | + "timestamps/duration_range/from_string_under,from_string_over", |
| 90 | + "timestamps/timestamp_range/sub_time_duration_over,sub_time_duration_under", |
| 91 | + # TODO: Ensure adding negative duration values is appropriately supported. |
| 92 | + "timestamps/timestamp_arithmetic/add_time_to_duration_nanos_negative", |
| 93 | + |
| 94 | + # Skip until fixed. |
| 95 | + "wrappers/field_mask/to_json", |
| 96 | + "wrappers/empty/to_json", |
| 97 | + "wrappers/duration/to_json", |
| 98 | + "wrappers/timestamp/to_json", |
| 99 | + "fields/qualified_identifier_resolution/map_value_repeat_key_heterogeneous", |
| 100 | + # TODO: Add strings.quote. |
| 101 | + "string_ext/quote", |
| 102 | + |
| 103 | + # TODO: Fix null assignment to a field |
| 104 | + "proto2/set_null/single_message", |
| 105 | + "proto2/set_null/single_duration", |
| 106 | + "proto2/set_null/single_timestamp", |
| 107 | + "proto3/set_null/single_message", |
| 108 | + "proto3/set_null/single_duration", |
| 109 | + "proto3/set_null/single_timestamp", |
| 110 | + |
| 111 | + # Future features for CEL 1.0 |
| 112 | + # TODO: Strong typing support for enums, specified but not implemented. |
| 113 | + "enums/strong_proto2", |
| 114 | + "enums/strong_proto3", |
| 115 | + |
| 116 | + # com.google.protobuf.TextFormat does not conform to the spec. Unknown enum values are supposed |
| 117 | + # to be allowed in proto3. Currently they are rejected. |
| 118 | + # "enums/legacy_proto3/select_big", |
| 119 | + # "enums/legacy_proto3/select_neg", |
| 120 | + # "enums/legacy_proto3/assign_standalone_int_big", |
| 121 | + # "enums/legacy_proto3/assign_standalone_int_neg", |
| 122 | + |
| 123 | + # Not yet implemented. |
| 124 | + "math_ext/ceil", |
| 125 | + "math_ext/floor", |
| 126 | + "math_ext/round", |
| 127 | + "math_ext/trunc", |
| 128 | + "math_ext/abs", |
| 129 | + "math_ext/sign", |
| 130 | + "math_ext/isNaN", |
| 131 | + "math_ext/isInf", |
| 132 | + "math_ext/isFinite", |
| 133 | + "math_ext/bit_and", |
| 134 | + "math_ext/bit_or", |
| 135 | + "math_ext/bit_xor", |
| 136 | + "math_ext/bit_not", |
| 137 | + "math_ext/bit_shift_left", |
| 138 | + "math_ext/bit_shift_right", |
| 139 | +] |
| 140 | + |
| 141 | +conformance_test( |
| 142 | + name = "conformance", |
| 143 | + dashboard = False, |
| 144 | + data = _ALL_TESTS, |
| 145 | + skip_tests = _TESTS_TO_SKIP, |
| 146 | +) |
| 147 | + |
| 148 | +conformance_test( |
| 149 | + name = "conformance_dashboard", |
| 150 | + dashboard = True, |
| 151 | + data = _ALL_TESTS, |
| 152 | +) |
0 commit comments