@@ -97,7 +97,7 @@ static void test1_execute()
97
97
PVV (test.d_line << " : executing command '" << test.d_command << " '" );
98
98
99
99
bsl::string output (s_allocator_p);
100
- int rc = mwcsys::ExecUtil::execute (&output, test.d_command );
100
+ const int rc = mwcsys::ExecUtil::execute (&output, test.d_command );
101
101
ASSERT_EQ_D (" line " << test.d_line , rc, test.d_expectedRc );
102
102
ASSERT_EQ_D (" line " << test.d_line , output, test.d_expectedOutput );
103
103
}
@@ -204,9 +204,9 @@ static void test3_outputFromFileNoGen()
204
204
createFile (k_TESTFILE, test.d_content , S_IRWXU);
205
205
206
206
bsl::string output (s_allocator_p);
207
- int rc = mwcsys::ExecUtil::outputFromFile (&output,
208
- k_TESTFILE,
209
- test.d_arguments );
207
+ const int rc = mwcsys::ExecUtil::outputFromFile (&output,
208
+ k_TESTFILE,
209
+ test.d_arguments );
210
210
ASSERT_EQ_D (" line " << test.d_line , rc, 0 );
211
211
ASSERT_EQ_D (" line " << test.d_line , output, test.d_expectedOutput );
212
212
@@ -263,9 +263,9 @@ static void test4_outputFromFileGen()
263
263
createFile (k_TESTFILE, test.d_content , S_IRWXU);
264
264
265
265
bsl::string output (s_allocator_p);
266
- int rc = mwcsys::ExecUtil::outputFromFile (&output,
267
- k_TESTFILE,
268
- test.d_arguments );
266
+ const int rc = mwcsys::ExecUtil::outputFromFile (&output,
267
+ k_TESTFILE,
268
+ test.d_arguments );
269
269
ASSERT_EQ_D (" line " << test.d_line , (rc == 0 ), test.d_expectSuccess );
270
270
ASSERT_EQ_D (" line " << test.d_line , output, test.d_expectedOutput );
271
271
@@ -300,19 +300,19 @@ static void test5_outputFromFileError()
300
300
}
301
301
302
302
bsl::string output (s_allocator_p);
303
- int rc = mwcsys::ExecUtil::outputFromFile (&output,
304
- k_TESTFILE,
305
- " dummyArgs" );
303
+ const int rc = mwcsys::ExecUtil::outputFromFile (&output,
304
+ k_TESTFILE,
305
+ " dummyArgs" );
306
306
ASSERT_NE (rc, 0 );
307
307
}
308
308
309
309
{
310
310
PV (" Not a regular input file" );
311
311
312
312
bsl::string output (s_allocator_p);
313
- int rc = mwcsys::ExecUtil::outputFromFile (&output,
314
- " ./" , // a directory
315
- " dummyArgs" );
313
+ const int rc = mwcsys::ExecUtil::outputFromFile (&output,
314
+ " ./" , // a directory
315
+ " dummyArgs" );
316
316
ASSERT_NE (rc, 0 );
317
317
}
318
318
@@ -322,9 +322,9 @@ static void test5_outputFromFileError()
322
322
createFile (k_TESTFILE, " #! /bin/bash\n echo -n 'yes'" , S_IRUSR);
323
323
324
324
bsl::string output (s_allocator_p);
325
- int rc = mwcsys::ExecUtil::outputFromFile (&output,
326
- k_TESTFILE,
327
- " dummyArgs" );
325
+ const int rc = mwcsys::ExecUtil::outputFromFile (&output,
326
+ k_TESTFILE,
327
+ " dummyArgs" );
328
328
ASSERT_NE (rc, 0 );
329
329
330
330
bdls::FilesystemUtil::remove (k_TESTFILE);
@@ -338,9 +338,9 @@ static void test5_outputFromFileError()
338
338
S_IRWXU);
339
339
340
340
bsl::string output (s_allocator_p);
341
- int rc = mwcsys::ExecUtil::outputFromFile (&output,
342
- k_TESTFILE,
343
- " dummyArgs" );
341
+ const int rc = mwcsys::ExecUtil::outputFromFile (&output,
342
+ k_TESTFILE,
343
+ " dummyArgs" );
344
344
ASSERT_NE (rc, 0 );
345
345
346
346
bdls::FilesystemUtil::remove (k_TESTFILE);
@@ -368,5 +368,9 @@ int main(int argc, char* argv[])
368
368
} break ;
369
369
}
370
370
371
- TEST_EPILOG (mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC);
371
+ // 'bdls::FilesystemUtil::remove' builds a 'bsl::string' using a default
372
+ // allocator. The string allocates memory in heap if we provide a long
373
+ // enough filename to the call. It causes the default allocator check to
374
+ // fail. More details in the ticket 176461860.
375
+ TEST_EPILOG (mwctst::TestHelper::e_CHECK_GBL_ALLOC);
372
376
}
0 commit comments