From 471b5efe913c0f50b41a1e4ea9328bd81a438658 Mon Sep 17 00:00:00 2001
From: Florian Kaltenberger <florian.kaltenberger@eurecom.fr>
Date: Fri, 14 Sep 2018 00:15:53 -0700
Subject: [PATCH] making UE unit tests compile

---
 .../NR_UE_PHY/unit_tests/build/CMakeLists.txt    | 16 +++++++++-------
 .../NR_UE_PHY/unit_tests/src/dummy_functions.c   |  2 +-
 .../NR_UE_PHY/unit_tests/src/pbch_test.c         |  4 ++--
 .../NR_UE_PHY/unit_tests/src/pss_util_test.c     |  8 +++++---
 4 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt b/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt
index af4e096690..5d718a1911 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/build/CMakeLists.txt
@@ -40,10 +40,12 @@ set(DEBUG_PSS True)
 set(DEBUG_PHY True)
 set(DEBUG_PHY_PROC False)
 set(DEBUG_DLSCH True)
+set(T_TRACER False)
 
 # standard cmake file for nr ue build
 include(../../../../../cmake_targets/CMakeLists.txt)
 
+
 set(SRC_UNIT_TESTS 
     ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
     ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
@@ -53,43 +55,43 @@ set(INC_UNIT_TESTS
      ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.h
     )
 
-add_executable(pss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(pss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pss_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(pss_test 
                        -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
                       )
                       
-add_executable(sss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(sss_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/sss_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(sss_test 
                        -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
                       )
 
-add_executable(frame_config_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(frame_config_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/frame_config_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(frame_config_test 
                        -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
                       )
                       
-add_executable(harq_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(harq_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/harq_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(harq_test 
                        -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
                       )
                       
-add_executable(srs_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(srs_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/srs_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(srs_test 
                        -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
                       )
                       
-add_executable(pbch_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(pbch_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(pbch_test 
                       -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
                       )
 
-add_executable(pucch_uci_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c ${SRC_UNIT_TESTS} ${INC_UNIT_TESTS})
+add_executable(pucch_uci_test ${OPENAIR1_DIR}/SIMULATION/NR_UE_PHY/unit_tests/src/pucch_uci_test.c ${SRC_UNIT_TESTS} )
 target_link_libraries(pucch_uci_test 
                        -Wl,--start-group UTIL SCHED_NR_UE_LIB PHY PHY_COMMON PHY_UE PHY_NR_UE -Wl,--end-group
                       pthread m ${ATLAS_LIBRARIES}
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
index ef76a03401..b6aee84cec 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/dummy_functions.c
@@ -111,7 +111,7 @@ void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
 		     uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index,
 		     uint8_t sync_area){}
 
-int ue_query_mch(uint8_t Mod_id, uint8_t CC_id, uint32_t frame,
+int ue_query_mch(module_id_t Mod_id, uint8_t CC_id, uint32_t frame,
 		 sub_frame_t subframe, uint8_t eNB_index,
 		 uint8_t * sync_area, uint8_t * mcch_active){ return(0);}
 
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c
index 6e7f8a3e5a..f1913f0371 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pbch_test.c
@@ -101,7 +101,7 @@ int test_synchro_pss_sss_nr(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, in
   int rate_change = SYNCHRO_RATE_CHANGE_FACTOR;
   int decoded_pbch = -1;
 
-  set_sequence_pss(PHY_vars_UE, position_symbol, pss_sequence_number, INVALID_PSS_SEQUENCE);
+  set_sequence_pss(PHY_vars_UE, position_symbol, pss_sequence_number);
 
   synchro_position = pss_synchro_nr(PHY_vars_UE, rate_change);
 
@@ -311,7 +311,7 @@ int test_synchro_pss_sss(PHY_VARS_NR_UE *PHY_vars_UE, int position_symbol, int s
     exit(0);
   }
 
-  set_sequence_pss(PHY_vars_UE, position_symbol, sequence_number, sequence_number);
+  set_sequence_pss(PHY_vars_UE, position_symbol, sequence_number);
 
   synchro_position = pss_synchro_nr(PHY_vars_UE, rate_change);
 
diff --git a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
index 990a277a38..1531a82314 100644
--- a/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
+++ b/openair1/SIMULATION/NR_UE_PHY/unit_tests/src/pss_util_test.c
@@ -59,6 +59,8 @@
 #include "../../unit_tests/src/input_buffer_test.h"
 #undef DEFINE_VARIABLES_INPUT_BUFFER_TEST_H
 
+#include "common/utils/LOG/log.h"
+
 /************** DEFINE *******************************************/
 
 /*************** LOCAL VARIABLES***********************************/
@@ -213,13 +215,13 @@ int init_test(unsigned char N_tx, unsigned char N_rx, unsigned char transmission
   (void) transmission_mode;
   NR_DL_FRAME_PARMS *frame_parms;
 
-  int log_level = LOG_TRACE;
+  int log_level = OAILOG_TRACE;
 
   logInit();
 
   // enable these lines if you need debug info
-  set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1);
-  set_glog(log_level,LOG_HIGH);
+  //set_comp_log(PHY,LOG_DEBUG,LOG_HIGH,1);
+  set_glog(log_level);
 
 #ifndef NR_UNIT_TEST
 
-- 
2.26.2