gorealis v2 refactor (#5)
* Changing default timeout for start maintenance. * Upgrading dependencies to gorealis v2 and thrift 0.12.0 * Refactored to update to gorealis v2.
This commit is contained in:
parent
ad4dd9606e
commit
6ab5c9334d
1335 changed files with 137431 additions and 61530 deletions
19
vendor/git.apache.org/thrift.git/test/php/Makefile.am
generated
vendored
19
vendor/git.apache.org/thrift.git/test/php/Makefile.am
generated
vendored
|
@ -17,20 +17,23 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
THRIFT = $(top_builddir)/compiler/cpp/thrift
|
||||
|
||||
stubs: ../ThriftTest.thrift
|
||||
$(THRIFT) --gen php ../ThriftTest.thrift
|
||||
$(THRIFT) --gen php:inlined ../ThriftTest.thrift
|
||||
$(MKDIR_P) gen-php-psr4
|
||||
$(THRIFT) -out gen-php-psr4 --gen php:psr4 ../ThriftTest.thrift
|
||||
$(MKDIR_P) gen-php-classmap
|
||||
$(THRIFT) -out gen-php-classmap --gen php ../ThriftTest.thrift
|
||||
|
||||
precross: stubs
|
||||
php_ext_dir:
|
||||
mkdir -p php_ext_dir
|
||||
ln -s ../../../lib/php/src/ext/thrift_protocol/modules/thrift_protocol.so php_ext_dir/
|
||||
ln -s "$$(php-config --extension-dir)/sockets.so" php_ext_dir/
|
||||
|
||||
check: stubs
|
||||
precross: stubs php_ext_dir
|
||||
|
||||
check: stubs php_ext_dir
|
||||
|
||||
clean-local:
|
||||
$(RM) -r gen-php gen-phpi gen-php-psr4
|
||||
$(RM) -r gen-php gen-phpi gen-php-classmap php_ext_dir
|
||||
|
||||
client: stubs
|
||||
client: stubs php_ext_dir
|
||||
php TestClient.php
|
||||
|
|
|
@ -18,6 +18,6 @@
|
|||
*/
|
||||
|
||||
<?php
|
||||
$GEN_DIR = 'gen-php-psr4';
|
||||
$GEN_DIR = 'gen-php-classmap';
|
||||
include_once('TestClient.php');
|
||||
?>
|
79
vendor/git.apache.org/thrift.git/test/php/TestClient.php
generated
vendored
79
vendor/git.apache.org/thrift.git/test/php/TestClient.php
generated
vendored
|
@ -2,7 +2,8 @@
|
|||
|
||||
namespace test\php;
|
||||
|
||||
require_once __DIR__.'/../../lib/php/lib/Thrift/ClassLoader/ThriftClassLoader.php';
|
||||
/** @var \Composer\Autoload\ClassLoader $loader */
|
||||
$loader = require __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
use Thrift\ClassLoader\ThriftClassLoader;
|
||||
|
||||
|
@ -13,14 +14,14 @@ if (!isset($MODE)) {
|
|||
$MODE = 'normal';
|
||||
}
|
||||
|
||||
$loader = new ThriftClassLoader();
|
||||
$loader->registerNamespace('Thrift', __DIR__ . '/../../lib/php/lib');
|
||||
if ($GEN_DIR === 'gen-php-psr4') {
|
||||
$loader->registerNamespace('ThriftTest', $GEN_DIR);
|
||||
|
||||
if ($GEN_DIR == 'gen-php') {
|
||||
$loader->addPsr4('', $GEN_DIR);
|
||||
} else {
|
||||
$loader = new ThriftClassLoader();
|
||||
$loader->registerDefinition('ThriftTest', $GEN_DIR);
|
||||
$loader->register();
|
||||
}
|
||||
$loader->register();
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -94,7 +95,7 @@ foreach ($argv as $arg) {
|
|||
$MODE = substr($arg, 12);
|
||||
} else if (substr($arg, 0, 11) == '--protocol=') {
|
||||
$PROTO = substr($arg, 11);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$hosts = array('localhost');
|
||||
|
@ -266,6 +267,39 @@ if ($mapin != $mapout) {
|
|||
$exitcode |= ERR_CONTAINERS;
|
||||
}
|
||||
|
||||
$mapout = array();
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
$mapout["key$i"] = "val$i";
|
||||
}
|
||||
print_r('testStringMap({');
|
||||
$first = true;
|
||||
foreach ($mapout as $key => $val) {
|
||||
if ($first) {
|
||||
$first = false;
|
||||
} else {
|
||||
print_r(", ");
|
||||
}
|
||||
print_r("\"$key\" => \"$val\"");
|
||||
}
|
||||
print_r("})");
|
||||
$mapin = $testClient->testStringMap($mapout);
|
||||
print_r(" = {");
|
||||
$first = true;
|
||||
foreach ($mapin as $key => $val) {
|
||||
if ($first) {
|
||||
$first = false;
|
||||
} else {
|
||||
print_r(", ");
|
||||
}
|
||||
print_r("\"$key\" => \"$val\"");
|
||||
}
|
||||
print_r("}\n");
|
||||
ksort($mapin);
|
||||
if ($mapin != $mapout) {
|
||||
echo "**FAILED**\n";
|
||||
$exitcode |= ERR_CONTAINERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* SET TEST
|
||||
*/
|
||||
|
@ -459,6 +493,24 @@ try {
|
|||
print_r(' caught xception '.$x->errorCode.': '.$x->message."\n");
|
||||
}
|
||||
|
||||
// Regression test for THRIFT-4263
|
||||
print_r("testBinarySerializer_Deserialize('foo')");
|
||||
try {
|
||||
\Thrift\Serializer\TBinarySerializer::deserialize(base64_decode('foo'), \ThriftTest\Xtruct2::class);
|
||||
echo "**FAILED**\n";
|
||||
$exitcode |= ERR_STRUCTS;
|
||||
} catch (\Thrift\Exception\TTransportException $happy_exception) {
|
||||
// We expected this due to binary data of base64_decode('foo') is less then 4
|
||||
// bytes and it tries to find thrift version number in the transport by
|
||||
// reading i32() at the beginning. Casting to string validates that
|
||||
// exception is still accessible in memory and not corrupted. Without patch,
|
||||
// PHP will error log that the exception doesn't have any tostring method,
|
||||
// which is a lie due to corrupted memory.
|
||||
for($i=99; $i > 0; $i--) {
|
||||
(string)$happy_exception;
|
||||
}
|
||||
print_r(" SUCCESS\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Normal tests done.
|
||||
|
@ -472,6 +524,19 @@ print_r("Total time: $elp ms\n");
|
|||
* Extraneous "I don't trust PHP to pack/unpack integer" tests
|
||||
*/
|
||||
|
||||
if ($protocol instanceof TBinaryProtocolAccelerated) {
|
||||
// Regression check: check that method name is not double-freed
|
||||
// Method name should not be an interned string.
|
||||
$method_name = "Void";
|
||||
$method_name = "test$method_name";
|
||||
|
||||
$seqid = 0;
|
||||
$args = new \ThriftTest\ThriftTest_testVoid_args();
|
||||
thrift_protocol_write_binary($protocol, $method_name, \Thrift\Type\TMessageType::CALL, $args, $seqid, $protocol->isStrictWrite());
|
||||
$testClient->recv_testVoid();
|
||||
|
||||
}
|
||||
|
||||
// Max I32
|
||||
$num = pow(2, 30) + (pow(2, 30) - 1);
|
||||
roundtrip($testClient, 'testI32', $num);
|
||||
|
|
2
vendor/git.apache.org/thrift.git/test/php/test_php.ini
generated
vendored
Normal file
2
vendor/git.apache.org/thrift.git/test/php/test_php.ini
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
extension=thrift_protocol.so
|
||||
extension=sockets.so
|
Loading…
Add table
Add a link
Reference in a new issue