diff options
author | Nobuaki Sukegawa <nsukeg@gmail.com> | 2016-03-05 13:40:25 +0900 |
---|---|---|
committer | Nobuaki Sukegawa <nsuke@apache.org> | 2016-03-06 09:45:42 +0900 |
commit | 8b791b270efb1bf3576244d91a2836bf3c33cd32 (patch) | |
tree | edef23358988016b3702b1b6707356b92bb5c971 | |
parent | 5bac5ba8bff4bf3ed1b25ccb1d084efa0648c4c3 (diff) | |
download | thrift-8b791b270efb1bf3576244d91a2836bf3c33cd32.tar.gz |
THRIFT-3711 Add D to cross language test
This closes #923
-rw-r--r-- | .gitignore | 7 | ||||
-rwxr-xr-x | Makefile.am | 2 | ||||
-rwxr-xr-x | configure.ac | 2 | ||||
-rw-r--r-- | lib/Makefile.am | 1 | ||||
-rw-r--r-- | lib/d/Makefile.am | 2 | ||||
-rwxr-xr-x | lib/d/test/Makefile.am | 4 | ||||
-rw-r--r-- | lib/d/test/thrift_test_client.d | 14 | ||||
-rw-r--r-- | lib/d/test/thrift_test_server.d | 18 | ||||
-rw-r--r-- | test/features/known_failures_Linux.json | 4 | ||||
-rw-r--r-- | test/known_failures_Linux.json | 119 | ||||
-rw-r--r-- | test/tests.json | 28 |
11 files changed, 194 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore index 15585f9f1..c31f19584 100644 --- a/.gitignore +++ b/.gitignore @@ -148,8 +148,13 @@ erl_crash.dump /lib/csharp/**/bin/ /lib/csharp/**/obj/ /lib/csharp/src/packages -/lib/d/libthriftd.a +/lib/d/libthriftd*.a +/lib/d/test/async_test +/lib/d/test/client_pool_test /lib/d/test/serialization_benchmark +/lib/d/test/stress_test_server +/lib/d/test/thrift_test_client +/lib/d/test/thrift_test_server /lib/d/test/transport_test /lib/d/unittest/ /lib/dart/coverage diff --git a/Makefile.am b/Makefile.am index 1a8473ffd..4b132ce4f 100755 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,7 @@ empty := space := $(empty) $(empty) comma := , -CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ +CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS)) if WITH_PY3 diff --git a/configure.ac b/configure.ac index 53ada3ab4..bc52adf6e 100755 --- a/configure.ac +++ b/configure.ac @@ -781,6 +781,8 @@ if test "$have_cpp" = "yes" ; then MAYBE_CPP="cpp" ; else MAYBE_CPP="" ; fi AC_SUBST([MAYBE_CPP]) if test "$have_c_glib" = "yes" ; then MAYBE_C_GLIB="c_glib" ; else MAYBE_C_GLIB="" ; fi AC_SUBST([MAYBE_C_GLIB]) +if test "$have_d" = "yes" -a "$have_deimos_event2" = "yes" -a "$have_deimos_openssl" = "yes"; then MAYBE_D="d" ; else MAYBE_D="" ; fi +AC_SUBST([MAYBE_D]) if test "$have_java" = "yes" ; then MAYBE_JAVA="java" ; else MAYBE_JAVA="" ; fi AC_SUBST([MAYBE_JAVA]) if test "$have_csharp" = "yes" ; then MAYBE_CSHARP="csharp" ; else MAYBE_CSHARP="" ; fi diff --git a/lib/Makefile.am b/lib/Makefile.am index e699b9f62..cb8d29032 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -75,6 +75,7 @@ endif if WITH_D SUBDIRS += d +PRECROSS_TARGET += precross-d endif if WITH_NODEJS diff --git a/lib/d/Makefile.am b/lib/d/Makefile.am index 30b5eb3bb..5c529bae3 100644 --- a/lib/d/Makefile.am +++ b/lib/d/Makefile.am @@ -185,6 +185,8 @@ unittest/release/%: src/%.d $(all_targets) unittest/emptymain.d TESTS = $(addprefix unittest/debug/, $(d_test_modules)) \ $(addprefix unittest/release/, $(d_test_modules)) +precross: all-local + $(MAKE) -C test precross EXTRA_DIST = \ src \ diff --git a/lib/d/test/Makefile.am b/lib/d/test/Makefile.am index edb044473..c5104719f 100755 --- a/lib/d/test/Makefile.am +++ b/lib/d/test/Makefile.am @@ -74,7 +74,7 @@ endif if WITH_D_SSL_TESTS d_test_flags += $(DMD_OPENSSL_FLAGS) ../$(D_SSL_LIB_NAME) -targets = trusted-ca-certificate.pem server-certificate.pem $(targets_) +targets = $(targets_) ran_tests = $(ran_tests_) else targets = $(filter-out $(openssl_dependent_targets), $(targets_)) @@ -125,3 +125,5 @@ thrift_test_runner.sh: thrift_test_client thrift_test_server \ trusted-ca-certificate.pem server-certificate.pem TESTS = $(ran_tests) + +precross: $(targets) diff --git a/lib/d/test/thrift_test_client.d b/lib/d/test/thrift_test_client.d index fd53328b0..49419f71a 100644 --- a/lib/d/test/thrift_test_client.d +++ b/lib/d/test/thrift_test_client.d @@ -25,6 +25,7 @@ import std.getopt; import std.stdio; import std.string; import std.traits; +import thrift.base; import thrift.codegen.client; import thrift.protocol.base; import thrift.protocol.binary; @@ -75,6 +76,7 @@ void main(string[] args) { "ssl", &ssl, "transport", &transportType, "trace", &trace, + "port", &port, "host", (string _, string value) { auto parts = split(value, ":"); if (parts.length > 1) { @@ -87,13 +89,14 @@ void main(string[] args) { } } ); + port = to!ushort(port); TSocket socket; if (ssl) { auto sslContext = new TSSLContext(); sslContext.ciphers = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"; sslContext.authenticate = true; - sslContext.loadTrustedCertificates("./trusted-ca-certificate.pem"); + sslContext.loadTrustedCertificates("../../../test/keys/CA.pem"); socket = new TSSLSocket(sslContext, host, port); } else { socket = new TSocket(host, port); @@ -280,6 +283,15 @@ void main(string[] args) { } try { + if (trace) write("client.testException(\"TException\") =>"); + client.testException("Xception"); + if (trace) writeln(" void\nFAILURE"); + throw new Exception("testException failed."); + } catch (TException e) { + if (trace) writefln(" {%s}", e.msg); + } + + try { if (trace) write("client.testException(\"success\") =>"); client.testException("success"); if (trace) writeln(" void"); diff --git a/lib/d/test/thrift_test_server.d b/lib/d/test/thrift_test_server.d index b55b7fc9e..71ab9175d 100644 --- a/lib/d/test/thrift_test_server.d +++ b/lib/d/test/thrift_test_server.d @@ -143,7 +143,17 @@ class TestHandler : ThriftTest { override Insanity[Numberz][UserId] testInsanity(ref const(Insanity) argument) { if (trace_) writeln("testInsanity()"); - return testInsanityReturn; + Insanity[Numberz][UserId] ret; + Insanity[Numberz] m1; + Insanity[Numberz] m2; + Insanity tmp; + tmp = cast(Insanity)argument; + m1[Numberz.TWO] = tmp; + m1[Numberz.THREE] = tmp; + m2[Numberz.SIX] = Insanity(); + ret[1] = m1; + ret[2] = m2; + return ret; } override Xtruct testMulti(byte arg0, int arg1, long arg2, string[short] arg3, @@ -160,6 +170,8 @@ class TestHandler : ThriftTest { e.errorCode = 1001; e.message = arg; throw e; + } else if (arg == "TException") { + throw new TException(); } else if (arg == "ApplicationException") { throw new TException(); } @@ -254,8 +266,8 @@ void main(string[] args) { if (ssl) { auto sslContext = new TSSLContext(); sslContext.serverSide = true; - sslContext.loadCertificate("./server-certificate.pem"); - sslContext.loadPrivateKey("./server-private-key.pem"); + sslContext.loadCertificate("../../../test/keys/server.crt"); + sslContext.loadPrivateKey("../../../test/keys/server.key"); sslContext.ciphers = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"; serverSocket = new TSSLServerSocket(port, sslContext); } else { diff --git a/test/features/known_failures_Linux.json b/test/features/known_failures_Linux.json index 9bf600dff..257095d40 100644 --- a/test/features/known_failures_Linux.json +++ b/test/features/known_failures_Linux.json @@ -5,6 +5,10 @@ "csharp-limit_container_length_compact_buffered-ip", "csharp-limit_string_length_binary_buffered-ip", "csharp-limit_string_length_compact_buffered-ip", + "d-limit_container_length_binary_buffered-ip", + "d-limit_container_length_compact_buffered-ip", + "d-limit_string_length_binary_buffered-ip", + "d-limit_string_length_compact_buffered-ip", "erl-limit_container_length_binary_buffered-ip", "erl-limit_container_length_compact_buffered-ip", "erl-limit_string_length_binary_buffered-ip", diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json index 7b51d1f72..bdc408468 100644 --- a/test/known_failures_Linux.json +++ b/test/known_failures_Linux.json @@ -18,6 +18,12 @@ "cpp-cpp_json_http-domain", "cpp-cpp_json_http-ip", "cpp-cpp_json_http-ip-ssl", + "cpp-d_binary_http-ip", + "cpp-d_binary_http-ip-ssl", + "cpp-d_compact_http-ip", + "cpp-d_compact_http-ip-ssl", + "cpp-d_json_http-ip", + "cpp-d_json_http-ip-ssl", "cpp-dart_binary_http-ip", "cpp-dart_compact_http-ip", "cpp-dart_json_http-ip", @@ -42,6 +48,9 @@ "csharp-cpp_compact_framed-ip-ssl", "csharp-cpp_json_buffered-ip-ssl", "csharp-cpp_json_framed-ip-ssl", + "csharp-d_binary_buffered-ip-ssl", + "csharp-d_compact_buffered-ip-ssl", + "csharp-d_json_buffered-ip-ssl", "csharp-erl_binary_buffered-ip-ssl", "csharp-erl_binary_framed-ip-ssl", "csharp-erl_compact_buffered-ip-ssl", @@ -80,6 +89,107 @@ "csharp-py_compact_framed-ip-ssl", "csharp-py_json_buffered-ip-ssl", "csharp-py_json_framed-ip-ssl", + "d-cpp_binary_buffered-ip", + "d-cpp_binary_buffered-ip-ssl", + "d-cpp_binary_framed-ip", + "d-cpp_binary_framed-ip-ssl", + "d-cpp_binary_http-ip", + "d-cpp_binary_http-ip-ssl", + "d-cpp_compact_buffered-ip", + "d-cpp_compact_buffered-ip-ssl", + "d-cpp_compact_framed-ip", + "d-cpp_compact_framed-ip-ssl", + "d-cpp_compact_http-ip", + "d-cpp_compact_http-ip-ssl", + "d-cpp_json_buffered-ip", + "d-cpp_json_buffered-ip-ssl", + "d-cpp_json_framed-ip", + "d-cpp_json_framed-ip-ssl", + "d-cpp_json_http-ip", + "d-cpp_json_http-ip-ssl", + "d-d_binary_http-ip", + "d-d_binary_http-ip-ssl", + "d-d_compact_http-ip", + "d-d_compact_http-ip-ssl", + "d-d_json_http-ip", + "d-d_json_http-ip-ssl", + "d-dart_binary_framed-ip", + "d-dart_binary_http-ip", + "d-dart_compact_http-ip", + "d-dart_json_framed-ip", + "d-dart_json_http-ip", + "d-go_binary_http-ip", + "d-go_binary_http-ip-ssl", + "d-go_compact_http-ip", + "d-go_compact_http-ip-ssl", + "d-go_json_http-ip", + "d-go_json_http-ip-ssl", + "d-hs_binary_http-ip", + "d-hs_compact_http-ip", + "d-hs_json_http-ip", + "d-java_binary_http-ip", + "d-java_binary_http-ip-ssl", + "d-java_compact_http-ip", + "d-java_compact_http-ip-ssl", + "d-java_json_http-ip", + "d-java_json_http-ip-ssl", + "d-js_json_http-ip", + "d-lua_json_buffered-ip", + "d-lua_json_framed-ip", + "d-nodejs_binary_buffered-ip", + "d-nodejs_binary_buffered-ip-ssl", + "d-nodejs_binary_framed-ip", + "d-nodejs_binary_framed-ip-ssl", + "d-nodejs_compact_buffered-ip", + "d-nodejs_compact_buffered-ip-ssl", + "d-nodejs_compact_framed-ip", + "d-nodejs_compact_framed-ip-ssl", + "d-nodejs_json_buffered-ip", + "d-nodejs_json_buffered-ip-ssl", + "d-nodejs_json_framed-ip", + "d-nodejs_json_framed-ip-ssl", + "d-perl_binary_buffered-ip-ssl", + "d-perl_binary_framed-ip-ssl", + "d-py3_binary-accel_buffered-ip", + "d-py3_binary-accel_buffered-ip-ssl", + "d-py3_binary-accel_framed-ip", + "d-py3_binary-accel_framed-ip-ssl", + "d-py3_binary_buffered-ip", + "d-py3_binary_buffered-ip-ssl", + "d-py3_binary_framed-ip", + "d-py3_binary_framed-ip-ssl", + "d-py3_compact-accelc_buffered-ip", + "d-py3_compact-accelc_buffered-ip-ssl", + "d-py3_compact-accelc_framed-ip", + "d-py3_compact-accelc_framed-ip-ssl", + "d-py3_compact_buffered-ip", + "d-py3_compact_buffered-ip-ssl", + "d-py3_compact_framed-ip", + "d-py3_compact_framed-ip-ssl", + "d-py3_json_buffered-ip", + "d-py3_json_buffered-ip-ssl", + "d-py3_json_framed-ip", + "d-py3_json_framed-ip-ssl", + "d-py_binary-accel_buffered-ip", + "d-py_binary-accel_buffered-ip-ssl", + "d-py_binary-accel_framed-ip", + "d-py_binary-accel_framed-ip-ssl", + "d-py_binary_buffered-ip", + "d-py_binary_buffered-ip-ssl", + "d-py_binary_framed-ip", + "d-py_binary_framed-ip-ssl", + "d-py_compact-accelc_buffered-ip", + "d-py_compact-accelc_buffered-ip-ssl", + "d-py_compact-accelc_framed-ip", + "d-py_compact-accelc_framed-ip-ssl", + "d-py_compact_buffered-ip", + "d-py_compact_buffered-ip-ssl", + "d-py_compact_framed-ip", + "d-py_compact_framed-ip-ssl", + "d-py_json_buffered-ip", + "d-py_json_buffered-ip-ssl", + "d-py_json_framed-ip", + "d-py_json_framed-ip-ssl", "erl-cpp_compact_buffered-ip", "erl-cpp_compact_buffered-ip-ssl", "erl-cpp_compact_framed-ip", @@ -100,6 +210,12 @@ "go-cpp_compact_http-ip-ssl", "go-cpp_json_http-ip", "go-cpp_json_http-ip-ssl", + "go-d_binary_http-ip", + "go-d_binary_http-ip-ssl", + "go-d_compact_http-ip", + "go-d_compact_http-ip-ssl", + "go-d_json_http-ip", + "go-d_json_http-ip-ssl", "go-dart_binary_framed-ip", "go-dart_binary_http-ip", "go-dart_compact_http-ip", @@ -124,6 +240,9 @@ "hs-py3_json_framed-ip", "hs-py_json_buffered-ip", "hs-py_json_framed-ip", + "java-d_compact_buffered-ip", + "java-d_compact_buffered-ip-ssl", + "java-d_compact_framed-ip", "java-perl_binary_buffered-ip-ssl", "java-perl_binary_fastframed-framed-ip-ssl", "java-perl_binary_framed-ip-ssl", diff --git a/test/tests.json b/test/tests.json index 12dcd54cb..c9f357a60 100644 --- a/test/tests.json +++ b/test/tests.json @@ -28,6 +28,34 @@ "workdir": "c_glib" }, { + "name": "d", + "server": { + "command": [ + "thrift_test_server" + ] + }, + "client": { + "command": [ + "thrift_test_client" + ] + }, + "transports": [ + "http", + "buffered", + "framed" + ], + "sockets": [ + "ip", + "ip-ssl" + ], + "protocols": [ + "binary", + "compact", + "json" + ], + "workdir": "../lib/d/test" + }, + { "name": "go", "server": { "command": [ |