< prev index next >

test/native/logging/test_logFileOutput.cpp

Print this page
rev 12435 : 8170936: Logging: LogFileOutput.invalid_file_test crashes when executed twice.
Reviewed-by: duke

*** 101,111 **** stringStream ss; LogFileOutput fo(name); EXPECT_FALSE(fo.initialize(buf, &ss)) << "Accepted filesize that overflows"; } ! TEST(LogFileOutput, startup_rotation) { const size_t rotations = 5; const char* filename = "start-rotate-test"; char* rotated_file[rotations]; ResourceMark rm; --- 101,111 ---- stringStream ss; LogFileOutput fo(name); EXPECT_FALSE(fo.initialize(buf, &ss)) << "Accepted filesize that overflows"; } ! TEST_VM(LogFileOutput, startup_rotation) { const size_t rotations = 5; const char* filename = "start-rotate-test"; char* rotated_file[rotations]; ResourceMark rm;
*** 138,148 **** for (size_t i = 0; i < rotations; i++) { delete_file(rotated_file[i]); } } ! TEST(LogFileOutput, startup_truncation) { const char* filename = "start-truncate-test"; const char* archived_filename = "start-truncate-test.0"; delete_file(filename); delete_file(archived_filename); --- 138,148 ---- for (size_t i = 0; i < rotations; i++) { delete_file(rotated_file[i]); } } ! TEST_VM(LogFileOutput, startup_truncation) { const char* filename = "start-truncate-test"; const char* archived_filename = "start-truncate-test.0"; delete_file(filename); delete_file(archived_filename);
*** 166,183 **** delete_file(filename); delete_file(archived_filename); } ! TEST(LogFileOutput, invalid_file) { ResourceMark rm; stringStream ss; // Attempt to log to a directory (existing log not a regular file) create_directory("tmplogdir"); LogFileOutput bad_file("file=tmplogdir"); EXPECT_FALSE(bad_file.initialize("", &ss)) << "file was initialized when there was an existing directory with the same name"; EXPECT_TRUE(string_contains_substring(ss.as_string(), "tmplogdir is not a regular file")) << "missing expected error message, received msg: %s" << ss.as_string(); ! remove("tmplogdir"); } --- 166,183 ---- delete_file(filename); delete_file(archived_filename); } ! TEST_VM(LogFileOutput, invalid_file) { ResourceMark rm; stringStream ss; // Attempt to log to a directory (existing log not a regular file) create_directory("tmplogdir"); LogFileOutput bad_file("file=tmplogdir"); EXPECT_FALSE(bad_file.initialize("", &ss)) << "file was initialized when there was an existing directory with the same name"; EXPECT_TRUE(string_contains_substring(ss.as_string(), "tmplogdir is not a regular file")) << "missing expected error message, received msg: %s" << ss.as_string(); ! delete_empty_directory("tmplogdir"); }
< prev index next >