From fae5d82c367482e7236489bff41c875a230598fd Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Sun, 22 Jan 2017 10:29:55 +0800 Subject: [PATCH] Fix destroy error in test_ProtoServer. --- paddle/pserver/test/test_ProtoServer.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/paddle/pserver/test/test_ProtoServer.cpp b/paddle/pserver/test/test_ProtoServer.cpp index 9f86ee80f4e..e70e1670d31 100644 --- a/paddle/pserver/test/test_ProtoServer.cpp +++ b/paddle/pserver/test/test_ProtoServer.cpp @@ -12,14 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include "paddle/utils/Util.h" - #include - +#include #include "ParameterService.pb.h" #include "paddle/math/Vector.h" #include "paddle/pserver/ProtoServer.h" #include "paddle/utils/Stat.h" +#include "paddle/utils/Util.h" DEFINE_string(server_addr, "127.0.0.1", "Server address"); DEFINE_int64(dim, 50000000, "Data size"); @@ -163,17 +162,15 @@ int main(int argc, char** argv) { paddle::initMain(argc, argv); testing::InitGoogleTest(&argc, argv); - MyServer* server; + std::unique_ptr server; if (FLAGS_rdma_tcp == "rdma") { - server = new MyServer(FLAGS_port, 0); + server.reset(new MyServer(FLAGS_port, 0)); } else { - server = new MyServer(FLAGS_port); + server.reset(new MyServer(FLAGS_port)); } server->start(); usleep(10000); - int ret = RUN_ALL_TESTS(); - - exit(ret); + return RUN_ALL_TESTS(); } -- GitLab