fix cpu cost in phy simulation with sanitize addr, some code un-obfuscation
This commit is contained in:
committed by
Roberto Louro Magueta
parent
d9660677c4
commit
2d46638aa1
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
#set -xv
|
||||||
#/*
|
#/*
|
||||||
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||||
# * contributor license agreements. See the NOTICE file distributed with
|
# * contributor license agreements. See the NOTICE file distributed with
|
||||||
@@ -92,78 +93,55 @@ function test_run() {
|
|||||||
tags_array_index=0
|
tags_array_index=0
|
||||||
for main_exec_args_array_index in "${main_exec_args_array[@]}"
|
for main_exec_args_array_index in "${main_exec_args_array[@]}"
|
||||||
do
|
do
|
||||||
global_result=1
|
global_result=PASS
|
||||||
result_string=""
|
result_string=""
|
||||||
PROPER_DESC=`echo ${desc_array[$tags_array_index]} | sed -e "s@^.*Test cases.*(Test@Test@" -e "s@^ *(@@" -e"s/)$//" -e "s/),$//"`
|
PROPER_DESC=`echo ${desc_array[$tags_array_index]} | sed -e "s@^.*Test cases.*(Test@Test@" -e "s@^ *(@@" -e"s/)$//" -e "s/),$//"`
|
||||||
echo_info "$PROPER_DESC"
|
echo_info "$PROPER_DESC"
|
||||||
|
|
||||||
for (( run_index=1; run_index <= $nruns; run_index++ ))
|
for (( run_index=1; run_index <= $nruns; run_index++ ))
|
||||||
do
|
do
|
||||||
temp_exec_log=$log_dir/test.$test_case_name.${tags_array[$tags_array_index]}.run_$run_index
|
temp_exec_log="$log_dir/test.$test_case_name.${tags_array[$tags_array_index]}.run_$run_index"
|
||||||
echo "" > $temp_exec_log
|
|
||||||
|
|
||||||
echo "Executing test case $test_case_name.${tags_array[$tags_array_index]}, Run Index = $run_index, Execution Log file = $temp_exec_log"
|
echo "Executing test case $test_case_name.${tags_array[$tags_array_index]}, Run Index = $run_index, Execution Log file = $temp_exec_log"
|
||||||
|
|
||||||
echo "-----------------------------------------------------------------------------" >> $temp_exec_log 2>&1
|
echo "-----------------------------------------------------------------------------" > "$temp_exec_log"
|
||||||
echo "<EXECUTION LOG Test Case = $test_case_name.${tags_array[$tags_array_index]}, Run = $run_index >" >> $temp_exec_log 2>&1
|
echo "<EXECUTION LOG Test Case = $test_case_name.${tags_array[$tags_array_index]}, Run = $run_index >" >> "$temp_exec_log"
|
||||||
echo "Executing $main_exec $main_exec_args_array_index " | tee $temp_exec_log
|
echo "Executing $main_exec $main_exec_args_array_index " >> "$temp_exec_log"
|
||||||
{ uname -a ; eval "$main_exec $main_exec_args_array_index" ;} >> $temp_exec_log 2>&1
|
uname -a >> "$temp_exec_log"
|
||||||
|
"$main_exec" $main_exec_args_array_index >> "$temp_exec_log" 2>&1
|
||||||
|
|
||||||
echo "</EXECUTION LOG Test Case = $test_case_name.${tags_array[$tags_array_index]}, Run = $run_index >" >> $temp_exec_log 2>&1
|
echo "</EXECUTION LOG Test Case = $test_case_name.${tags_array[$tags_array_index]}, Run = $run_index >" >> $temp_exec_log 2>&1
|
||||||
cat $temp_exec_log >> $log_file 2>&1
|
cat $temp_exec_log >> $log_file 2>&1
|
||||||
|
|
||||||
|
|
||||||
result=1
|
result=PASS
|
||||||
for search_expr in "${search_expr_array[@]}"
|
for search_expr in "${search_expr_array[@]}"
|
||||||
do
|
do
|
||||||
|
grep -Eq "$search_expr" $temp_exec_log || result=FAIL
|
||||||
search_result=`grep -E "$search_expr" $temp_exec_log`
|
|
||||||
|
|
||||||
if [ -z "$search_result" ]; then
|
|
||||||
let "result = result & 0"
|
|
||||||
else
|
|
||||||
let "result = result & 1"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
#If we find a negative search result then there is crash of program and test case is failed even if above condition is true
|
#If we find a negative search result then there is crash of program and test case is failed even if above condition is true
|
||||||
search_result=`grep -iE "$search_expr_negative" $temp_exec_log`
|
grep -q -iE "$search_expr_negative" $temp_exec_log && result=FAIL
|
||||||
if [ -n "$search_result" ]; then
|
|
||||||
result=0
|
if [ "$result" != PASS ]; then
|
||||||
fi
|
|
||||||
let "global_result = global_result & result"
|
|
||||||
|
|
||||||
#echo "result = $result"
|
|
||||||
|
|
||||||
if [ "$result" -eq "0" ]; then
|
|
||||||
result_string=$result_string" Run_$run_index =FAIL"
|
|
||||||
echo_error "$test_case_name.${tags_array[$tags_array_index]} RUN = $run_index Result = FAIL"
|
echo_error "$test_case_name.${tags_array[$tags_array_index]} RUN = $run_index Result = FAIL"
|
||||||
fi
|
else
|
||||||
|
|
||||||
if [ "$result" -eq "1" ]; then
|
|
||||||
result_string=$result_string" Run_$run_index =PASS"
|
|
||||||
echo_success "$test_case_name.${tags_array[$tags_array_index]} RUN = $run_index Result = PASS"
|
echo_success "$test_case_name.${tags_array[$tags_array_index]} RUN = $run_index Result = PASS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
result_string=$result_string" Run_$run_index =$result"
|
||||||
|
if [ $result != PASS ] ; then
|
||||||
|
global_result = FAIL
|
||||||
|
fi
|
||||||
|
|
||||||
done #End of for loop (nindex)
|
done #End of for loop (nindex)
|
||||||
|
|
||||||
echo " Result String = $result_string"
|
if [ "$global_result" != PASS ]; then
|
||||||
|
|
||||||
if [ "$result_string" == "" ]; then
|
|
||||||
echo_error "execution $test_case_name.${tags_array[$tags_array_index]} {$PROPER_DESC} Run_Result = \"$result_string\" Result = FAIL"
|
|
||||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
|
||||||
else
|
|
||||||
if [ "$global_result" == "0" ]; then
|
|
||||||
echo_error "execution $test_case_name.${tags_array[$tags_array_index]} {$PROPER_DESC} Run_Result = \"$result_string\" Result = FAIL"
|
echo_error "execution $test_case_name.${tags_array[$tags_array_index]} {$PROPER_DESC} Run_Result = \"$result_string\" Result = FAIL"
|
||||||
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
xUnit_fail "execution" "$test_case_name.${tags_array[$tags_array_index]}" "FAIL" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
||||||
fi
|
else
|
||||||
|
|
||||||
if [ "$global_result" == "1" ]; then
|
|
||||||
echo_success "execution $test_case_name.${tags_array[$tags_array_index]} {$PROPER_DESC} Run_Result = \"$result_string\" Result = PASS "
|
echo_success "execution $test_case_name.${tags_array[$tags_array_index]} {$PROPER_DESC} Run_Result = \"$result_string\" Result = PASS "
|
||||||
xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
xUnit_success "execution" "$test_case_name.${tags_array[$tags_array_index]}" "PASS" "$result_string" "$xmlfile_testcase" "$PROPER_DESC"
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
let "tags_array_index++"
|
let "tags_array_index++"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ uint8_t multipath_channel_nosigconv(channel_desc_t *desc)
|
|||||||
|
|
||||||
//#define CHANNEL_SSE
|
//#define CHANNEL_SSE
|
||||||
#ifdef CHANNEL_SSE
|
#ifdef CHANNEL_SSE
|
||||||
void multipath_channel(channel_desc_t *desc,
|
void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *desc,
|
||||||
double tx_sig_re[NB_ANTENNAS_TX][30720*2],
|
double tx_sig_re[NB_ANTENNAS_TX][30720*2],
|
||||||
double tx_sig_im[NB_ANTENANS_TX][30720*2],
|
double tx_sig_im[NB_ANTENANS_TX][30720*2],
|
||||||
double rx_sig_re[NB_ANTENNAS_RX][30720*2],
|
double rx_sig_re[NB_ANTENNAS_RX][30720*2],
|
||||||
@@ -170,7 +170,7 @@ void add_noise(c16_t **rxdata,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void multipath_channel(channel_desc_t *desc,
|
void __attribute__ ((no_sanitize_address)) multipath_channel(channel_desc_t *desc,
|
||||||
double *tx_sig_re[NB_ANTENNAS_TX],
|
double *tx_sig_re[NB_ANTENNAS_TX],
|
||||||
double *tx_sig_im[NB_ANTENNAS_TX],
|
double *tx_sig_im[NB_ANTENNAS_TX],
|
||||||
double *rx_sig_re[NB_ANTENNAS_RX],
|
double *rx_sig_re[NB_ANTENNAS_RX],
|
||||||
@@ -180,9 +180,6 @@ void multipath_channel(channel_desc_t *desc,
|
|||||||
int log_channel)
|
int log_channel)
|
||||||
{
|
{
|
||||||
|
|
||||||
int i,ii,j,l;
|
|
||||||
struct complexd rx_tmp,tx;
|
|
||||||
|
|
||||||
double path_loss = pow(10,desc->path_loss_dB/20);
|
double path_loss = pow(10,desc->path_loss_dB/20);
|
||||||
int dd;
|
int dd;
|
||||||
dd = abs(desc->channel_offset);
|
dd = abs(desc->channel_offset);
|
||||||
@@ -204,29 +201,24 @@ void multipath_channel(channel_desc_t *desc,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i=0; i<((int)length-dd); i++) {
|
for (int i=0; i<((int)length-dd); i++) {
|
||||||
for (ii=0; ii<desc->nb_rx; ii++) {
|
for (int ii=0; ii<desc->nb_rx; ii++) {
|
||||||
rx_tmp.r = 0;
|
struct complexd rx_tmp={0};
|
||||||
rx_tmp.i = 0;
|
for (int j=0; j<desc->nb_tx; j++) {
|
||||||
|
struct complexd *chan=desc->ch[ii+(j*desc->nb_rx)];
|
||||||
for (j=0; j<desc->nb_tx; j++) {
|
for (int l = 0; l<(int)desc->channel_length; l++) {
|
||||||
for (l = 0; l<(int)desc->channel_length; l++) {
|
|
||||||
if ((i>=0) && (i-l)>=0) {
|
if ((i>=0) && (i-l)>=0) {
|
||||||
|
struct complexd tx;
|
||||||
tx.r = tx_sig_re[j][i-l];
|
tx.r = tx_sig_re[j][i-l];
|
||||||
tx.i = tx_sig_im[j][i-l];
|
tx.i = tx_sig_im[j][i-l];
|
||||||
} else {
|
rx_tmp.r += (tx.r * chan[l].r) - (tx.i * chan[l].i);
|
||||||
tx.r =0;
|
rx_tmp.i += (tx.i * chan[l].r) + (tx.r * chan[l].i);
|
||||||
tx.i =0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rx_tmp.r += (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].r) - (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].i);
|
|
||||||
rx_tmp.i += (tx.i * desc->ch[ii+(j*desc->nb_rx)][l].r) + (tx.r * desc->ch[ii+(j*desc->nb_rx)][l].i);
|
|
||||||
|
|
||||||
if (i==0 && log_channel == 1) {
|
if (i==0 && log_channel == 1) {
|
||||||
printf("channel[%d][%d][%d] = %f dB \t(%e, %e)\n",
|
printf("channel[%d][%d][%d] = %f dB \t(%e, %e)\n",
|
||||||
ii, j, l, 10*log10(pow(desc->ch[ii+(j*desc->nb_rx)][l].r,2.0)+pow(desc->ch[ii+(j*desc->nb_rx)][l].i,2.0)),
|
ii, j, l, 10*log10(pow(chan[l].r,2.0)+pow(chan[l].i,2.0)),
|
||||||
desc->ch[ii+(j*desc->nb_rx)][l].r,
|
chan[l].r,
|
||||||
desc->ch[ii+(j*desc->nb_rx)][l].i);
|
chan[l].i);
|
||||||
}
|
}
|
||||||
} //l
|
} //l
|
||||||
} // j
|
} // j
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ double uniformrandom(void)
|
|||||||
|
|
||||||
/*!\brief Gaussian random number generator based on modified Box-Muller transformation.Returns a double-precision floating-point number. */
|
/*!\brief Gaussian random number generator based on modified Box-Muller transformation.Returns a double-precision floating-point number. */
|
||||||
|
|
||||||
double gaussdouble(double mean, double variance)
|
double __attribute__ ((no_sanitize_address)) gaussdouble(double mean, double variance)
|
||||||
{
|
{
|
||||||
static int iset=0;
|
static int iset=0;
|
||||||
static double gset;
|
static double gset;
|
||||||
@@ -175,7 +175,7 @@ void tableNor(unsigned long seed)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double gaussZiggurat(double mean, double variance)
|
double __attribute__ ((no_sanitize_address)) gaussZiggurat(double mean, double variance)
|
||||||
{
|
{
|
||||||
hz = SHR3;
|
hz = SHR3;
|
||||||
iz = hz & 127;
|
iz = hz & 127;
|
||||||
|
|||||||
Reference in New Issue
Block a user