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/08/20 09:42:32 UTC

[1/4] thrift git commit: THRIFT-3883 Go TestAllConnection fails with port 9090 collision

Repository: thrift
Updated Branches:
  refs/heads/master 2007783e8 -> e4ba16495


THRIFT-3883 Go TestAllConnection fails with port 9090 collision

This closes #1066


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

Branch: refs/heads/master
Commit: fd02a30e5874c9b3d4e79f0d32289e74351b3e67
Parents: 2007783
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Tue Aug 16 14:06:48 2016 +0900
Committer: Nobuaki Sukegawa <ns...@gmail.com>
Committed: Sat Aug 20 18:34:57 2016 +0900

----------------------------------------------------------------------
 test/go/src/common/clientserver_test.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/fd02a30e/test/go/src/common/clientserver_test.go
----------------------------------------------------------------------
diff --git a/test/go/src/common/clientserver_test.go b/test/go/src/common/clientserver_test.go
index 2a9d5e9..549e8d1 100644
--- a/test/go/src/common/clientserver_test.go
+++ b/test/go/src/common/clientserver_test.go
@@ -39,7 +39,7 @@ type test_unit struct {
 }
 
 var units = []test_unit{
-	{"127.0.0.1", 9090, "", "", "binary", false},
+	{"127.0.0.1", 9095, "", "", "binary", false},
 	{"127.0.0.1", 9091, "", "", "compact", false},
 	{"127.0.0.1", 9092, "", "", "binary", true},
 	{"127.0.0.1", 9093, "", "", "compact", true},


[4/4] thrift git commit: THRIFT-3886 PHP cross test client returns 0 even when failing

Posted by ns...@apache.org.
THRIFT-3886 PHP cross test client returns 0 even when failing

This only fixes tests for primitive values.

This closes #1054


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

Branch: refs/heads/master
Commit: e4ba16495e8d8177eb85d6bfcc69089b38753e39
Parents: 527637a
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Fri Jul 22 18:09:32 2016 +0900
Committer: Nobuaki Sukegawa <ns...@gmail.com>
Committed: Sat Aug 20 18:40:45 2016 +0900

----------------------------------------------------------------------
 test/php/TestClient.php | 62 ++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/e4ba1649/test/php/TestClient.php
----------------------------------------------------------------------
diff --git a/test/php/TestClient.php b/test/php/TestClient.php
index ce57dc0..946334d 100755
--- a/test/php/TestClient.php
+++ b/test/php/TestClient.php
@@ -110,6 +110,12 @@ $transport->open();
 
 $start = microtime(true);
 
+define(ERR_BASETYPES, 1);
+// ERR_STRUCTS = 2;
+// ERR_CONTAINERS = 4;
+// ERR_EXCEPTIONS = 8;
+// ERR_UNKNOWN = 64;
+$exitcode = 0;
 /**
  * VOID TEST
  */
@@ -117,40 +123,41 @@ print_r("testVoid()");
 $testClient->testVoid();
 print_r(" = void\n");
 
+function roundtrip($testClient, $method, $value) {
+  global $exitcode;
+  print_r("$method($value)");
+  $ret = $testClient->$method($value);
+  print_r(" = \"$ret\"\n");
+  if ($value != $ret) {
+    print_r("*** FAILED ***\n");
+    $exitcode |= ERR_BASETYPES;
+  }
+}
+
 /**
  * STRING TEST
  */
-print_r("testString(\"Test\")");
-$s = $testClient->testString("Test");
-print_r(" = \"$s\"\n");
+roundtrip($testClient, 'testString', "Test");
 
 /**
  * BYTE TEST
  */
-print_r("testByte(1)");
-$u8 = $testClient->testByte(1);
-print_r(" = $u8\n");
+roundtrip($testClient, 'testByte', 1);
 
 /**
  * I32 TEST
  */
-print_r("testI32(-1)");
-$i32 = $testClient->testI32(-1);
-print_r(" = $i32\n");
+roundtrip($testClient, 'testI32', -1);
 
 /**
  * I64 TEST
  */
-print_r("testI64(-34359738368)");
-$i64 = $testClient->testI64(-34359738368);
-print_r(" = $i64\n");
+roundtrip($testClient, 'testI64', -34359738368);
 
 /**
  * DOUBLE TEST
  */
-print_r("testDouble(-852.234234234)");
-$dub = $testClient->testDouble(-852.234234234);
-print_r(" = $dub\n");
+roundtrip($testClient, 'testDouble', -852.234234234);
 
 /**
  * BINARY TEST  --  TODO
@@ -396,32 +403,19 @@ print_r("Total time: $elp ms\n");
 
 // Max I32
 $num = pow(2, 30) + (pow(2, 30) - 1);
-$num2 = $testClient->testI32($num);
-if ($num != $num2) {
-  print "Missed $num = $num2\n";
-}
+roundtrip($testClient, testI32, $num);
 
 // Min I32
 $num = 0 - pow(2, 31);
-$num2 = $testClient->testI32($num);
-if ($num != $num2) {
-  print "Missed $num = $num2\n";
-}
+roundtrip($testClient, testI32, $num);
 
 // Max I64
 $num = pow(2, 62) + (pow(2, 62) - 1);
-$num2 = $testClient->testI64($num);
-if ($num != $num2) {
-  print "Missed $num = $num2\n";
-}
+roundtrip($testClient, testI64, $num);
 
 // Min I64
-$num = 0 - pow(2, 63);
-$num2 = $testClient->testI64($num);
-if ($num != $num2) {
-  print "Missed $num = $num2\n";
-}
+$num = 0 - pow(2, 62) - pow(2, 62);
+roundtrip($testClient, testI64, $num);
 
 $transport->close();
-return;
-
+exit($exitcode);


[2/4] thrift git commit: THRIFT-3827 Fix CompactProtocol readI64 function

Posted by ns...@apache.org.
THRIFT-3827 Fix CompactProtocol readI64 function

This closes #1008 and closes #1052


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

Branch: refs/heads/master
Commit: 77e5f3a3a37e8819f3a5154d4724ecd102fab587
Parents: fd02a30
Author: lnn1123 <ln...@gmail.com>
Authored: Tue May 10 18:44:20 2016 +0800
Committer: Nobuaki Sukegawa <ns...@gmail.com>
Committed: Sat Aug 20 18:37:53 2016 +0900

----------------------------------------------------------------------
 lib/php/lib/Thrift/Protocol/TCompactProtocol.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/77e5f3a3/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
index 2870351..124f6ec 100644
--- a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
@@ -615,7 +615,7 @@ class TCompactProtocol extends TProtocol
       if ($shift >= 32) {
         $hi |= (($byte & 0x7f) << ($shift - 32));
       } elseif ($shift > 25) {
-        $hi |= (($byte & 0x7f) >> ($shift - 25));
+        $hi |= (($byte & 0x7f) >> ($shift - 24));
       }
       if (($byte >> 7) === 0) {
         break;
@@ -635,7 +635,7 @@ class TCompactProtocol extends TProtocol
 
     // Now put $hi and $lo back together
     if (true) {
-      $isNeg = $hi  < 0;
+      $isNeg = $hi  < 0 || $hi & 0x80000000;
 
       // Check for a negative
       if ($isNeg) {


[3/4] thrift git commit: THRIFT-3827 Fix CompactProtocol readI64 function

Posted by ns...@apache.org.
THRIFT-3827 Fix CompactProtocol readI64 function

cleanup (#1054)


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

Branch: refs/heads/master
Commit: 527637ac3c75df0a87253ddbf41edc3a27ddd802
Parents: 77e5f3a
Author: Nobuaki Sukegawa <ns...@apache.org>
Authored: Sun Jul 24 15:28:46 2016 +0900
Committer: Nobuaki Sukegawa <ns...@gmail.com>
Committed: Sat Aug 20 18:40:41 2016 +0900

----------------------------------------------------------------------
 .../lib/Thrift/Protocol/TCompactProtocol.php    | 79 ++++++++------------
 1 file changed, 30 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/527637ac/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
----------------------------------------------------------------------
diff --git a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
index 124f6ec..7b966aa 100644
--- a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
+++ b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php
@@ -607,15 +607,14 @@ class TCompactProtocol extends TProtocol
       $arr = unpack('C', $x);
       $byte = $arr[1];
       $idx += 1;
-      if ($shift < 32) {
-        $lo |= (($byte & 0x7f) << $shift) &
-          0x00000000ffffffff;
-      }
       // Shift hi and lo together.
-      if ($shift >= 32) {
+      if ($shift < 28) {
+        $lo |= (($byte & 0x7f) << $shift);
+      } elseif ($shift == 28) {
+        $lo |= (($byte & 0x0f) << 28);
+        $hi |= (($byte & 0x70) >> 4);
+      } else {
         $hi |= (($byte & 0x7f) << ($shift - 32));
-      } elseif ($shift > 25) {
-        $hi |= (($byte & 0x7f) >> ($shift - 24));
       }
       if (($byte >> 7) === 0) {
         break;
@@ -634,56 +633,38 @@ class TCompactProtocol extends TProtocol
     $lo = $lo ^ $xorer;
 
     // Now put $hi and $lo back together
-    if (true) {
-      $isNeg = $hi  < 0 || $hi & 0x80000000;
-
-      // Check for a negative
-      if ($isNeg) {
-        $hi = ~$hi & (int) 0xffffffff;
-        $lo = ~$lo & (int) 0xffffffff;
-
-        if ($lo == (int) 0xffffffff) {
-          $hi++;
-          $lo = 0;
-        } else {
-          $lo++;
-        }
-      }
+    $isNeg = $hi < 0 || $hi & 0x80000000;
 
-      // Force 32bit words in excess of 2G to be positive - we deal with sign
-      // explicitly below
+    // Check for a negative
+    if ($isNeg) {
+      $hi = ~$hi & (int) 0xffffffff;
+      $lo = ~$lo & (int) 0xffffffff;
 
-      if ($hi & (int) 0x80000000) {
-        $hi &= (int) 0x7fffffff;
-        $hi += 0x80000000;
+      if ($lo == (int) 0xffffffff) {
+        $hi++;
+        $lo = 0;
+      } else {
+        $lo++;
       }
+    }
 
-      if ($lo & (int) 0x80000000) {
-        $lo &= (int) 0x7fffffff;
-        $lo += 0x80000000;
-      }
+    // Force 32bit words in excess of 2G to be positive - we deal with sign
+    // explicitly below
 
-      $value = $hi * 4294967296 + $lo;
+    if ($hi & (int) 0x80000000) {
+      $hi &= (int) 0x7fffffff;
+      $hi += 0x80000000;
+    }
 
-      if ($isNeg) {
-        $value = 0 - $value;
-      }
-    } else {
+    if ($lo & (int) 0x80000000) {
+      $lo &= (int) 0x7fffffff;
+      $lo += 0x80000000;
+    }
 
-      // Upcast negatives in LSB bit
-      if ($arr[2] & 0x80000000) {
-        $arr[2] = $arr[2] & 0xffffffff;
-      }
+    $value = $hi * 4294967296 + $lo;
 
-      // Check for a negative
-      if ($arr[1] & 0x80000000) {
-        $arr[1] = $arr[1] & 0xffffffff;
-        $arr[1] = $arr[1] ^ 0xffffffff;
-        $arr[2] = $arr[2] ^ 0xffffffff;
-        $value = 0 - $arr[1] * 4294967296 - $arr[2] - 1;
-      } else {
-        $value = $arr[1] * 4294967296 + $arr[2];
-      }
+    if ($isNeg) {
+      $value = 0 - $value;
     }
 
     return $idx;