1*1b3f573fSAndroid Build Coastguard WorkerProtocol Buffers - Google's data interchange format 2*1b3f573fSAndroid Build Coastguard Worker=================================================== 3*1b3f573fSAndroid Build Coastguard Worker 4*1b3f573fSAndroid Build Coastguard WorkerCopyright 2008 Google Inc. 5*1b3f573fSAndroid Build Coastguard Worker 6*1b3f573fSAndroid Build Coastguard WorkerThis directory contains conformance tests for testing completeness and 7*1b3f573fSAndroid Build Coastguard Workercorrectness of Protocol Buffers implementations. These tests are designed 8*1b3f573fSAndroid Build Coastguard Workerto be easy to run against any Protocol Buffers implementation. 9*1b3f573fSAndroid Build Coastguard Worker 10*1b3f573fSAndroid Build Coastguard WorkerThis directory contains the tester process `conformance-test`, which 11*1b3f573fSAndroid Build Coastguard Workercontains all of the tests themselves. Then separate programs written 12*1b3f573fSAndroid Build Coastguard Workerin whatever language you want to test communicate with the tester 13*1b3f573fSAndroid Build Coastguard Workerprogram over a pipe. 14*1b3f573fSAndroid Build Coastguard Worker 15*1b3f573fSAndroid Build Coastguard WorkerBefore running any of these tests, make sure you run `make` in the base 16*1b3f573fSAndroid Build Coastguard Workerdirectory to build `protoc`, since all the tests depend on it. 17*1b3f573fSAndroid Build Coastguard Worker 18*1b3f573fSAndroid Build Coastguard Worker $ make 19*1b3f573fSAndroid Build Coastguard Worker 20*1b3f573fSAndroid Build Coastguard WorkerRunning the tests for C++ 21*1b3f573fSAndroid Build Coastguard Worker------------------------- 22*1b3f573fSAndroid Build Coastguard Worker 23*1b3f573fSAndroid Build Coastguard WorkerTo run the tests against the C++ implementation, run: 24*1b3f573fSAndroid Build Coastguard Worker 25*1b3f573fSAndroid Build Coastguard Worker $ cd conformance && make test_cpp 26*1b3f573fSAndroid Build Coastguard Worker 27*1b3f573fSAndroid Build Coastguard WorkerRunning the tests for JavaScript (Node.js) 28*1b3f573fSAndroid Build Coastguard Worker------------------------------------------ 29*1b3f573fSAndroid Build Coastguard Worker 30*1b3f573fSAndroid Build Coastguard WorkerTo run the JavaScript tests against Node.js, make sure you have "node" 31*1b3f573fSAndroid Build Coastguard Workeron your path and then run: 32*1b3f573fSAndroid Build Coastguard Worker 33*1b3f573fSAndroid Build Coastguard Worker $ cd conformance && make test_nodejs 34*1b3f573fSAndroid Build Coastguard Worker 35*1b3f573fSAndroid Build Coastguard WorkerRunning the tests for Ruby (MRI) 36*1b3f573fSAndroid Build Coastguard Worker-------------------------------- 37*1b3f573fSAndroid Build Coastguard Worker 38*1b3f573fSAndroid Build Coastguard WorkerTo run the Ruby tests against MRI, first build the C extension: 39*1b3f573fSAndroid Build Coastguard Worker 40*1b3f573fSAndroid Build Coastguard Worker $ cd ruby && rake 41*1b3f573fSAndroid Build Coastguard Worker 42*1b3f573fSAndroid Build Coastguard WorkerThen run the tests like so: 43*1b3f573fSAndroid Build Coastguard Worker 44*1b3f573fSAndroid Build Coastguard Worker $ cd conformance && make test_ruby 45*1b3f573fSAndroid Build Coastguard Worker 46*1b3f573fSAndroid Build Coastguard WorkerRunning the tests for other languages 47*1b3f573fSAndroid Build Coastguard Worker------------------------------------- 48*1b3f573fSAndroid Build Coastguard Worker 49*1b3f573fSAndroid Build Coastguard WorkerMost of the languages in the Protobuf source tree are set up to run 50*1b3f573fSAndroid Build Coastguard Workerconformance tests. However some of them are more tricky to set up 51*1b3f573fSAndroid Build Coastguard Workerproperly. See `tests.sh` in the base of the repository to see how 52*1b3f573fSAndroid Build Coastguard WorkerKokoro runs the tests. 53*1b3f573fSAndroid Build Coastguard Worker 54*1b3f573fSAndroid Build Coastguard WorkerTesting other Protocol Buffer implementations 55*1b3f573fSAndroid Build Coastguard Worker--------------------------------------------- 56*1b3f573fSAndroid Build Coastguard Worker 57*1b3f573fSAndroid Build Coastguard WorkerTo run these tests against a new Protocol Buffers implementation, write a 58*1b3f573fSAndroid Build Coastguard Workerprogram in your language that uses the protobuf implementation you want 59*1b3f573fSAndroid Build Coastguard Workerto test. This program should implement the testing protocol defined in 60*1b3f573fSAndroid Build Coastguard Worker[conformance.proto](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance.proto). 61*1b3f573fSAndroid Build Coastguard WorkerThis is designed to be as easy as possible: the C++ version is only 62*1b3f573fSAndroid Build Coastguard Worker150 lines and is a good example for what this program should look like 63*1b3f573fSAndroid Build Coastguard Worker(see [conformance_cpp.cc](https://github.com/protocolbuffers/protobuf/blob/main/conformance/conformance_cpp.cc)). 64*1b3f573fSAndroid Build Coastguard WorkerThe program only needs to be able to read from stdin and write to stdout. 65*1b3f573fSAndroid Build Coastguard Worker 66*1b3f573fSAndroid Build Coastguard WorkerPortability 67*1b3f573fSAndroid Build Coastguard Worker----------- 68*1b3f573fSAndroid Build Coastguard Worker 69*1b3f573fSAndroid Build Coastguard WorkerNote that the test runner currently does not work on Windows. Patches 70*1b3f573fSAndroid Build Coastguard Workerto fix this are welcome! (But please get in touch first to settle on 71*1b3f573fSAndroid Build Coastguard Workera general implementation strategy). 72