Skip to content

Commit

Permalink
add UT to make
Browse files Browse the repository at this point in the history
  • Loading branch information
renukamanavalan committed Jun 9, 2022
1 parent 338766b commit 0f64cc8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
2 changes: 2 additions & 0 deletions src/sonic-eventd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ eventd-tests: $(TEST_OBJS)
@echo 'Invoking: G++ Linker'
$(CC) $(LDFLAGS) -o $(EVENTD_TEST) $(TEST_OBJS) $(LIBS) $(TEST_LIBS)
@echo 'Finished building target: $@'
$(EVENTD_TEST)
@echo 'Finished running tests'
@echo ' '

install:
Expand Down
39 changes: 16 additions & 23 deletions src/sonic-eventd/tests/eventd_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,22 @@ void run_pub(void *mock_pub, const string wr_source, internal_events_lst_t &lst)
}


void debug_on()
{
/* compile with -D DEBUG_TEST or add "#define DEBUG_TEST" to include. */
#ifdef DEBUG_TEST
/* Direct log messages to stdout */
string dummy, op("STDOUT");
swss::Logger::swssOutputNotify(dummy, op);
swss::Logger::setMinPrio(swss::Logger::SWSS_DEBUG);
#endif
}

TEST(eventd, proxy)
{
debug_on();

printf("PROxy TEST started\n");
{
/* Direct log messages to stdout */
string dummy, op("STDOUT");
swss::Logger::swssOutputNotify(dummy, op);
}
bool term_sub = false;
bool term_cap = false;
string rd_csource, rd_source, wr_source("hello");
Expand Down Expand Up @@ -307,12 +315,7 @@ TEST(eventd, proxy)
TEST(eventd, capture)
{
printf("Capture TEST started\n");
{
/* Direct log messages to stdout */
string dummy, op("STDOUT");
swss::Logger::swssOutputNotify(dummy, op);
swss::Logger::setMinPrio(swss::Logger::SWSS_DEBUG);
}
debug_on();

/*
* Need to run subscriber; Else publisher would skip publishing
Expand Down Expand Up @@ -432,12 +435,7 @@ TEST(eventd, capture)
TEST(eventd, captureCacheMax)
{
printf("Capture TEST with matchinhg cache-max started\n");
{
/* Direct log messages to stdout */
string dummy, op("STDOUT");
swss::Logger::swssOutputNotify(dummy, op);
swss::Logger::setMinPrio(swss::Logger::SWSS_DEBUG);
}
debug_on();

/*
* Need to run subscriber; Else publisher would skip publishing
Expand Down Expand Up @@ -560,12 +558,7 @@ TEST(eventd, service)
* TEST(eventd, capture) has already tested caching.
*/
printf("Service TEST started\n");
{
/* Direct log messages to stdout */
string dummy, op("STDOUT");
swss::Logger::swssOutputNotify(dummy, op);
swss::Logger::setMinPrio(swss::Logger::SWSS_DEBUG);
}
debug_on();

/* capture related */
int init_cache = 4; /* provided along with start capture */
Expand Down

0 comments on commit 0f64cc8

Please sign in to comment.