Skip to content

Commit 394e578

Browse files
committed
fix unittest failure due to the path is too long
1 parent 626c1ed commit 394e578

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

paddle/fluid/platform/enforce.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,13 +775,13 @@ inline std::string GetExternalErrorMsg(T status) {
775775
}
776776
}
777777
#else
778-
char buf[100];
778+
char buf[512];
779779
MEMORY_BASIC_INFORMATION mbi;
780780
HMODULE h_module =
781781
(::VirtualQuery(GetCurrentTraceBackString, &mbi, sizeof(mbi)) != 0)
782782
? (HMODULE)mbi.AllocationBase
783783
: NULL;
784-
GetModuleFileName(h_module, buf, 100);
784+
GetModuleFileName(h_module, buf, 512);
785785
std::string strModule(buf);
786786
const size_t last_slash_idx = strModule.find_last_of("\\");
787787
std::string compare_path = strModule.substr(strModule.length() - 7);

paddle/fluid/platform/enforce_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ TEST(enforce, cuda_success) {
417417
"An unsupported value or parameter was passed to the function (a "
418418
"negative vector size, for example).To correct: ensure that all the "
419419
"parameters being passed have valid values"));
420-
/*
420+
421421
#if !defined(__APPLE__) && defined(PADDLE_WITH_NCCL)
422422
EXPECT_TRUE(CheckCudaStatusSuccess(ncclSuccess));
423423
EXPECT_TRUE(CheckCudaStatusFailure(ncclUnhandledCudaError, "NCCL error"));
@@ -430,7 +430,6 @@ TEST(enforce, cuda_success) {
430430
"The call to NCCL is incorrect. This is "
431431
"usually reflecting a programming error"));
432432
#endif
433-
*/
434433
}
435434
#endif
436435
#endif

0 commit comments

Comments
 (0)