mirror of
https://github.com/apache/thrift.git
synced 2026-10-28 08:24:58 +08:00
THRIFT-4405: fix cygwin on appveyor
This commit is contained in:
1 parent
53bd0e6295
commit
3ec4031a4c
10 files changed
+32
-22
No files matched your search
@@ -0,0 +1,5 @@
|
||||
[flake8]
|
||||
exclude = .git,__pycache__,**/gen-*/**,contrib/**,docs/source/conf.py,old,build,dist
|
||||
ignore = W504,E402,E501
|
||||
max-complexity = 30
|
||||
max-line-length = 120
|
||||
@@ -25,6 +25,12 @@ CALL cl_banner_install.bat || EXIT /B
|
||||
CALL cl_setenv.bat || EXIT /B
|
||||
CALL cl_showenv.bat || EXIT /B
|
||||
|
||||
::
|
||||
:: Upgrades cygwin to the latest, if you want...
|
||||
::
|
||||
:: appveyor DownloadFile "https://cygwin.com/setup-x86_64.exe"
|
||||
:: setup-x86_64.exe --quiet-mode --wait --upgrade-also --packages="gcc-g++"
|
||||
|
||||
::
|
||||
:: Install apt-cyg for package management
|
||||
::
|
||||
|
||||
@@ -39,15 +39,7 @@ cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/c
|
||||
cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
|
||||
|
||||
# Python code style
|
||||
flake8 --ignore=W504,E501 lib/py
|
||||
flake8 --exclude=tutorial/py/build tutorial/py
|
||||
# THRIFT-4371 : generated files are excluded because they haven't been scrubbed yet
|
||||
flake8 --ignore=E501 --exclude="*/gen-py*/*",test/py/build test/py
|
||||
flake8 test/py.twisted
|
||||
flake8 test/py.tornado
|
||||
flake8 --ignore=E501 test/test.py
|
||||
flake8 --ignore=E501,E722 test/crossrunner
|
||||
flake8 test/features
|
||||
flake8
|
||||
|
||||
# PHP code style
|
||||
composer install --quiet
|
||||
|
||||
@@ -5,10 +5,12 @@ from hello import HelloSvc
|
||||
from thrift.protocol import TJSONProtocol
|
||||
from thrift.server import THttpServer
|
||||
|
||||
|
||||
class HelloSvcHandler:
|
||||
def hello_func(self):
|
||||
print("Hello Called")
|
||||
return "hello from Python"
|
||||
def hello_func(self):
|
||||
print("Hello Called")
|
||||
return "hello from Python"
|
||||
|
||||
|
||||
processor = HelloSvc.Processor(HelloSvcHandler())
|
||||
protoFactory = TJSONProtocol.TJSONProtocolFactory()
|
||||
|
||||
@@ -69,12 +69,12 @@ using namespace thrift::test;
|
||||
// agreement between client and server.
|
||||
//
|
||||
|
||||
template<class _P>
|
||||
class TPedanticProtocol : public _P
|
||||
template<typename Proto>
|
||||
class TPedanticProtocol : public Proto
|
||||
{
|
||||
public:
|
||||
TPedanticProtocol(std::shared_ptr<TTransport>& transport)
|
||||
: _P(transport), m_last_seqid((std::numeric_limits<int32_t>::max)() - 10) { }
|
||||
: Proto(transport), m_last_seqid((std::numeric_limits<int32_t>::max)() - 10) { }
|
||||
|
||||
virtual uint32_t writeMessageBegin_virt(const std::string& name,
|
||||
const TMessageType messageType,
|
||||
@@ -85,14 +85,14 @@ class TPedanticProtocol : public _P
|
||||
seqid = ++m_last_seqid;
|
||||
}
|
||||
|
||||
return _P::writeMessageBegin_virt(name, messageType, seqid);
|
||||
return Proto::writeMessageBegin_virt(name, messageType, seqid);
|
||||
}
|
||||
|
||||
virtual uint32_t readMessageBegin_virt(std::string& name,
|
||||
TMessageType& messageType,
|
||||
int32_t& seqid) override
|
||||
{
|
||||
uint32_t result = _P::readMessageBegin_virt(name, messageType, seqid);
|
||||
uint32_t result = Proto::readMessageBegin_virt(name, messageType, seqid);
|
||||
if (seqid != m_last_seqid) {
|
||||
std::stringstream ss;
|
||||
ss << "ERROR: send request with seqid " << m_last_seqid << " and got reply with seqid " << seqid;
|
||||
|
||||
@@ -259,7 +259,7 @@ def run_test(testdir, logdir, test_dict, max_retry, async_mode=True):
|
||||
raise
|
||||
logger.warn('Error executing [%s]', test.name, exc_info=True)
|
||||
return (retry_count, RESULT_ERROR)
|
||||
except:
|
||||
except Exception:
|
||||
logger.info('Interrupted execution', exc_info=True)
|
||||
if not async_mode:
|
||||
raise
|
||||
|
||||
@@ -26,9 +26,7 @@ import unittest
|
||||
|
||||
from optparse import OptionParser
|
||||
from util import local_libpath
|
||||
|
||||
sys.path.insert(0, local_libpath())
|
||||
|
||||
from thrift.protocol import TProtocolDecorator
|
||||
from thrift.protocol import TProtocol
|
||||
|
||||
@@ -277,6 +275,7 @@ class AbstractTest(unittest.TestCase):
|
||||
# running on it (when multiplexec)
|
||||
LAST_SEQID = None
|
||||
|
||||
|
||||
class TPedanticSequenceIdProtocolWrapper(TProtocolDecorator.TProtocolDecorator):
|
||||
"""
|
||||
Wraps any protocol with sequence ID checking: looks for outbound
|
||||
@@ -289,7 +288,8 @@ class TPedanticSequenceIdProtocolWrapper(TProtocolDecorator.TProtocolDecorator):
|
||||
def writeMessageBegin(self, name, type, seqid):
|
||||
global LAST_SEQID
|
||||
if LAST_SEQID and LAST_SEQID == seqid:
|
||||
raise TProtocol.TProtocolException(INVALID_DATA,
|
||||
raise TProtocol.TProtocolException(
|
||||
TProtocol.TProtocolException.INVALID_DATA,
|
||||
"Python client reused sequence ID {0}".format(seqid))
|
||||
LAST_SEQID = seqid
|
||||
super(TPedanticSequenceIdProtocolWrapper, self).writeMessageBegin(
|
||||
@@ -300,7 +300,8 @@ class TPedanticSequenceIdProtocolWrapper(TProtocolDecorator.TProtocolDecorator):
|
||||
(name, type, seqid) =\
|
||||
super(TPedanticSequenceIdProtocolWrapper, self).readMessageBegin()
|
||||
if LAST_SEQID != seqid:
|
||||
raise TProtocol.TProtocolException(INVALID_DATA,
|
||||
raise TProtocol.TProtocolException(
|
||||
TProtocol.TProtocolException.INVALID_DATA,
|
||||
"We sent seqid {0} and server returned seqid {1}".format(
|
||||
self.last, seqid))
|
||||
return (name, type, seqid)
|
||||
@@ -310,6 +311,7 @@ def make_pedantic(proto):
|
||||
""" Wrap a protocol in the pedantic sequence ID wrapper. """
|
||||
return TPedanticSequenceIdProtocolWrapper(proto)
|
||||
|
||||
|
||||
class MultiplexedOptionalTest(AbstractTest):
|
||||
def get_protocol2(self, transport):
|
||||
return None
|
||||
|
||||
@@ -30,4 +30,5 @@ os.chdir(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
|
||||
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
|
||||
cgi_directories = ['/php']
|
||||
|
||||
|
||||
BaseHTTPServer.HTTPServer(('', 8080), Handler).serve_forever()
|
||||
@@ -67,6 +67,7 @@ def main(client):
|
||||
print(('Check log: %s' % (log.value)))
|
||||
reactor.stop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
d = ClientCreator(reactor,
|
||||
TTwisted.ThriftClientProtocol,
|
||||
|
||||
@@ -85,6 +85,7 @@ class CalculatorHandler:
|
||||
def zip(self):
|
||||
print('zip()')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
handler = CalculatorHandler()
|
||||
processor = Calculator.Processor(handler)
|
||||
|
||||
Reference in new issue
Block a user