Josh Haberman | 35a1cc7 | 2015-04-01 17:23:48 -0700 | [diff] [blame] | 1 | Protocol Buffers - Google's data interchange format |
| 2 | =================================================== |
| 3 | |
Josh Haberman | 35a1cc7 | 2015-04-01 17:23:48 -0700 | [diff] [blame] | 4 | Copyright 2008 Google Inc. |
| 5 | |
| 6 | This directory contains conformance tests for testing completeness and |
| 7 | correctness of Protocol Buffers implementations. These tests are designed |
| 8 | to be easy to run against any Protocol Buffers implementation. |
| 9 | |
| 10 | This directory contains the tester process `conformance-test`, which |
| 11 | contains all of the tests themselves. Then separate programs written |
| 12 | in whatever language you want to test communicate with the tester |
| 13 | program over a pipe. |
| 14 | |
| 15 | Before running any of these tests, make sure you run `make` in the base |
| 16 | directory to build `protoc`, since all the tests depend on it. |
| 17 | |
| 18 | $ make |
| 19 | |
Josh Haberman | 1b0db1c | 2017-03-16 15:19:09 -0700 | [diff] [blame] | 20 | Running the tests for C++ |
| 21 | ------------------------- |
| 22 | |
| 23 | To run the tests against the C++ implementation, run: |
Josh Haberman | 35a1cc7 | 2015-04-01 17:23:48 -0700 | [diff] [blame] | 24 | |
| 25 | $ cd conformance && make test_cpp |
| 26 | |
Josh Haberman | 1b0db1c | 2017-03-16 15:19:09 -0700 | [diff] [blame] | 27 | Running the tests for JavaScript (Node.js) |
| 28 | ------------------------------------------ |
| 29 | |
| 30 | To run the JavaScript tests against Node.js, make sure you have "node" |
| 31 | on your path and then run: |
| 32 | |
| 33 | $ cd conformance && make test_nodejs |
| 34 | |
| 35 | Running the tests for Ruby (MRI) |
| 36 | -------------------------------- |
| 37 | |
| 38 | To run the Ruby tests against MRI, first build the C extension: |
| 39 | |
| 40 | $ cd ruby && rake |
| 41 | |
| 42 | Then run the tests like so: |
| 43 | |
| 44 | $ cd conformance && make test_ruby |
| 45 | |
| 46 | Running the tests for other languages |
| 47 | ------------------------------------- |
| 48 | |
| 49 | Most of the languages in the Protobuf source tree are set up to run |
| 50 | conformance tests. However some of them are more tricky to set up |
| 51 | properly. See `tests.sh` in the base of the repository to see how |
| 52 | Travis runs the tests. |
Josh Haberman | 35a1cc7 | 2015-04-01 17:23:48 -0700 | [diff] [blame] | 53 | |
| 54 | Testing other Protocol Buffer implementations |
| 55 | --------------------------------------------- |
| 56 | |
| 57 | To run these tests against a new Protocol Buffers implementation, write a |
| 58 | program in your language that uses the protobuf implementation you want |
| 59 | to test. This program should implement the testing protocol defined in |
Feng Xiao | afe98de | 2018-08-22 11:55:30 -0700 | [diff] [blame] | 60 | [conformance.proto](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance.proto). |
Josh Haberman | 35a1cc7 | 2015-04-01 17:23:48 -0700 | [diff] [blame] | 61 | This is designed to be as easy as possible: the C++ version is only |
| 62 | 150 lines and is a good example for what this program should look like |
Feng Xiao | afe98de | 2018-08-22 11:55:30 -0700 | [diff] [blame] | 63 | (see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/master/conformance/conformance_cpp.cc)). |
Josh Haberman | 35a1cc7 | 2015-04-01 17:23:48 -0700 | [diff] [blame] | 64 | The program only needs to be able to read from stdin and write to stdout. |
| 65 | |
| 66 | Portability |
| 67 | ----------- |
| 68 | |
| 69 | Note that the test runner currently does not work on Windows. Patches |
| 70 | to fix this are welcome! (But please get in touch first to settle on |
| 71 | a general implementation strategy). |