diff --git a/communication/communicators/ClientComm.cpp b/communication/communicators/ClientComm.cpp index 752537b7..4fb1e7b6 100644 --- a/communication/communicators/ClientComm.cpp +++ b/communication/communicators/ClientComm.cpp @@ -67,18 +67,11 @@ bool ClientComm::signon(const Header& header, Comm_t* async_comm) { while ((!requests.signon_complete) && (tout < 0 || (((double)(clock() - start))*1000000/CLOCKS_PER_SEC) < tout)) { -#ifdef YGG_TEST - // Prevent sending extra SIGNON during testing - if (!requests.signonSent()) { -#endif // YGG_TEST ygglog_debug << "ClientComm(" << name << ")::signon: Sending signon" << std::endl; if (async_comm->send(YGG_CLIENT_SIGNON, YGG_CLIENT_SIGNON_LEN) < 0) { ygglog_error << "ClientComm(" << name << ")::signon: Error in sending sign-on" << std::endl; return false; } -#ifdef YGG_TEST - } -#endif // YGG_TEST if ((flags & COMM_FLAG_ASYNC_WRAPPED) && (async_comm != this)) return true; if (requests.activeComm()->comm_nmsg(RECV) > 0) { diff --git a/communication/datatypes/dtype_t.cpp b/communication/datatypes/dtype_t.cpp index 0a1bd4ed..14d56f18 100644 --- a/communication/datatypes/dtype_t.cpp +++ b/communication/datatypes/dtype_t.cpp @@ -130,6 +130,10 @@ extern "C" { generic_t out = init_generic(); rapidjson::Document sd; sd.Parse(schema); + if (sd.HasParseError()) { + destroy_generic(&out); + return out; + } rapidjson::SchemaDocument s(sd); rapidjson::SchemaValidator validator(s); rapidjson::Document* x = new rapidjson::Document(); @@ -279,6 +283,9 @@ extern "C" { rapidjson::Document* x_obj = (rapidjson::Document*)(x.obj); x_obj->SetNull(); x_obj->Parse(json); + if (x_obj->HasParseError()) { + ygglog_throw_error_c("generic_set_json: Error parsing string %s", json); + } } catch(...) { ygglog_error_c("generic_set_json: C++ exception thrown"); return GENERIC_ERROR_; diff --git a/communication/utils/serialization.cpp b/communication/utils/serialization.cpp index 5a1ffa6d..7058c799 100644 --- a/communication/utils/serialization.cpp +++ b/communication/utils/serialization.cpp @@ -119,7 +119,8 @@ void Metadata::_init(bool use_generic) { // } #if RAPIDJSON_HAS_CXX11_RVALUE_REFS Metadata::Metadata(Metadata&& rhs) : - metadata(std::move(rhs.metadata)), schema(NULL) { + metadata(), schema(NULL) { + metadata.Swap(rhs.metadata); _update_schema(); rhs._update_schema(); } @@ -128,7 +129,7 @@ Metadata& Metadata::operator=(Metadata&& rhs) { } #endif // RAPIDJSON_HAS_CXX11_RVALUE_REFS Metadata& Metadata::operator=(Metadata& rhs) { - metadata = std::move(rhs.metadata); + metadata.Swap(rhs.metadata); _update_schema(); rhs._update_schema(); return *this; @@ -204,6 +205,9 @@ void Metadata::Normalize() { void Metadata::fromSchema(const std::string schemaStr, bool use_generic) { rapidjson::Document d; d.Parse(schemaStr.c_str()); + if (d.HasParseError()) { + ygglog_throw_error_c("Metadata::fromSchema: Error parsing string: %s", schemaStr.c_str()); + } fromSchema(d, false, use_generic); if (hasType()) { typename rapidjson::Value::MemberIterator it = schema->FindMember(rapidjson::Document::GetTypeString()); diff --git a/gdb_commands.txt b/gdb_commands.txt new file mode 100644 index 00000000..f5bdd214 --- /dev/null +++ b/gdb_commands.txt @@ -0,0 +1 @@ +run diff --git a/run_tests.sh b/run_tests.sh index 41d17ebf..4c2ff70c 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -4,7 +4,7 @@ DO_PYTHON="" WITH_ASAN="" DONT_BUILD="" NO_CORE="" -CMAKE_FLAGS="" # -DRAPIDJSON_INCLUDE_DIRS=/Users/langmm/rapidjson/include" +CMAKE_FLAGS="-DRAPIDJSON_INCLUDE_DIRS=/Users/langmm/rapidjson/include" WITH_LLDB="" while [[ $# -gt 0 ]]; do @@ -46,7 +46,11 @@ if [ -z "$DO_PYTHON" ]; then cd build cmake .. -DCMAKE_INSTALL_PREFIX=../devel -DYGG_ENABLE_COVERAGE=OFF -DYGG_SKIP_VALGRIND_TESTS=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DYGG_BUILD_TESTS=ON -DBUILD_PYTHON_LIBRARY=OFF $CMAKE_FLAGS make - make test ARGS="--stop-on-failure" + if [ -n "$WITH_LLDB" ]; then + lldb -o 'run' -o 'quit' -- test/unittest + else + make test ARGS="--stop-on-failure" + fi cd ../ else if [ -n "$DONT_BUILD"]; then