1# Protobuf Java Compatibility Tests 2 3This directory contains tests to ensure protobuf library is compatible with 4previously released versions. 5 6## Directory Layout 7 8For each released protobuf version we are testing compatibility with, there 9is a sub-directory with the following layout (take v2.5.0 as an example): 10 11 * v2.5.0 12 * test.sh 13 * pom.xml 14 * protos/ - unittest protos. 15 * more_protos/ - unittest protos that import the ones in "protos". 16 * tests/ - actual Java test classes. 17 18The testing code is extracted from regular protobuf unittests by removing: 19 20 * tests that access package private methods/classes. 21 * tests that are known to be broken by an intended behavior change (e.g., we 22 changed the parsing recursion limit from 64 to 100). 23 * all lite runtime tests. 24 25It's also divided into 3 submodule with tests depending on more_protos and 26more_protos depending on protos. This way we can test scenarios where only part 27of the dependency is upgraded to the new version. 28 29## How to Run The Tests 30 31We use a shell script to drive the test of different scenarios so the test 32will only run on unix-like environments. The script expects a few command 33line tools to be available on PATH: git, mvn, wget, grep, sed, java. 34 35Before running the tests, make sure you have already built the protoc binary 36following [the C++ installation instructions](../../src/README.md). The test 37scripts will use the built binary located at ${protobuf}/src/protoc. 38 39To start a test, simply run the test.sh script in each version directory. For 40example: 41 42 $ v2.5.0/test.sh 43 44For each version, the test script will test: 45 46 * only upgrading protos to the new version 47 * only upgrading more_protos to the new version 48 49and see whether everything builds/runs fine. Both source compatibility and 50binary compatibility will be tested. 51