| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 1 | # Apache Thrift - integration test suite |
| 2 | |
| 3 | This is the cross everything integration test suite for Apache Thrift. |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 4 | |
| 5 | ## Run |
| 6 | |
| 7 | ### A. Using Make |
| 8 | |
| 9 | The test can be executed by: |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 10 | |
| 11 | make cross |
| 12 | |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 13 | This starts the [test.py](test.py) script which does the real cross test with |
| 14 | different transports, protocols and languages. |
| 15 | |
| 16 | Note that this requires basically everything to be built, otherwise test cases |
| 17 | for missing languages will fail. If you skip building some languages, or simply |
| 18 | need more control, read following section. |
| 19 | |
| 20 | ### B. Using test script directly |
| 21 | |
| 22 | Alternatively, you can invoke [test.py](test.py) directly. You need to run`make |
| 23 | precross` once before executing it for the first time. |
| 24 | |
| 25 | For example, if you changed something in `nodejs` library and need to verify |
| 26 | the patch, you can skip everything except `nodejs` itself and some reference |
| 27 | implementation (currently `cpp` and `java` are recommended) like this: |
| 28 | |
| 29 | ./configure --without-c_glib -without-csharp --without-erlang --without-lua ... |
| 30 | make precross -j8 |
| 31 | test/test.py --server cpp,java --client nodejs |
| 32 | test/test.py --server nodejs --client cpp,java |
| 33 | |
| 34 | ## Test case definition file |
| 35 | |
| 36 | The cross test cases are defined in [tests.json](tests.json). |
| 37 | The root element is collection of test target definitions. |
| 38 | Each test target definition looks like this: |
| 39 | |
| 40 | { |
| 41 | "name": "somelib", |
| 42 | |
| 43 | "client": { |
| 44 | "command": ["somelib_client_executable"], |
| 45 | "workdir": "somelib/bin", |
| 46 | "protocols": ["binary"], |
| 47 | "transports": ["buffered"], |
| 48 | "sockets": ["ip"], |
| 49 | }, |
| 50 | "server": { |
| 51 | "command": ["somelib_server_executable"], |
| 52 | "workdir": "somelib/bin", |
| 53 | "protocols": ["binary"], |
| 54 | "transports": ["buffered"], |
| 55 | "sockets": ["ip", "ip-ssl"], |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | Either client or server definition or both should be present. |
| 60 | |
| 61 | Parameters that are common to both `client` and `server` can be put to target |
| 62 | definition root: |
| 63 | |
| 64 | { |
| 65 | "name": "somelib", |
| 66 | |
| 67 | "workdir": "somelib/bin", |
| 68 | "protocols": ["binary"], |
| 69 | "transports": ["buffered"], |
| 70 | "sockets": ["ip"], |
| 71 | |
| 72 | "client": { "command": ["somelib_client_executable"] }, |
| 73 | "server": { |
| 74 | "command": ["somelib_server_executable"], |
| 75 | "sockets": ["ip-ssl"] |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | For the complete list of supported keys and their effect, see source code |
| 80 | comment at the opt of [crossrunner/collect.py](crossrunner/collect.py). |
| 81 | |
| 82 | |
| 83 | ## List of known failures |
| 84 | |
| 85 | Since many cross tests currently fail (mainly due to partial incompatibility |
| 86 | around exception handling), the test script specifically report for "not known |
| 87 | before" failures. |
| 88 | |
| 89 | For this purpose, test cases known to (occasionally) fail are listed in |
| 90 | `known_failures_<platform>.json` where `<platform>` matches with python |
| 91 | `platform.system()` string. |
| 92 | |
| 93 | Currently, only Linux version is included. |
| 94 | |
| 95 | FYI, the file is initially generated by |
| 96 | |
| 97 | test/test.py --update-expected-failures=overwrite |
| 98 | |
| 99 | after a full test run, then repeatedly |
| 100 | |
| 101 | test/test.py --skip-known-failures |
| 102 | test/test.py --update-expected-failures=merge |
| 103 | |
| Roger Meier | bb23ead | 2015-04-11 13:12:35 +0200 | [diff] [blame^] | 104 | to update the known failures, run |
| 105 | |
| 106 | make fail |
| 107 | |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 108 | ## Test executable specification |
| 109 | |
| 110 | ### Command line parameters |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 111 | |
| Jens Geyer | 20b51b6 | 2014-12-18 22:15:49 +0100 | [diff] [blame] | 112 | Unit tests for languages are usually located under lib/<lang>/test/ |
| Konrad Grochowski | 3b5dacb | 2014-11-24 10:55:31 +0100 | [diff] [blame] | 113 | cross language tests according to [ThriftTest.thrift](ThriftTest.thrift) shall be |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 114 | provided for every language including executables with the following command |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 115 | line interface: |
| 116 | |
| 117 | **Server command line interface:** |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 118 | |
| 119 | $ ./cpp/TestServer -h |
| 120 | Allowed options: |
| 121 | -h [ --help ] produce help message |
| 122 | --port arg (=9090) Port number to listen |
| 123 | --domain-socket arg Unix Domain Socket (e.g. /tmp/ThriftTest.thrift) |
| Jens Geyer | f8a1b7a | 2014-09-24 00:26:46 +0200 | [diff] [blame] | 124 | --named-pipe arg Windows Named Pipe (e.g. MyThriftPipe) |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 125 | --server-type arg (=simple) type of server, "simple", "thread-pool", |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 126 | "threaded", or "nonblocking" |
| Jens Geyer | f8a1b7a | 2014-09-24 00:26:46 +0200 | [diff] [blame] | 127 | --transport arg (=buffered) transport: buffered, framed, http, anonpipe |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 128 | --protocol arg (=binary) protocol: binary, compact, json |
| 129 | --ssl Encrypted Transport using SSL |
| 130 | --processor-events processor-events |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 131 | -n [ --workers ] arg (=4) Number of thread pools workers. Only valid for |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 132 | thread-pool server type |
| 133 | |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 134 | **Client command line interface:** |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 135 | |
| 136 | $ ./cpp/TestClient -h |
| 137 | Allowed options: |
| 138 | -h [ --help ] produce help message |
| 139 | --host arg (=localhost) Host to connect |
| 140 | --port arg (=9090) Port number to connect |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 141 | --domain-socket arg Domain Socket (e.g. /tmp/ThriftTest.thrift), |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 142 | instead of host and port |
| Jens Geyer | f8a1b7a | 2014-09-24 00:26:46 +0200 | [diff] [blame] | 143 | --named-pipe arg Windows Named Pipe (e.g. MyThriftPipe) |
| 144 | --anon-pipes hRead hWrite Windows Anonymous Pipes pair (handles) |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 145 | --transport arg (=buffered) Transport: buffered, framed, http, evhttp |
| 146 | --protocol arg (=binary) Protocol: binary, compact, json |
| 147 | --ssl Encrypted Transport using SSL |
| 148 | -n [ --testloops ] arg (=1) Number of Tests |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 149 | -t [ --threads ] arg (=1) Number of Test threads |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 150 | |
| 151 | If you have executed the **make check** or **make cross** then you will be able to browse |
| 152 | [gen-html/ThriftTest.html](gen-html/ThriftTest.html) with the test documentation. |
| 153 | |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 154 | ### Return code |
| 155 | |
| 156 | The return code (exit code) shall be 0 on success, or an integer in the range 1 - 255 on errors. |
| 157 | In order to signal failed tests, the return code shall be composed from these bits to indicate |
| Jens Geyer | f8a1b7a | 2014-09-24 00:26:46 +0200 | [diff] [blame] | 158 | failing tests: |
| 159 | |
| 160 | #define TEST_BASETYPES 1 // 0000 0001 |
| 161 | #define TEST_STRUCTS 2 // 0000 0010 |
| 162 | #define TEST_CONTAINERS 4 // 0000 0100 |
| 163 | #define TEST_EXCEPTIONS 8 // 0000 1000 |
| 164 | #define TEST_NOTUSED 240 // 1111 0000 (reserved bits) |
| 165 | |
| 166 | Tests that have not been executed at all count as errors. |
| Jens Geyer | f8a1b7a | 2014-09-24 00:26:46 +0200 | [diff] [blame] | 167 | |
| Nobuaki Sukegawa | f5b795d | 2015-03-29 14:48:48 +0900 | [diff] [blame] | 168 | **Example:** |
| 169 | |
| 170 | During tests, the test client notices that some of the Struct tests fail. |
| 171 | Furthermore, due to some other problem none of the Exception tests is executed. |
| 172 | Therefore, the test client returns the code `10 = 2 | 8`, indicating the failure |
| 173 | of both test 2 (TEST_STRUCTS) and test 8 (TEST_EXCEPTIONS). |
| Jens Geyer | f8a1b7a | 2014-09-24 00:26:46 +0200 | [diff] [blame] | 174 | |
| Roger Meier | 4edac7f | 2014-05-02 21:07:01 +0200 | [diff] [blame] | 175 | |
| Roger Meier | f85fdd7 | 2014-03-01 17:00:46 +0100 | [diff] [blame] | 176 | ## SSL |
| 177 | Test Keys and Certificates are provided in multiple formats under the following |
| Roger Meier | 72e9c37 | 2014-05-03 00:33:46 +0200 | [diff] [blame] | 178 | directory [test/keys](keys) |