Skip to content

Commit b1f09f2

Browse files
authored
Merge pull request #1209 from reyoung/feature/fix_destroy_error
Fix destroy error in test_ProtoServer.
2 parents 1ecfc2d + 23c8ad8 commit b1f09f2

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

paddle/pserver/test/test_ProtoServer.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License. */
1414

15-
#include "paddle/utils/Util.h"
16-
1715
#include <gtest/gtest.h>
18-
16+
#include <memory>
1917
#include "ParameterService.pb.h"
2018
#include "paddle/math/Vector.h"
2119
#include "paddle/pserver/ProtoServer.h"
2220
#include "paddle/utils/Stat.h"
21+
#include "paddle/utils/Util.h"
2322

2423
DEFINE_string(server_addr, "127.0.0.1", "Server address");
2524
DEFINE_int64(dim, 50000000, "Data size");
@@ -162,18 +161,9 @@ TEST(ProtoServer, extended) {
162161
int main(int argc, char** argv) {
163162
paddle::initMain(argc, argv);
164163
testing::InitGoogleTest(&argc, argv);
165-
166-
MyServer* server;
167-
if (FLAGS_rdma_tcp == "rdma") {
168-
server = new MyServer(FLAGS_port, 0);
169-
} else {
170-
server = new MyServer(FLAGS_port);
171-
}
172-
173-
server->start();
164+
MyServer server(FLAGS_port, FLAGS_rdma_tcp == "rdma" ? 0 : -1);
165+
server.start();
174166
usleep(10000);
175167

176-
int ret = RUN_ALL_TESTS();
177-
178-
exit(ret);
168+
return RUN_ALL_TESTS();
179169
}

0 commit comments

Comments
 (0)