[1/1] Loggingrb: Build and fix the testcase
diff mbox

Message ID B7D827E17A958449871286AB5AE2391A5A7DC8@GRID.cxn.local
State Accepted
Headers show

Commit Message

Mike McTernan (wavemobile) March 30, 2015, 12:30 p.m. UTC
The loggingrb (ringbuffer) testcase was not actually being built and ran; instead the makefile called the normal logging test for a second time.

This patch fixes Makefile.am to build the correct files, then the loggingrb testcase is fixed to use the current loggingrb API so that it builds and passes.

Signed-off-by: Michael McTernan <Mike.McTernan@wavemobile.com>
---
tests/Makefile.am                |  2 +-
tests/loggingrb/loggingrb_test.c | 11 +++++------
2 files changed, 6 insertions(+), 7 deletions(-)

               log_init(&log_info, NULL);
-              ringbuf_target = log_target_create_rbvty(NULL, 0x1000);
+             ringbuf_target = log_target_create_rb(0x1000);
              log_add_target(ringbuf_target);
              log_set_all_filter(ringbuf_target, 1);
              log_set_print_filename(ringbuf_target, 0);
@@ -74,9 +73,9 @@ int main(int argc, char **argv)
              DEBUGP(DRLL, "You should see this\n");
              DEBUGP(DCC, "You should see this\n");
              DEBUGP(DMM, "You should not see this\n");
-              fprintf(stderr, ringbuffer_get_nth(ringbuf_target->tgt_rbvty.rb, 0));
-              fprintf(stderr, ringbuffer_get_nth(ringbuf_target->tgt_rbvty.rb, 1));
-              OSMO_ASSERT(!ringbuffer_get_nth(ringbuf_target->tgt_rbvty.rb, 2));
+             fprintf(stderr, log_target_rb_get(ringbuf_target, 0));
+             fprintf(stderr, log_target_rb_get(ringbuf_target, 1));
+             OSMO_ASSERT(!log_target_rb_get(ringbuf_target, 2));
               return 0;
}
--
1.8.3.1

Comments

Holger Freyther March 30, 2015, 1:39 p.m. UTC | #1
On Mon, Mar 30, 2015 at 12:30:58PM +0000, Mike McTernan (wavemobile) wrote:

Hey!

> The loggingrb (ringbuffer) testcase was not actually being built and ran; instead the makefile called the normal logging test for a second time.
> 
> This patch fixes Makefile.am to build the correct files, then the loggingrb testcase is fixed to use the current loggingrb API so that it builds and passes.


oh nice find! How did you find it? Could you somehow send it as
attachment? Your mailer has sadly broken it. :(

holger
Mike McTernan (wavemobile) March 30, 2015, 1:51 p.m. UTC | #2
> oh nice find! How did you find it? 

I was adding to the existing logger testcase for some other changes, and noticed loggerrb started failing...  manually trying to build the loggerrb case made it obvious when it wouldn't compile due to wrong headers and functions.

> Could you somehow send it as attachment?  

Sure, attached.  

> Your mailer has sadly broken it. :(

Hmm, I thought it might - Outlook I'm afraid :(

Kind Regards,

Mike

Patch
diff mbox

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2c80063..0bf0c43 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -78,7 +78,7 @@  logging_logging_test_LDADD = $(top_builddir)/src/libosmocore.la
fr_fr_test_SOURCES = fr/fr_test.c
fr_fr_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gb/libosmogb.la $(LIBRARY_DL)
-loggingrb_loggingrb_test_SOURCES = logging/logging_test.c
+loggingrb_loggingrb_test_SOURCES = loggingrb/loggingrb_test.c
loggingrb_loggingrb_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/vty/libosmovty.la
 strrb_strrb_test_SOURCES = strrb/strrb_test.c
diff --git a/tests/loggingrb/loggingrb_test.c b/tests/loggingrb/loggingrb_test.c
index 9957b53..ebc0181 100644
--- a/tests/loggingrb/loggingrb_test.c
+++ b/tests/loggingrb/loggingrb_test.c
@@ -21,8 +21,7 @@ 
 #include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
-#include <osmocom/core/ringb.h>
-#include <osmocom/vty/logging_rbvty.h>
+#include <osmocom/core/loggingrb.h>
 enum {
              DRLL,
@@ -61,7 +60,7 @@  int main(int argc, char **argv)
              struct log_target *ringbuf_target;