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
diff --git a/lib/cpp/test/TMemoryBufferTest.cpp b/lib/cpp/test/TMemoryBufferTest.cpp
index 0d1d14d..4384187 100644
--- a/lib/cpp/test/TMemoryBufferTest.cpp
+++ b/lib/cpp/test/TMemoryBufferTest.cpp
@@ -82,13 +82,14 @@
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 6ac9aa5..48330f3 100644
--- a/lib/cpp/test/concurrency/ThreadFactoryTests.h
+++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h
@@ -54,39 +54,33 @@
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 @@
{
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 57aec18..38034a7 100644
--- a/lib/d/src/thrift/base.d
+++ b/lib/d/src/thrift/base.d
@@ -50,7 +50,7 @@
/// 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 5531e07..842f2de 100644
--- a/lib/go/test/Makefile.am
+++ b/lib/go/test/Makefile.am
@@ -59,8 +59,10 @@
$(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 181e15e..9ea20a4 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 a3424d0..9a7b4eb 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 d065573..3d14118 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -121,6 +121,7 @@
**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 dedeec3..960b0d0 100644
--- a/lib/py/src/ext/binary.h
+++ b/lib/py/src/ext/binary.h
@@ -113,7 +113,8 @@
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 @@
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 @@
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 5bba237..a78d7a7 100644
--- a/lib/py/src/ext/compact.h
+++ b/lib/py/src/ext/compact.h
@@ -162,7 +162,8 @@
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 6e978d7..c025d0c 100644
--- a/lib/py/src/ext/protocol.tcc
+++ b/lib/py/src/ext/protocol.tcc
@@ -102,7 +102,7 @@
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 16fd9be..e485cff 100644
--- a/lib/py/src/protocol/TCompactProtocol.py
+++ b/lib/py/src/protocol/TCompactProtocol.py
@@ -42,6 +42,8 @@
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 @@
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 67ee04e..26c0f7e 100644
--- a/lib/py/src/server/TNonblockingServer.py
+++ b/lib/py/src/server/TNonblockingServer.py
@@ -62,6 +62,7 @@
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 8ad4ce4..ab00cb2 100644
--- a/lib/py/src/transport/sslcompat.py
+++ b/lib/py/src/transport/sslcompat.py
@@ -96,4 +96,5 @@
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 8951618..3c4be9c 100644
--- a/lib/py/test/test_sslsocket.py
+++ b/lib/py/test/test_sslsocket.py
@@ -334,6 +334,7 @@
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 fc1e79c..40e7a47 100644
--- a/lib/py/test/thrift_json.py
+++ b/lib/py/test/thrift_json.py
@@ -46,5 +46,6 @@
unicode_text = unicode_text.encode('utf8')
self.assertEqual(protocol.readString(), unicode_text)
+
if __name__ == '__main__':
unittest.main()