• Home
Name Date Size #Lines LOC

..--

test_protos/22-Oct-2025-273236

BUILD.bazelD22-Oct-202513.6 KiB467431

ConformanceJava.javaD22-Oct-202514.2 KiB411358

ConformanceJavaLite.javaD22-Oct-202512.1 KiB358310

README.mdD22-Oct-20253.9 KiB10571

autoload.phpD22-Oct-2025749 2217

bazel_conformance_test_runner.shD22-Oct-20252.2 KiB6751

binary_json_conformance_suite.ccD22-Oct-2025141.9 KiB3,5223,124

binary_json_conformance_suite.hD22-Oct-20258.1 KiB189161

conformance.protoD22-Oct-20256.5 KiB173148

conformance_cpp.ccD22-Oct-20258.6 KiB273222

conformance_dart.dartD22-Oct-20253 KiB10593

conformance_objc.mD22-Oct-20256.4 KiB198168

conformance_php.phpD22-Oct-20256.7 KiB175154

conformance_python.pyD22-Oct-20258.1 KiB210163

conformance_ruby.rbD22-Oct-20253.6 KiB12895

conformance_rust.rsD22-Oct-20254 KiB11689

conformance_test.ccD22-Oct-202527.4 KiB793678

conformance_test.hD22-Oct-202514 KiB374193

conformance_test_main.ccD22-Oct-2025688 189

conformance_test_runner.ccD22-Oct-202516 KiB473365

defs.bzlD22-Oct-20251.7 KiB5447

failure_list_cpp.txtD22-Oct-20254.8 KiB3836

failure_list_csharp.txtD22-Oct-20252.1 KiB3634

failure_list_dart_upb.txtD22-Oct-20250

failure_list_java.txtD22-Oct-20256.3 KiB4644

failure_list_java_lite.txtD22-Oct-2025578 97

failure_list_jruby.txtD22-Oct-20258.7 KiB147146

failure_list_jruby_ffi.txtD22-Oct-20250

failure_list_objc.txtD22-Oct-2025139 32

failure_list_php.txtD22-Oct-20252.7 KiB4342

failure_list_php_c.txtD22-Oct-2025453 98

failure_list_python-post26.txtD22-Oct-202586 32

failure_list_python.txtD22-Oct-20250

failure_list_python_cpp.txtD22-Oct-2025399 98

failure_list_python_upb.txtD22-Oct-20250

failure_list_ruby.txtD22-Oct-20250

failure_list_rust_cc.txtD22-Oct-20250

failure_list_rust_upb.txtD22-Oct-20250

failure_list_trie_node.ccD22-Oct-20252.7 KiB9072

failure_list_trie_node.hD22-Oct-20252 KiB5924

failure_list_trie_node_test.ccD22-Oct-20254.7 KiB12698

text_format_conformance_suite.ccD22-Oct-202539.4 KiB896771

text_format_conformance_suite.hD22-Oct-20253 KiB8360

text_format_failure_list_cpp.txtD22-Oct-20253.2 KiB2321

text_format_failure_list_dart_upb.txtD22-Oct-20250

text_format_failure_list_java.txtD22-Oct-20251.6 KiB1110

text_format_failure_list_java_lite.txtD22-Oct-2025277 65

text_format_failure_list_php.txtD22-Oct-20250

text_format_failure_list_python.txtD22-Oct-20258.2 KiB5552

text_format_failure_list_python_cpp.txtD22-Oct-20255.9 KiB3736

text_format_failure_list_python_upb.txtD22-Oct-20256 KiB4039

text_format_failure_list_rust_cc.txtD22-Oct-20250

text_format_failure_list_rust_upb.txtD22-Oct-20250

update_failure_list.pyD22-Oct-20253.1 KiB8957

README.md

1Protocol Buffers - Google's data interchange format
2===================================================
3
4Copyright 2008 Google Inc.
5
6This directory contains conformance tests for testing completeness and
7correctness of Protocol Buffers implementations.  These tests are designed
8to be easy to run against any Protocol Buffers implementation.
9
10This directory contains the tester process `conformance-test`, which
11contains all of the tests themselves.  Then separate programs written
12in whatever language you want to test communicate with the tester
13program over a pipe.
14
15If you're not using Bazel to run these tests, make sure you build the C++
16tester code beforehand, e.g. from the base directory:
17
18    $ cmake . -Dprotobuf_BUILD_CONFORMANCE=ON && cmake --build .
19
20This will produce a `conformance_test_runner` binary that can be used to run
21conformance tests on any executable.  Pass it `--help` for more information.
22
23Running the tests for C++
24-------------------------
25
26To run the tests against the C++ implementation, run:
27
28    $ bazel test //src:conformance_test
29
30Or alternatively with CMake:
31
32    $ ctest -R conformance_cpp_test
33
34Running the tests for other languages
35-------------------------------------
36
37All of the languages in the Protobuf source tree are set up to run conformance
38tests using similar patterns.  You can either use Bazel to run the
39`conformance_test` target defined in the language's root `BUILD.bazel` file,
40or create an executable for a custom test and pass it to
41`conformance_test_runner`.
42
43Note: CMake can be used to build the conformance test runner, but not any of
44the conformance test executables outside C++.  So if you aren't using Bazel
45you'll need to create the executable you pass to `conformance_test_runner` via
46some alternate build system.
47
48While we plan to model all our supported languages more completely in Bazel,
49today some of them are a bit tricky to run.  Below is a list of the commands
50(and prerequisites) to run each language's conformance tests.
51
52Java:
53
54    $ bazel test //java/core:conformance_test //java/lite:conformance_test
55
56Python:
57
58    $ bazel test //python:conformance_test
59
60Python C++:
61
62    $ bazel test //python:conformance_test_cpp --define=use_fast_cpp_protos=true
63
64C#:
65
66    $ `which dotnet || echo "You must have dotnet installed!"
67    $ `bazel test //csharp:conformance_test \
68        --action_env=DOTNET_CLI_TELEMETRY_OPTOUT=1 --test_env=DOTNET_CLI_HOME=~ \
69        --action_env=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
70
71Objective-C (Mac only):
72
73    $ `bazel test //objectivec:conformance_test --macos_minimum_os=10.9
74
75Ruby:
76
77    $ [[ $(ruby --version) == "ruby"* ]] || echo "Select a C Ruby!"
78    $ bazel test //ruby:conformance_test --define=ruby_platform=c \
79        --action_env=PATH --action_env=GEM_PATH --action_env=GEM_HOME
80
81JRuby:
82
83    $ [[ $(ruby --version) == "jruby"* ]] || echo "Switch to Java Ruby!"
84    $ bazel test //ruby:conformance_test_jruby --define=ruby_platform=java \
85        --action_env=PATH --action_env=GEM_PATH --action_env=GEM_HOME
86
87Testing other Protocol Buffer implementations
88---------------------------------------------
89
90To run these tests against a new Protocol Buffers implementation, write a
91program in your language that uses the protobuf implementation you want
92to test.  This program should implement the testing protocol defined in
93[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance.proto).
94This is designed to be as easy as possible: the C++ version is only
95150 lines and is a good example for what this program should look like
96(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance_cpp.cc)).
97The program only needs to be able to read from stdin and write to stdout.
98
99Portability
100-----------
101
102Note that the test runner currently does not work on Windows.  Patches
103to fix this are welcome!  (But please get in touch first to settle on
104a general implementation strategy).
105