You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/03/06 03:25:26 UTC

[2/5] thrift git commit: THRIFT-3711 Add D to cross language test

THRIFT-3711 Add D to cross language test

This closes #923


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8b791b27
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8b791b27
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8b791b27

Branch: refs/heads/master
Commit: 8b791b270efb1bf3576244d91a2836bf3c33cd32
Parents: 5bac5ba
Author: Nobuaki Sukegawa <ns...@gmail.com>
Authored: Sat Mar 5 13:40:25 2016 +0900
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Sun Mar 6 09:45:42 2016 +0900

----------------------------------------------------------------------
 .gitignore                              |   7 +-
 Makefile.am                             |   2 +-
 configure.ac                            |   2 +
 lib/Makefile.am                         |   1 +
 lib/d/Makefile.am                       |   2 +
 lib/d/test/Makefile.am                  |   4 +-
 lib/d/test/thrift_test_client.d         |  14 +++-
 lib/d/test/thrift_test_server.d         |  18 +++-
 test/features/known_failures_Linux.json |   4 +
 test/known_failures_Linux.json          | 119 +++++++++++++++++++++++++++
 test/tests.json                         |  28 +++++++
 11 files changed, 194 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 15585f9..c31f195 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/Makefile.am
----------------------------------------------------------------------
diff --git a/Makefile.am b/Makefile.am
index 1a8473f..4b132ce 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 53ada3a..bc52adf 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/lib/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/Makefile.am b/lib/Makefile.am
index e699b9f..cb8d290 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

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/lib/d/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/d/Makefile.am b/lib/d/Makefile.am
index 30b5eb3..5c529ba 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 \

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/lib/d/test/Makefile.am
----------------------------------------------------------------------
diff --git a/lib/d/test/Makefile.am b/lib/d/test/Makefile.am
index edb0444..c510471 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)

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/lib/d/test/thrift_test_client.d
----------------------------------------------------------------------
diff --git a/lib/d/test/thrift_test_client.d b/lib/d/test/thrift_test_client.d
index fd53328..49419f7 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");

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/lib/d/test/thrift_test_server.d
----------------------------------------------------------------------
diff --git a/lib/d/test/thrift_test_server.d b/lib/d/test/thrift_test_server.d
index b55b7fc..71ab917 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 {

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/test/features/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/features/known_failures_Linux.json b/test/features/known_failures_Linux.json
index 9bf600d..257095d 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",

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/test/known_failures_Linux.json
----------------------------------------------------------------------
diff --git a/test/known_failures_Linux.json b/test/known_failures_Linux.json
index 7b51d1f..bdc4084 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",

http://git-wip-us.apache.org/repos/asf/thrift/blob/8b791b27/test/tests.json
----------------------------------------------------------------------
diff --git a/test/tests.json b/test/tests.json
index 12dcd54..c9f357a 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": [