Ejemplo n.º 1
0
TEST_VM_F(LogConfigurationTest, parse_invalid_tagset) {
  static const char* invalid_tagset = "logging+start+exit+safepoint+gc"; // Must not exist for test to function.

  // Make sure warning is produced if one or more configured tagsets are invalid
  ResourceMark rm;
  stringStream ss;
  bool success = LogConfiguration::parse_log_arguments("stdout", invalid_tagset, NULL, NULL, &ss);
  const char* msg = ss.as_string();
  EXPECT_TRUE(success) << "Should only cause a warning, not an error";
  EXPECT_TRUE(string_contains_substring(msg, "No tag set matches selection(s):"));
  EXPECT_TRUE(string_contains_substring(msg, invalid_tagset));
}
static bool node_is_last_in_net(char *node_name)
{
    if(string_contains_substring(node_name,";")) {
        node_name[strlen(node_name)-1] = '\0';
        return true;
    }
    return false;
}
Ejemplo n.º 3
0
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");
}
Ejemplo n.º 4
0
// Check if the given text is included by LogConfiguration::describe()
static bool is_described(const char* text) {
  ResourceMark rm;
  stringStream ss;
  LogConfiguration::describe(&ss);
  return string_contains_substring(ss.as_string(), text);
}