From cf1e74212045499badd7b4dcdb3b3add3547dbbc Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Thu, 12 Dec 2019 12:45:06 +0100 Subject: [PATCH] add a simple log_filter test to print a long hex message the purpose of this is to show that the hex message is cut if the lenght exceeds the size of the preallocated buffer --- lib/test/common/log_filter_test.cc | 61 +++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/lib/test/common/log_filter_test.cc b/lib/test/common/log_filter_test.cc index 680164a2f..06b209881 100644 --- a/lib/test/common/log_filter_test.cc +++ b/lib/test/common/log_filter_test.cc @@ -22,9 +22,10 @@ #define NTHREADS 100 #define NMSGS 100 -#include #include "srslte/common/log_filter.h" #include "srslte/common/logger_file.h" +#include "srslte/common/test_common.h" +#include using namespace srslte; @@ -56,8 +57,9 @@ void* thread_loop_hex(void *a) { char buf[100]; uint8_t hex[100]; - for(int i=0;i<100;i++) + for (int i = 0; i < 100; i++) { hex[i] = i & 0xFF; + } sprintf(buf, "LAYER%d", args->thread_id); log_filter filter(buf, args->l); filter.set_level(LOG_LEVEL_DEBUG); @@ -92,7 +94,6 @@ bool read(std::string filename) { bool pass = true; bool written[NTHREADS][NMSGS]; int thread, msg; - int r; for(int i=0;i