diff options
author | James E. King, III <jking@apache.org> | 2017-09-30 15:44:16 -0700 |
---|---|---|
committer | James E. King, III <jking@apache.org> | 2017-10-19 11:29:04 -0400 |
commit | 0ad20bdbfe9abcbb0cc5332ff95651b5c975da91 (patch) | |
tree | 7e713c9380844afe41019a7c6ebe4e508eba3464 /lib | |
parent | 8b8a8efea13d1c97f856053af0a5c0e6a8a76354 (diff) | |
download | thrift-0ad20bdbfe9abcbb0cc5332ff95651b5c975da91.tar.gz |
THRIFT-4351: use travis build stages to optimize build,
avoiding duplicate rebuilds of the same image, and also
allow personal docker hub repositories for private fork
builds to be optimized. Move ubsan build to artful image
because it catches more stuff and fix what was found.
THRIFT-4345: solidify docker build strategy for maximum
coverage: trusty, xenial, artful as stock as they can be
THRIFT-4344: add top level language summary markdown and
update readme with a new image on the layered architecture
THRIFT-3847: remove VERSION macro from config.h which
was causing a conflict on artful builds.
THRIFT-4359: fix haxe map/set decode when key is binary,
as a missing break statement caused it to use an int
during decode
This closes #1389
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cpp/test/TMemoryBufferTest.cpp | 3 | ||||
-rw-r--r-- | lib/cpp/test/concurrency/ThreadFactoryTests.h | 20 | ||||
-rw-r--r-- | lib/d/src/thrift/base.d | 2 | ||||
-rw-r--r-- | lib/go/test/Makefile.am | 4 | ||||
-rw-r--r-- | lib/js/Makefile.am | 10 | ||||
-rwxr-xr-x | lib/nodejs/Makefile.am | 3 | ||||
-rw-r--r-- | lib/py/setup.py | 1 | ||||
-rw-r--r-- | lib/py/src/ext/binary.h | 9 | ||||
-rw-r--r-- | lib/py/src/ext/compact.h | 3 | ||||
-rw-r--r-- | lib/py/src/ext/protocol.tcc | 2 | ||||
-rw-r--r-- | lib/py/src/protocol/TCompactProtocol.py | 3 | ||||
-rw-r--r-- | lib/py/src/server/TNonblockingServer.py | 1 | ||||
-rw-r--r-- | lib/py/src/transport/sslcompat.py | 1 | ||||
-rw-r--r-- | lib/py/test/test_sslsocket.py | 1 | ||||
-rw-r--r-- | lib/py/test/thrift_json.py | 1 |
15 files changed, 37 insertions, 27 deletions
diff --git a/lib/cpp/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp index 0d1d14d17..438418753 100644 --- a/lib/cpp/test/TMemoryBufferTest.cpp +++ b/lib/cpp/test/TMemoryBufferTest.cpp @@ -82,13 +82,14 @@ BOOST_AUTO_TEST_CASE(test_roundtrip) { BOOST_AUTO_TEST_CASE(test_copy) { string* str1 = new string("abcd1234"); + ptrdiff_t str1addr = reinterpret_cast<ptrdiff_t>(str1); const char* data1 = str1->data(); TMemoryBuffer buf((uint8_t*)str1->data(), static_cast<uint32_t>(str1->length()), TMemoryBuffer::COPY); delete str1; string* str2 = new string("plsreuse"); - bool obj_reuse = (str1 == str2); + bool obj_reuse = (str1addr == reinterpret_cast<ptrdiff_t>(str2)); bool dat_reuse = (data1 == str2->data()); BOOST_TEST_MESSAGE("Object reuse: " << obj_reuse << " Data reuse: " << dat_reuse << ((obj_reuse && dat_reuse) ? " YAY!" : "")); diff --git a/lib/cpp/test/concurrency/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h index 6ac9aa51c..48330f374 100644 --- a/lib/cpp/test/concurrency/ThreadFactoryTests.h +++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h @@ -54,39 +54,33 @@ public: void run() { Synchronized s(_monitor); - - _count--; - - // std::cout << "\t\t\tthread count: " << _count << std::endl; - - if (_count == 0) { + + if (--_count == 0) { _monitor.notify(); } } Monitor& _monitor; - int& _count; }; bool reapNThreads(int loop = 1, int count = 10) { PlatformThreadFactory threadFactory = PlatformThreadFactory(); - shared_ptr<Monitor> monitor(new Monitor); for (int lix = 0; lix < loop; lix++) { - int* activeCount = new int(count); + int activeCount = 0; std::vector<shared_ptr<Thread> > threads; - int tix; for (tix = 0; tix < count; tix++) { try { + ++activeCount; threads.push_back( - threadFactory.newThread(shared_ptr<Runnable>(new ReapNTask(*monitor, *activeCount)))); + threadFactory.newThread(shared_ptr<Runnable>(new ReapNTask(*monitor, activeCount)))); } catch (SystemResourceException& e) { std::cout << "\t\t\tfailed to create " << lix* count + tix << " thread " << e.what() << std::endl; @@ -110,17 +104,15 @@ public: { Synchronized s(*monitor); - while (*activeCount > 0) { + while (activeCount > 0) { monitor->wait(1000); } } - delete activeCount; std::cout << "\t\t\treaped " << lix* count << " threads" << std::endl; } std::cout << "\t\t\tSuccess!" << std::endl; - return true; } diff --git a/lib/d/src/thrift/base.d b/lib/d/src/thrift/base.d index 57aec1818..38034a7b8 100644 --- a/lib/d/src/thrift/base.d +++ b/lib/d/src/thrift/base.d @@ -50,7 +50,7 @@ class TCompoundOperationException : TException { /// The Thrift version string, used for informative purposes. // Note: This is currently hardcoded, but will likely be filled in by the build // system in future versions. -enum VERSION = "0.9.0 dev"; +enum VERSION = "1.0.0 dev"; /** * Functions used for logging inside Thrift. diff --git a/lib/go/test/Makefile.am b/lib/go/test/Makefile.am index 5531e070c..842f2de61 100644 --- a/lib/go/test/Makefile.am +++ b/lib/go/test/Makefile.am @@ -59,8 +59,10 @@ gopath: $(THRIFT) $(THRIFTTEST) \ $(THRIFT) $(THRIFTARGS) InitialismsTest.thrift $(THRIFT) $(THRIFTARGS),read_write_private DontExportRWTest.thrift $(THRIFT) $(THRIFTARGS),ignore_initialisms IgnoreInitialismsTest.thrift - GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock GOPATH=`pwd`/gopath $(GO) get golang.org/x/net/context + GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock || true + sed -i 's/\"context\"/\"golang.org\/x\/net\/context\"/g' gopath/src/github.com/golang/mock/gomock/controller.go || true + GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock ln -nfs ../../../thrift gopath/src/thrift ln -nfs ../../tests gopath/src/tests cp -r ./dontexportrwtest gopath/src diff --git a/lib/js/Makefile.am b/lib/js/Makefile.am index 181e15e9b..9ea20a4ab 100644 --- a/lib/js/Makefile.am +++ b/lib/js/Makefile.am @@ -18,11 +18,13 @@ # # Make sure this doesn't fail if ant is not configured. - +# We call install twice to work around npm issues +# +if HAVE_NPM SUBDIRS = test check-local: all - npm install - npm list + $(NPM) install || $(NPM) install + $(NPM) list ./node_modules/.bin/grunt - +endif diff --git a/lib/nodejs/Makefile.am b/lib/nodejs/Makefile.am index a3424d074..9a7b4eb2c 100755 --- a/lib/nodejs/Makefile.am +++ b/lib/nodejs/Makefile.am @@ -15,12 +15,13 @@ # specific language governing permissions and limitations # under the License. +# We call npm twice to work around npm issues stubs: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/ThriftTest.thrift deps: $(top_srcdir)/package.json - $(NPM) install --no-bin-links $(top_srcdir)/ + $(NPM) install $(top_srcdir)/ || $(NPM) install $(top_srcdir)/ all-local: deps diff --git a/lib/py/setup.py b/lib/py/setup.py index d0655730b..3d1411812 100644 --- a/lib/py/setup.py +++ b/lib/py/setup.py @@ -121,6 +121,7 @@ def run_setup(with_binary): **extensions ) + try: with_binary = True run_setup(with_binary) diff --git a/lib/py/src/ext/binary.h b/lib/py/src/ext/binary.h index dedeec35b..960b0d003 100644 --- a/lib/py/src/ext/binary.h +++ b/lib/py/src/ext/binary.h @@ -113,7 +113,8 @@ public: if (!readBytes(&buf, sizeof(int16_t))) { return false; } - val = static_cast<int16_t>(ntohs(*reinterpret_cast<int16_t*>(buf))); + memcpy(&val, buf, sizeof(int16_t)); + val = ntohs(val); return true; } @@ -122,7 +123,8 @@ public: if (!readBytes(&buf, sizeof(int32_t))) { return false; } - val = static_cast<int32_t>(ntohl(*reinterpret_cast<int32_t*>(buf))); + memcpy(&val, buf, sizeof(int32_t)); + val = ntohl(val); return true; } @@ -131,7 +133,8 @@ public: if (!readBytes(&buf, sizeof(int64_t))) { return false; } - val = static_cast<int64_t>(ntohll(*reinterpret_cast<int64_t*>(buf))); + memcpy(&val, buf, sizeof(int64_t)); + val = ntohll(val); return true; } diff --git a/lib/py/src/ext/compact.h b/lib/py/src/ext/compact.h index 5bba23761..a78d7a703 100644 --- a/lib/py/src/ext/compact.h +++ b/lib/py/src/ext/compact.h @@ -162,7 +162,8 @@ public: if (!readBytes(&buf, 8)) { return false; } - transfer.f = letohll(*reinterpret_cast<int64_t*>(buf)); + memcpy(&transfer.f, buf, sizeof(int64_t)); + transfer.f = letohll(transfer.f); val = transfer.t; return true; } diff --git a/lib/py/src/ext/protocol.tcc b/lib/py/src/ext/protocol.tcc index 6e978d7c7..c025d0c96 100644 --- a/lib/py/src/ext/protocol.tcc +++ b/lib/py/src/ext/protocol.tcc @@ -102,7 +102,7 @@ inline bool ProtocolBase<Impl>::writeBuffer(char* data, size_t size) { PyErr_SetString(PyExc_IOError, "failed to write to cStringIO object"); return false; } - if (len != size) { + if (static_cast<size_t>(len) != size) { PyErr_Format(PyExc_EOFError, "write length mismatch: expected %lu got %d", size, len); return false; } diff --git a/lib/py/src/protocol/TCompactProtocol.py b/lib/py/src/protocol/TCompactProtocol.py index 16fd9be28..e485cffb1 100644 --- a/lib/py/src/protocol/TCompactProtocol.py +++ b/lib/py/src/protocol/TCompactProtocol.py @@ -42,6 +42,8 @@ def make_helper(v_from, container): return func(self, *args, **kwargs) return nested return helper + + writer = make_helper(VALUE_WRITE, CONTAINER_WRITE) reader = make_helper(VALUE_READ, CONTAINER_READ) @@ -94,6 +96,7 @@ class CompactType(object): MAP = 0x0B STRUCT = 0x0C + CTYPES = { TType.STOP: CompactType.STOP, TType.BOOL: CompactType.TRUE, # used for collection diff --git a/lib/py/src/server/TNonblockingServer.py b/lib/py/src/server/TNonblockingServer.py index 67ee04ed5..26c0f7e1f 100644 --- a/lib/py/src/server/TNonblockingServer.py +++ b/lib/py/src/server/TNonblockingServer.py @@ -62,6 +62,7 @@ class Worker(threading.Thread): logger.exception("Exception while processing request", exc_info=True) callback(False, b'') + WAIT_LEN = 0 WAIT_MESSAGE = 1 WAIT_PROCESS = 2 diff --git a/lib/py/src/transport/sslcompat.py b/lib/py/src/transport/sslcompat.py index 8ad4ce400..ab00cb2a8 100644 --- a/lib/py/src/transport/sslcompat.py +++ b/lib/py/src/transport/sslcompat.py @@ -96,4 +96,5 @@ def _optional_dependencies(): match = legacy_validate_callback return ipaddr, match + _match_has_ipaddress, _match_hostname = _optional_dependencies() diff --git a/lib/py/test/test_sslsocket.py b/lib/py/test/test_sslsocket.py index 8951618a9..3c4be9c2a 100644 --- a/lib/py/test/test_sslsocket.py +++ b/lib/py/test/test_sslsocket.py @@ -334,6 +334,7 @@ class TSSLSocketTest(unittest.TestCase): self._assert_connection_success(server, ssl_context=client_context) + if __name__ == '__main__': logging.basicConfig(level=logging.WARN) from thrift.transport.TSSLSocket import TSSLSocket, TSSLServerSocket, _match_has_ipaddress diff --git a/lib/py/test/thrift_json.py b/lib/py/test/thrift_json.py index fc1e79cc7..40e7a47e3 100644 --- a/lib/py/test/thrift_json.py +++ b/lib/py/test/thrift_json.py @@ -46,5 +46,6 @@ class TestJSONString(unittest.TestCase): unicode_text = unicode_text.encode('utf8') self.assertEqual(protocol.readString(), unicode_text) + if __name__ == '__main__': unittest.main() |