Fix spaces

This commit is contained in:
Ola Bini 2015-10-05 13:42:43 -05:00
parent be7ef94a7d
commit ca927b7f63
No known key found for this signature in database
GPG Key ID: 465757AF3914B4B7
4 changed files with 19 additions and 10 deletions

View File

@ -192,7 +192,8 @@ tor_process_monitor_new(struct event_base *base,
tor_procmon_callback_t cb, void *cb_arg, tor_procmon_callback_t cb, void *cb_arg,
const char **msg) const char **msg)
{ {
tor_process_monitor_t *procmon = tor_malloc_zero(sizeof(tor_process_monitor_t)); tor_process_monitor_t *procmon = tor_malloc_zero(
sizeof(tor_process_monitor_t));
struct parsed_process_specifier_t ppspec; struct parsed_process_specifier_t ppspec;
tor_assert(msg != NULL); tor_assert(msg != NULL);

View File

@ -37,20 +37,21 @@ const char *
mock_saved_log_at(int ix) mock_saved_log_at(int ix)
{ {
int saved_log_count = mock_saved_log_number(); int saved_log_count = mock_saved_log_number();
if(ix < 0) { if (ix < 0) {
ix = saved_log_count + ix; ix = saved_log_count + ix;
} }
if (saved_log_count <= ix) if (saved_log_count <= ix)
return ""; return "";
return ((mock_saved_log_entry_t *)smartlist_get(saved_logs, ix))->generated_msg; return ((mock_saved_log_entry_t *)
smartlist_get(saved_logs, ix))->generated_msg;
} }
int int
mock_saved_severity_at(int ix) mock_saved_severity_at(int ix)
{ {
int saved_log_count = mock_saved_log_number(); int saved_log_count = mock_saved_log_number();
if(ix < 0) { if (ix < 0) {
ix = saved_log_count + ix; ix = saved_log_count + ix;
} }
@ -74,7 +75,8 @@ mock_saved_logs(void)
} }
void void
mock_saving_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap) mock_saving_logv(int severity, log_domain_mask_t domain, const char *funcname,
const char *suffix, const char *format, va_list ap)
{ {
(void)domain; (void)domain;
char *buf = tor_malloc_zero(10240); char *buf = tor_malloc_zero(10240);

View File

@ -15,7 +15,9 @@ typedef struct mock_saved_log_entry_t {
struct mock_saved_log_entry_t *next; struct mock_saved_log_entry_t *next;
} mock_saved_log_entry_t; } mock_saved_log_entry_t;
void mock_saving_logv(int severity, log_domain_mask_t domain, const char *funcname, const char *suffix, const char *format, va_list ap); void mock_saving_logv(int severity, log_domain_mask_t domain,
const char *funcname, const char *suffix,
const char *format, va_list ap);
void mock_clean_saved_logs(void); void mock_clean_saved_logs(void);
const smartlist_t *mock_saved_logs(void); const smartlist_t *mock_saved_logs(void);
int setup_capture_of_logs(int new_level); int setup_capture_of_logs(int new_level);

View File

@ -29,15 +29,18 @@ test_procmon_tor_process_monitor_new(void *ignored)
tt_assert(!res); tt_assert(!res);
tt_str_op(msg, OP_EQ, "invalid PID"); tt_str_op(msg, OP_EQ, "invalid PID");
res = tor_process_monitor_new(tor_libevent_get_base(), "43", 0, NULL, NULL, &msg); res = tor_process_monitor_new(tor_libevent_get_base(), "43", 0,
NULL, NULL, &msg);
tt_assert(res); tt_assert(res);
tt_assert(!msg); tt_assert(!msg);
res = tor_process_monitor_new(tor_libevent_get_base(), "44 hello", 0, NULL, NULL, &msg); res = tor_process_monitor_new(tor_libevent_get_base(), "44 hello", 0,
NULL, NULL, &msg);
tt_assert(res); tt_assert(res);
tt_assert(!msg); tt_assert(!msg);
res = tor_process_monitor_new(tor_libevent_get_base(), "45:hello", 0, NULL, NULL, &msg); res = tor_process_monitor_new(tor_libevent_get_base(), "45:hello", 0,
NULL, NULL, &msg);
tt_assert(res); tt_assert(res);
tt_assert(!msg); tt_assert(!msg);
@ -46,6 +49,7 @@ test_procmon_tor_process_monitor_new(void *ignored)
} }
struct testcase_t procmon_tests[] = { struct testcase_t procmon_tests[] = {
{ "tor_process_monitor_new", test_procmon_tor_process_monitor_new, TT_FORK, NULL, NULL }, { "tor_process_monitor_new", test_procmon_tor_process_monitor_new,
TT_FORK, NULL, NULL },
END_OF_TESTCASES END_OF_TESTCASES
}; };