| 1 |
"""Starlark definitions for Protobuf conformance tests. |
| 2 |
|
| 3 |
PLEASE DO NOT DEPEND ON THE CONTENTS OF THIS FILE, IT IS UNSTABLE. |
| 4 |
""" |
| 5 |
|
| 6 |
def conformance_test( |
| 7 |
name, |
| 8 |
testee, |
| 9 |
failure_list = None, |
| 10 |
text_format_failure_list = None, |
| 11 |
**kwargs): |
| 12 |
"""Conformance test runner. |
| 13 |
|
| 14 |
Args: |
| 15 |
name: the name for the test. |
| 16 |
testee: a conformance test client binary. |
| 17 |
failure_list: a text file with known failures, one per line. |
| 18 |
text_format_failure_list: a text file with known failures (one per line) |
| 19 |
for the text format conformance suite. |
| 20 |
**kwargs: common arguments to pass to sh_test. |
| 21 |
""" |
| 22 |
args = ["--testee %s" % _strip_bazel(testee)] |
| 23 |
failure_lists = [] |
| 24 |
if failure_list: |
| 25 |
args = args + ["--failure_list %s" % _strip_bazel(failure_list)] |
| 26 |
failure_lists = failure_lists + [failure_list] |
| 27 |
if text_format_failure_list: |
| 28 |
args = args + ["--text_format_failure_list %s" % _strip_bazel(text_format_failure_list)] |
| 29 |
failure_lists = failure_lists + [text_format_failure_list] |
| 30 |
|
| 31 |
native.sh_test( |
| 32 |
name = name, |
| 33 |
srcs = ["//conformance:bazel_conformance_test_runner.sh"], |
| 34 |
data = [testee] + failure_lists + [ |
| 35 |
"//conformance:conformance_test_runner", |
| 36 |
], |
| 37 |
args = args, |
| 38 |
deps = [ |
| 39 |
"@bazel_tools//tools/bash/runfiles", |
| 40 |
], |
| 41 |
tags = ["conformance"], |
| 42 |
**kwargs |
| 43 |
) |
| 44 |
|
| 45 |
def _strip_bazel(testee): |
| 46 |
if testee.startswith("//"): |
| 47 |
testee = testee.replace("//", "com_google_protobuf/") |
| 48 |
return testee.replace(":", "/") |