~ubuntu-branches/ubuntu/trusty/syslog-ng/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/unit/test_logqueue.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2010-03-28 19:47:36 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100328194736-1ob7kh1qr0fy8b9k
Tags: 3.1.0-1
* New upstream release.
* Fix path of syslog logfile (closes: #575722) and use tty10 instead of
  vc/10 to log on console.
* Provide syslog-ng in initscript (closes: #575723).

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
#define OVERFLOW_SIZE 10000
12
12
 
13
 
void 
 
13
void
14
14
test_ack(LogMessage *msg, gpointer user_data)
15
15
{
16
16
  acked_messages++;
22
22
  LogPathOptions path_options = LOG_PATH_OPTIONS_INIT;
23
23
  LogMessage *msg;
24
24
  gint i;
25
 
  
 
25
 
26
26
  path_options.flow_control = flow_control;
27
27
  for (i = 0; i < n; i++)
28
28
    {
29
29
      char *msg_str = "<155>2006-02-11T10:34:56+01:00 bzorp syslog-ng[23323]: árvíztűrőtükörfúrógép";
30
 
      
 
30
 
31
31
      msg = log_msg_new(msg_str, strlen(msg_str), g_sockaddr_inet_new("10.10.10.10", 1010), 0, NULL, -1, 0xFFFF);
32
32
      log_msg_add_ack(msg, &path_options);
33
33
      msg->ack_func = test_ack;
38
38
        }
39
39
      fed_messages++;
40
40
    }
41
 
  
 
41
 
42
42
}
43
43
 
44
44
void
47
47
  gint i;
48
48
  LogMessage *msg;
49
49
  LogPathOptions path_options = LOG_PATH_OPTIONS_INIT;
50
 
  
 
50
 
51
51
  for (i = 0; i < n; i++)
52
52
    {
53
53
      log_queue_pop_head(q, &msg, &path_options, use_app_acks);
73
73
{
74
74
  LogQueue *q;
75
75
  gint i;
76
 
  
 
76
 
77
77
  q = log_queue_new(OVERFLOW_SIZE);
78
78
  fed_messages = 0;
79
 
  acked_messages = 0;  
 
79
  acked_messages = 0;
80
80
  for (i = 0; i < 10; i++)
81
81
    feed_some_messages(&q, 10, TRUE);
82
 
    
 
82
 
83
83
  send_some_messages(q, fed_messages, TRUE);
84
84
  app_ack_some_messages(q, fed_messages);
85
85
  if (fed_messages != acked_messages)
87
87
      fprintf(stderr, "did not receive enough acknowledgements: fed_messages=%d, acked_messages=%d\n", fed_messages, acked_messages);
88
88
      exit(1);
89
89
    }
90
 
    
 
90
 
91
91
  log_queue_free(q);
92
92
}
93
93
 
96
96
{
97
97
  LogQueue *q;
98
98
  gint i;
99
 
  
 
99
 
100
100
  q = log_queue_new(OVERFLOW_SIZE);
101
101
  fed_messages = 0;
102
102
  acked_messages = 0;
111
111
      fprintf(stderr, "did not receive enough acknowledgements: fed_messages=%d, acked_messages=%d\n", fed_messages, acked_messages);
112
112
      exit(1);
113
113
    }
114
 
    
 
114
 
115
115
  log_queue_free(q);
116
116
}
117
117
 
200
200
}
201
201
#endif
202
202
 
203
 
int 
 
203
int
204
204
main()
205
205
{
206
206
  app_startup();