blob: 91e4c26ae24bf7f0aa0fb01e40e2f30dfe645b8a [file] [log] [blame] [view]
Roger Meierf85fdd72014-03-01 17:00:46 +01001# Apache Thrift - integration test suite
2
3This is the cross everything integration test suite for Apache Thrift.
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +09004
5## Run
6
7### A. Using Make
8
9The test can be executed by:
Roger Meierf85fdd72014-03-01 17:00:46 +010010
11 make cross
12
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +090013This starts the [test.py](test.py) script which does the real cross test with
14different transports, protocols and languages.
15
16Note that this requires basically everything to be built, otherwise test cases
17for missing languages will fail. If you skip building some languages, or simply
18need more control, read following section.
19
20### B. Using test script directly
21
22Alternatively, you can invoke [test.py](test.py) directly. You need to run`make
23precross` once before executing it for the first time.
24
25For example, if you changed something in `nodejs` library and need to verify
26the patch, you can skip everything except `nodejs` itself and some reference
27implementation (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
36The cross test cases are defined in [tests.json](tests.json).
37The root element is collection of test target definitions.
38Each 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
59Either client or server definition or both should be present.
60
61Parameters that are common to both `client` and `server` can be put to target
62definition 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
79For the complete list of supported keys and their effect, see source code
80comment at the opt of [crossrunner/collect.py](crossrunner/collect.py).
81
82
83## List of known failures
84
85Since many cross tests currently fail (mainly due to partial incompatibility
86around exception handling), the test script specifically report for "not known
87before" failures.
88
89For 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
93Currently, only Linux version is included.
94
95FYI, the file is initially generated by
96
97 test/test.py --update-expected-failures=overwrite
98
99after a full test run, then repeatedly
100
101 test/test.py --skip-known-failures
102 test/test.py --update-expected-failures=merge
103
Roger Meierbb23ead2015-04-11 13:12:35 +0200104to update the known failures, run
105
106 make fail
107
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +0900108## Test executable specification
109
110### Command line parameters
Roger Meierf85fdd72014-03-01 17:00:46 +0100111
Jens Geyer20b51b62014-12-18 22:15:49 +0100112Unit tests for languages are usually located under lib/<lang>/test/
Konrad Grochowski3b5dacb2014-11-24 10:55:31 +0100113cross language tests according to [ThriftTest.thrift](ThriftTest.thrift) shall be
Roger Meierf85fdd72014-03-01 17:00:46 +0100114provided for every language including executables with the following command
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +0900115line interface:
116
117**Server command line interface:**
Roger Meierf85fdd72014-03-01 17:00:46 +0100118
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 Geyerf8a1b7a2014-09-24 00:26:46 +0200124 --named-pipe arg Windows Named Pipe (e.g. MyThriftPipe)
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +0900125 --server-type arg (=simple) type of server, "simple", "thread-pool",
Roger Meierf85fdd72014-03-01 17:00:46 +0100126 "threaded", or "nonblocking"
Jens Geyerf8a1b7a2014-09-24 00:26:46 +0200127 --transport arg (=buffered) transport: buffered, framed, http, anonpipe
Roger Meierf85fdd72014-03-01 17:00:46 +0100128 --protocol arg (=binary) protocol: binary, compact, json
129 --ssl Encrypted Transport using SSL
130 --processor-events processor-events
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +0900131 -n [ --workers ] arg (=4) Number of thread pools workers. Only valid for
Roger Meierf85fdd72014-03-01 17:00:46 +0100132 thread-pool server type
133
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +0900134**Client command line interface:**
Roger Meierf85fdd72014-03-01 17:00:46 +0100135
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 Sukegawaf5b795d2015-03-29 14:48:48 +0900141 --domain-socket arg Domain Socket (e.g. /tmp/ThriftTest.thrift),
Roger Meierf85fdd72014-03-01 17:00:46 +0100142 instead of host and port
Jens Geyerf8a1b7a2014-09-24 00:26:46 +0200143 --named-pipe arg Windows Named Pipe (e.g. MyThriftPipe)
144 --anon-pipes hRead hWrite Windows Anonymous Pipes pair (handles)
Roger Meierf85fdd72014-03-01 17:00:46 +0100145 --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 Sukegawaf5b795d2015-03-29 14:48:48 +0900149 -t [ --threads ] arg (=1) Number of Test threads
Roger Meierf85fdd72014-03-01 17:00:46 +0100150
151If 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 Sukegawaf5b795d2015-03-29 14:48:48 +0900154### Return code
155
156The return code (exit code) shall be 0 on success, or an integer in the range 1 - 255 on errors.
157In order to signal failed tests, the return code shall be composed from these bits to indicate
Jens Geyerf8a1b7a2014-09-24 00:26:46 +0200158failing 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
166Tests that have not been executed at all count as errors.
Jens Geyerf8a1b7a2014-09-24 00:26:46 +0200167
Nobuaki Sukegawaf5b795d2015-03-29 14:48:48 +0900168**Example:**
169
170During tests, the test client notices that some of the Struct tests fail.
171Furthermore, due to some other problem none of the Exception tests is executed.
172Therefore, the test client returns the code `10 = 2 | 8`, indicating the failure
173of both test 2 (TEST_STRUCTS) and test 8 (TEST_EXCEPTIONS).
Jens Geyerf8a1b7a2014-09-24 00:26:46 +0200174
Roger Meier4edac7f2014-05-02 21:07:01 +0200175
Roger Meierf85fdd72014-03-01 17:00:46 +0100176## SSL
177Test Keys and Certificates are provided in multiple formats under the following
Roger Meier72e9c372014-05-03 00:33:46 +0200178directory [test/keys](keys)