< prev index next >

src/share/vm/logging/log.cpp

Print this page
rev 11857 : imported patch 8157948


1144   assert(strstr(output, "ms") != NULL, "Incorrect log line");
1145 
1146   fclose(fp);
1147 }
1148 
1149 void Test_log_gctracetime() {
1150   Test_log_gctracetime_full();
1151   Test_log_gctracetime_full_multitag();
1152   Test_log_gctracetime_no_heap();
1153   Test_log_gctracetime_no_cause();
1154   Test_log_gctracetime_no_heap_no_cause();
1155 }
1156 
1157 void Test_invalid_log_file() {
1158   ResourceMark rm;
1159   stringStream ss;
1160   const char* target_name = "tmplogdir";
1161 
1162   // Attempt to log to a directory (existing log not a regular file)
1163   create_directory(target_name);
1164   LogFileOutput bad_file("tmplogdir");
1165   assert(bad_file.initialize("", &ss) == false, "file was initialized "
1166          "when there was an existing directory with the same name");
1167   assert(strstr(ss.as_string(), "tmplogdir is not a regular file") != NULL,
1168          "missing expected error message, received msg: %s", ss.as_string());
1169   ss.reset();
1170   remove(target_name);
1171 }
1172 
1173 // Ensure -Xlog:help and LogConfiguration::describe contain tagset descriptions
1174 void Test_logtagset_descriptions() {
1175   for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
1176     char expected[1024];
1177     d->tagset->label(expected, sizeof(expected), "+");
1178     jio_snprintf(expected + strlen(expected),
1179                  sizeof(expected) - strlen(expected),
1180                  ": %s", d->descr);
1181 
1182     ResourceMark rm;
1183     stringStream ss;
1184     LogConfiguration::describe(&ss);


1144   assert(strstr(output, "ms") != NULL, "Incorrect log line");
1145 
1146   fclose(fp);
1147 }
1148 
1149 void Test_log_gctracetime() {
1150   Test_log_gctracetime_full();
1151   Test_log_gctracetime_full_multitag();
1152   Test_log_gctracetime_no_heap();
1153   Test_log_gctracetime_no_cause();
1154   Test_log_gctracetime_no_heap_no_cause();
1155 }
1156 
1157 void Test_invalid_log_file() {
1158   ResourceMark rm;
1159   stringStream ss;
1160   const char* target_name = "tmplogdir";
1161 
1162   // Attempt to log to a directory (existing log not a regular file)
1163   create_directory(target_name);
1164   LogFileOutput bad_file("file=tmplogdir");
1165   assert(bad_file.initialize("", &ss) == false, "file was initialized "
1166          "when there was an existing directory with the same name");
1167   assert(strstr(ss.as_string(), "tmplogdir is not a regular file") != NULL,
1168          "missing expected error message, received msg: %s", ss.as_string());
1169   ss.reset();
1170   remove(target_name);
1171 }
1172 
1173 // Ensure -Xlog:help and LogConfiguration::describe contain tagset descriptions
1174 void Test_logtagset_descriptions() {
1175   for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) {
1176     char expected[1024];
1177     d->tagset->label(expected, sizeof(expected), "+");
1178     jio_snprintf(expected + strlen(expected),
1179                  sizeof(expected) - strlen(expected),
1180                  ": %s", d->descr);
1181 
1182     ResourceMark rm;
1183     stringStream ss;
1184     LogConfiguration::describe(&ss);
< prev index next >