7004a61e44
Client: java THRIFT-4294: Java Configure Fails for Ant >= 1.10 THRIFT-4259: Thrift does not compile due to Ant Maven task errors THRIFT-4178: Java libraries missing from package when using cmake THRIFT-3983: libthrift is deployed on central with pom packaging instead of jar THRIFT-1507: Maven can't download resource from central when behind a proxy and won't use local repository THRIFT-1418: Compiling Thrift from source: Class org.apache.tools.ant.taskdefs.ConditionTask doesn't support the nested "typefound" element Refactor CMake install hook to allow using "sudo make install/fast" which avoids the THRIFT-1507 and THRIFT-1418 issues. New Gradle based build system for Thrift Java Library * Add Gradle 4.4.1 Wrapper artifacts to enable builds Using the Gradle Wrapper helps normalize the builds on all platforms so we use a consistent build tool independent of package managers. The Gradle build logic was partitioned into multiple specific scripts to simplify understanding and maintenance of the build. This is now hooked into CMake and Autoconf processing steps and can build/test/publish to Maven. The README.md was updated to illustrate the new build options and add some documentation on the requirements for Maven publication. Cleaned up the CMake files to reduce reliance on file globbing which is known to cause confusion when multiple users contribute. * Fix two minor issues in Javadoc and unit test Return values were undeclared in Javadoc Test was asserting on the wrong test object instance * Create simple runner scripts for cross-check Using Gradle as a java execution wrapper is too heavy. I simplified the test client/server execution by using a three generated scripts in the build directory direcly callable by the cross-check test harness. * Cleanup the remaining Ant build scripts Pulled the Maven Ant task properties out of the Java build since they are no longer used there. Deleted the no longer used build.xml and build.properties files from the Java build. Made each Ant build own the Maven Ant task details in their build.properties file. * Fix the build issue with Java SSL in the ubuntu-trusty container The latest Trusty JDK7 builds seem to have encountered this issue because the OpenJDK removed the SunEC algorithms. * Update the developer info as requested in review Use the generic Apache Thrift developer list for contact information * Add Clover Code coverage for easy access by developers Clover plugin for Gradle was applied and configured which enables code coverage reports to be available on demand via a command line option. The documentation in the README.md was enhanced to give the details of this change and how to take advantage of it. |
||
---|---|---|
.. | ||
audit | ||
c_glib | ||
cpp | ||
crossrunner | ||
csharp | ||
dart | ||
erl | ||
features | ||
go | ||
haxe | ||
hs | ||
keys | ||
lua | ||
netcore | ||
ocaml | ||
perl | ||
php | ||
py | ||
py.tornado | ||
py.twisted | ||
rb | ||
rs | ||
threads | ||
AnnotationTest.thrift | ||
BrokenConstants.thrift | ||
ConstantsDemo.thrift | ||
DebugProtoTest.thrift | ||
DenseLinkingTest.thrift | ||
DocTest.thrift | ||
EnumContainersTest.thrift | ||
EnumTest.thrift | ||
FullCamelTest.thrift | ||
Include.thrift | ||
index.html | ||
JavaBeansTest.thrift | ||
JavaDeepCopyTest.thrift | ||
JavaTypes.thrift | ||
JsDeepConstructorTest.thrift | ||
known_failures_Linux.json | ||
Makefile.am | ||
ManyOptionals.thrift | ||
ManyTypedefs.thrift | ||
NameConflictTest.thrift | ||
OptionalRequiredTest.thrift | ||
README.md | ||
rebuild_known_failures.sh | ||
Recursive.thrift | ||
result.js | ||
ReuseObjects.thrift | ||
SmallTest.thrift | ||
StressTest.thrift | ||
test.py | ||
tests.json | ||
ThriftTest.thrift | ||
TypedefTest.thrift | ||
valgrind.suppress |
Apache Thrift - integration test suite
This is the cross everything integration test suite for Apache Thrift.
Run
A. Using Make
The test can be executed by:
make cross
This starts the test.py script which does the real cross test with different transports, protocols and languages.
Note that this skips any language that is not built locally. It also skips tests that are known to be failing. If you need more control over which tests to run, read following section.
B. Using test script directly
Alternatively, you can invoke test.py directly. You need to runmake precross
once before executing it for the first time.
For example, if you changed something in nodejs
library and need to verify
the patch, you can skip everything except nodejs
itself and some reference
implementation (currently cpp
and java
are recommended) like this:
./configure --without-c_glib -without-csharp --without-erlang --without-lua ...
make precross -j8
test/test.py --server cpp,java --client nodejs
test/test.py --server nodejs --client cpp,java
Another useful flag is --regex. For example, to run all tests that involve Java TBinaryProtocol:
test/test.py --regex "java.*binary"
Test case definition file
The cross test cases are defined in tests.json. The root element is collection of test target definitions. Each test target definition looks like this:
{
"name": "somelib",
"client": {
"command": ["somelib_client_executable"],
"workdir": "somelib/bin",
"protocols": ["binary"],
"transports": ["buffered"],
"sockets": ["ip"],
},
"server": {
"command": ["somelib_server_executable"],
"workdir": "somelib/bin",
"protocols": ["binary"],
"transports": ["buffered"],
"sockets": ["ip", "ip-ssl"],
}
}
Either client or server definition or both should be present.
Parameters that are common to both client
and server
can be put to target
definition root:
{
"name": "somelib",
"workdir": "somelib/bin",
"protocols": ["binary"],
"transports": ["buffered"],
"sockets": ["ip"],
"client": { "command": ["somelib_client_executable"] },
"server": {
"command": ["somelib_server_executable"],
"sockets": ["ip-ssl"]
}
}
For the complete list of supported keys and their effect, see source code comment at the opt of crossrunner/collect.py.
List of known failures
Since many cross tests currently fail (mainly due to partial incompatibility around exception handling), the test script specifically report for "not known before" failures.
For this purpose, test cases known to (occasionally) fail are listed in
known_failures_<platform>.json
where <platform>
matches with python
platform.system()
string.
Currently, only Linux version is included.
FYI, the file is initially generated by
test/test.py --update-expected-failures=overwrite
after a full test run, then repeatedly
test/test.py --skip-known-failures
test/test.py --update-expected-failures=merge
to update the known failures, run
make fail
Test executable specification
Command line parameters
Unit tests for languages are usually located under lib//test/ cross language tests according to ThriftTest.thrift shall be provided for every language including executables with the following command line interface:
Server command line interface:
$ ./cpp/TestServer -h
Allowed options:
-h [ --help ] produce help message
--port arg (=9090) Port number to listen
--domain-socket arg Unix Domain Socket (e.g. /tmp/ThriftTest.thrift)
--named-pipe arg Windows Named Pipe (e.g. MyThriftPipe)
--server-type arg (=simple) type of server, "simple", "thread-pool",
"threaded", or "nonblocking"
--transport arg (=buffered) transport: buffered, framed, http, anonpipe
--protocol arg (=binary) protocol: binary, compact, json
--ssl Encrypted Transport using SSL
--processor-events processor-events
-n [ --workers ] arg (=4) Number of thread pools workers. Only valid for
thread-pool server type
Client command line interface:
$ ./cpp/TestClient -h
Allowed options:
-h [ --help ] produce help message
--host arg (=localhost) Host to connect
--port arg (=9090) Port number to connect
--domain-socket arg Domain Socket (e.g. /tmp/ThriftTest.thrift),
instead of host and port
--named-pipe arg Windows Named Pipe (e.g. MyThriftPipe)
--anon-pipes hRead hWrite Windows Anonymous Pipes pair (handles)
--transport arg (=buffered) Transport: buffered, framed, http, evhttp
--protocol arg (=binary) Protocol: binary, compact, json
--ssl Encrypted Transport using SSL
-n [ --testloops ] arg (=1) Number of Tests
-t [ --threads ] arg (=1) Number of Test threads
If you have executed the make check or make cross then you will be able to browse gen-html/ThriftTest.html with the test documentation.
Return code
The return code (exit code) shall be 0 on success, or an integer in the range 1 - 255 on errors. In order to signal failed tests, the return code shall be composed from these bits to indicate failing tests:
#define TEST_BASETYPES 1 // 0000 0001
#define TEST_STRUCTS 2 // 0000 0010
#define TEST_CONTAINERS 4 // 0000 0100
#define TEST_EXCEPTIONS 8 // 0000 1000
#define TEST_UNKNOWN 64 // 0100 0000 (Failed to prepare environemt etc.)
#define TEST_TIMEOUT 128 // 1000 0000
#define TEST_NOTUSED 48 // 0011 0000 (reserved bits)
Tests that have not been executed at all count as errors.
Example:
During tests, the test client notices that some of the Struct tests fail.
Furthermore, due to some other problem none of the Exception tests is executed.
Therefore, the test client returns the code 10 = 2 | 8
, indicating the failure
of both test 2 (TEST_STRUCTS) and test 8 (TEST_EXCEPTIONS).
SSL
Test Keys and Certificates are provided in multiple formats under the following directory test/keys