Ejemplo n.º 1
0
void
_test_default_level_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  gint level = GPOINTER_TO_INT(self->user_data);
  assert_gint(msg->pri, LOG_LOCAL0 | level, ASSERTION_ERROR("Bad default prio"));
  test_source_finish_tc(src);
}
Ejemplo n.º 2
0
void
_test_default_facility_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  gint facility = GPOINTER_TO_INT(self->user_data);
  assert_gint(msg->pri, facility | LOG_NOTICE, ASSERTION_ERROR("Bad default prio"));
  test_source_finish_tc(src);
}
Ejemplo n.º 3
0
void
_test_default_facility_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  gint facility = GPOINTER_TO_INT(self->user_data);
  cr_assert_eq(msg->pri, facility | LOG_NOTICE, "%s", "Bad default prio");
  test_source_finish_tc(src);
}
Ejemplo n.º 4
0
void
_test_default_level_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  gint level = GPOINTER_TO_INT(self->user_data);
  cr_assert_eq(msg->pri, LOG_LOCAL0 | level, "%s", "Bad default prio");
  test_source_finish_tc(src);
}
Ejemplo n.º 5
0
void
_test_prefix_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  const gchar *message = log_msg_get_value(msg, LM_V_MESSAGE, NULL);
  assert_string(message, "pam_unix(sshd:session): session opened for user foo_user by (uid=0)", ASSERTION_ERROR("Bad message"));

  __test_message_has_no_prefix(self, msg);
  __test_other_has_prefix(self, msg);

  test_source_finish_tc(src);
}
Ejemplo n.º 6
0
void
_test_default_working_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  const gchar *message = log_msg_get_value(msg, LM_V_MESSAGE, NULL);
  JournalReaderOptions *options = self->user_data;
  assert_string(message, "Dummy message", ASSERTION_ERROR("Bad message"));
  assert_gint(msg->pri, options->default_pri, ASSERTION_ERROR("Bad default prio"));
  assert_gint(options->fetch_limit, 10, ASSERTION_ERROR("Bad default fetch_limit"));
  assert_gint(options->max_field_size, 64 * 1024, ASSERTION_ERROR("Bad max field size"));
  assert_gpointer(options->prefix, NULL, ASSERTION_ERROR("Bad default prefix value"));
  assert_string(options->recv_time_zone, configuration->recv_time_zone, ASSERTION_ERROR("Bad default timezone"));
  test_source_finish_tc(src);
}
Ejemplo n.º 7
0
void
_test_default_working_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  const gchar *message = log_msg_get_value(msg, LM_V_MESSAGE, NULL);
  JournalReaderOptions *options = self->user_data;
  cr_assert_str_eq(message, "Dummy message", "%s", "Bad message");
  cr_assert_eq(msg->pri, options->default_pri, "%s", "Bad default prio");
  cr_assert_eq(options->fetch_limit, 10, "%s", "Bad default fetch_limit");
  cr_assert_eq(options->max_field_size, 64 * 1024, "%s", "Bad max field size");
  cr_assert_str_eq(options->prefix, ".journald.", "%s", "Bad default prefix value");
  cr_assert_str_eq(options->recv_time_zone, cfg->recv_time_zone, "%s", "Bad default timezone");
  test_source_finish_tc(src);
}
Ejemplo n.º 8
0
void
_test_program_field_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  Journald *journal = self->user_data;
  gchar *cursor;
  journald_get_cursor(journal, &cursor);
  if (strcmp(cursor, "no SYSLOG_IDENTIFIER") != 0)
    {
      cr_assert_str_eq(log_msg_get_value(msg, LM_V_PROGRAM, NULL), "syslog_program", "%s", "Bad program name");
      g_free(cursor);
    }
  else
    {
      cr_assert_str_eq(log_msg_get_value(msg, LM_V_PROGRAM, NULL), "comm_program", "%s", "Bad program name");
      g_free(cursor);
      test_source_finish_tc(src);
    }
}
Ejemplo n.º 9
0
void
_test_timezone_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  assert_gint(msg->timestamps[LM_TS_STAMP].zone_offset, 9 * 3600, ASSERTION_ERROR("Bad time zone info"));
  test_source_finish_tc(src);
}
Ejemplo n.º 10
0
void
_test_field_size_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  log_msg_nv_table_foreach(msg->payload, __check_value_len, self);
  test_source_finish_tc(src);
}
Ejemplo n.º 11
0
void
_test_timezone_test(TestCase *self, TestSource *src, LogMessage *msg)
{
  cr_assert_eq(msg->timestamps[LM_TS_STAMP].ut_gmtoff, 9 * 3600, "%s", "Bad time zone info");
  test_source_finish_tc(src);
}