Commit 4b7dda33 authored by Rohit Gupta's avatar Rohit Gupta

Merge branch 'feature-34-test_framework' into develop

parents 23bb81d2 1c0a59ff
......@@ -88,7 +88,22 @@ Obj.# Case# Test# Description
01 51 06 mbmssim (TBD)
01 55 lte-softmodem tests
01 55 lte-softmodem tests with ALU EPC w/ Bandrich COTS UE
01 55 00 FDD 5MHz UL Throughput for 60 sec
01 55 00 FDD 10MHz UL Throughput for 60 sec
01 55 00 FDD 20MHz UL Throughput for 60 sec
01 55 00 FDD 5MHz DL Throughput for 60 sec
01 55 00 FDD 10MHz DL Throughput for 60 sec
01 55 00 FDD 20MHz DL Throughput for 60 sec
01 56 lte-softmodem tests with OAI EPC (eNB and EPC are on same machines) w/ Bandrich COTS UE
01 57 lte-softmodem tests with OAI EPC (eNB and EPC are on different machines) w/ Bandrich COTS UE
01 58 lte-softmodem-noS1 tests
02 Functional test case
......
......@@ -7,12 +7,15 @@ else
exit 1
fi
trap handle_ctrl_c INT
source $OPENAIR_DIR/cmake_targets/tools/test_helper
#SUDO="sudo -E "
tdir=$OPENAIR_DIR/cmake_targets/autotests
rm -fr $tdir/bin $tdir/log
mkdir -p $tdir/bin $tdir/log
rm -fr $tdir/bin
mkdir -p $tdir/bin
results_file="$tdir/log/results_autotests.xml"
updated=$(svn st -q $OPENAIR_DIR)
......@@ -36,7 +39,7 @@ cd $tdir
#\param $12 -> class of the test case (compilation, execution)
#\param $13 -> output of compilation program that needs to be found for test case to pass
#\param $14 -> tags to help identify the test case for readability in output xml file
test_compile() {
function test_compile() {
xUnit_start
test_case_name=$1
......@@ -130,8 +133,9 @@ test_compile() {
#\param $12 -> class of the test case (compilation, execution)
#\param $13 -> output of compilation program that needs to be found for test case to pass
#\param $14 -> tags to help identify the test case for readability in output xml file
#\param $15 => password for the user to run certain commands as sudo
test_compile_and_run() {
function test_compile_and_run() {
xUnit_start
test_case_name=$1
log_dir=$tdir/log
......@@ -149,16 +153,13 @@ test_compile_and_run() {
class=${12}
compile_prog_out=${13}
tags=${14}
mypassword=${15}
build_dir=$tdir/$1/build
exec_file=$build_dir/$6
#Temporary log file where execution log is stored.
temp_exec_log=$log_dir/temp_log.txt
#echo "log_dir = $log_dir"
#echo "log_file = $log_file"
#echo "exec_file = $exec_file"
......@@ -217,7 +218,8 @@ test_compile_and_run() {
echo "<EXECUTION LOG Run = $run_index >" >> $log_file 2>&1
if [ -n "$pre_exec_file" ]; then
{ eval "source $pre_exec_file $pre_exec_args"; } >> $log_file 2>&1
{ eval " echo '$mypassword' |sudo -S -E $pre_exec_file $pre_exec_args " ; }>> $log_file 2>&1
fi
echo "Executing $exec_file $main_exec_args_array_index "
echo "Executing $exec_file $main_exec_args_array_index " >> $log_file
......@@ -275,34 +277,14 @@ test_compile_and_run() {
let "tags_array_index++"
done # End of for loop (nindex)
fi
rm -fr $build_dir
}
dbin=$OPENAIR_DIR/cmake_targets/autotests/bin
dlog=$OPENAIR_DIR/cmake_targets/autotests/log
run_test() {
case=case$1; shift
cmd=$1; shift
expected=$3; shift
echo "expected = $expected"
exit
$cmd > $dlog/$case.txt 2>&1
if [ $expected = "true" ] ; then
if $* $dlog/$case.txt; then
echo_success "test $case, command: $cmd ok"
else
echo_error "test $case, command: $cmd Failed"
fi
else
if $* $dlog/$case.txt; then
echo_error "test $case, command: $cmd Failed"
else
echo_success "test $case, command: $cmd ok"
fi
fi
}
print_help() {
function print_help() {
echo_info '
This program runs automated test case system for OpenAirInterface
You should have ubuntu 14.xx, updated, and the Linux kernel >= 3.14
......@@ -314,11 +296,13 @@ Options
'
}
main () {
function main () {
RUN_GROUP=0
test_case_group=""
test_case_group_array=()
test_case_array=()
echo_info "Note that the user should be sudoer for executing certain commands, for example loading kernel modules"
read -s -p "Enter Password: " mypassword
until [ -z "$1" ]
do
......@@ -421,9 +405,9 @@ for search_expr in "${test_case_array[@]}"
if [ "$class" == "compilation" ]; then
test_compile "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags"
elif [ "$class" == "execution" ]; then
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags"
test_compile_and_run "$name" "$compile_prog" "$compile_prog_args" "$pre_exec" "$pre_exec_args" "$main_exec" "$main_exec_args" "search_array_true[@]" "$search_expr_false" "$nruns" "$pre_compile_prog" "$class" "$compile_prog_out" "$tags" "$mypassword"
else
echo "Unexpected class of test case...Exiting...."
echo "Unexpected class of test case...Skipping the test case $name ...."
fi
done
......
This diff is collapsed.
This diff is collapsed.
#!/usr/bin/python
import time
import serial
import os
from pyroute2 import IPRoute
import sys
import re
import threading
import signal
import traceback
import os
# configure the serial connections (the parameters differs on the device you are connecting to)
#First we find an open port to work with
serial_port=''
ser=serial.Serial()
def find_open_port():
global serial_port, ser
max_ports=100
if os.path.exists(serial_port) == True:
return serial_port
for port in range(2,100):
serial_port = '/dev/ttyUSB'+str(port)
if os.path.exists(serial_port) == True:
print 'New Serial Port : ' + serial_port
break
ser = serial.Serial(port=serial_port)
return
find_open_port()
print 'Using Serial port : ' + serial_port
#serial_port = '/dev/ttyUSB2'
bandrich_ppd_config = '$OPENAIR_DIR/cmake_targets/autotests/tools/wdial.bandrich.conf'
exit_flag=0
def signal_handler(signal, frame):
print('You pressed Ctrl+C!')
print('Resetting the UE to detached state')
timeout=10
exit_flag=1
send_command('AT+CGATT=0' , 'OK' , timeout)
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
#ser.open()
#ser.isOpen()
class pppThread (threading.Thread):
def __init__(self, threadID, name, counter):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
def run(self):
print "Starting " + self.name
#Here we keep running pppd thread in indefinite loop as this script terminates sometimes
#while 1:
while 1:
time.sleep(5) #Hard coded, do not reduce this number!
print "Starting wvdial now..."
print 'exit_flag = ' + str(exit_flag)
send_command('AT+CGATT=1','OK', 300)
os.system('wvdial -C ' + bandrich_ppd_config + '' )
if exit_flag == 1:
print "Exit flag set to true. Exiting pppThread now"
print "Terminating wvdial now..."
def send_command (cmd, response, timeout):
count=0
sleep_duration = 1
print 'In function: send_command: cmd = <' + cmd + '> response: <' + response + '> \n'
global serial_port, ser
while count <= timeout:
try:
#Sometimes the port does not exist coz of reset in modem.
#In that case, we need to search for this port again
if os.path.exists(serial_port) == False:
find_open_port()
ser.write (cmd + '\r\n')
out = ''
time.sleep(sleep_duration)
count = count + sleep_duration
while ser.inWaiting() > 0:
out += ser.read(1)
print 'out = <' + out + '> response = <' + response + '> \n'
if re.search(response, out):
break
except Exception, e:
error = ' cmd : ' + cmd + ' response : ' + response
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc()
print error
def start_ue () :
#print 'Enter your commands below.\r\nInsert "exit" to leave the application.'
timeout=60 #timeout in seconds
send_command('AT', 'OK' , timeout)
send_command('AT+CGATT=0' , 'OK' , timeout)
send_command('AT+CGATT=1','OK', 300)
#os.system('wvdial -C ' + bandrich_ppd_config + ' &' )
thread_ppp = pppThread(1, "ppp_thread", 1)
thread_ppp.start()
iface='ppp0'
while 1:
time.sleep ( 2)
#Now we check if ppp0 interface is up and running
try:
if exit_flag == 1:
break
ip = IPRoute()
idx = ip.link_lookup(ifname=iface)[0]
os.system ('route add 192.172.0.1 ppp0')
break
except Exception, e:
error = ' Interface ' + iface + 'does not exist...'
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + traceback.format_exc()
print error
thread_ppp.join()
def stop_ue():
timeout=60
os.system('killall wvdial')
send_command('AT', 'OK' , timeout)
send_command('AT+CGATT=0' , 'OK' , timeout)
for arg in sys.argv[1:]:
if arg == '--start-ue' :
start_ue()
elif arg == '--stop-ue' :
stop_ue()
else :
print " Script called with wrong arguments, arg = " + arg
sys.exit()
#!/usr/bin/python
import sys
import re
#Arg 1 name of file
#Arg 2 keyword
#arg 3 replacement text
#Note that these should be seperated by spaces
if len(sys.argv) != 4:
print "search_repl.py: Wrong number of arguments. This program needs 3 arguments"
sys.exit()
filename = sys.argv[1]
keyword = sys.argv[2]
replacement_text = sys.argv[3]
file = open(filename, 'r')
string = file.read()
file.close()
if keyword == 'mme_ip_address':
#string = (re.sub(r"mme_ip_address\s*=\s*\([^\$]+)\)\s*;\s*", r"<% tex \1 %>", t, re.M)
replacement_text = keyword + ' = ( { ' + replacement_text + ' } ) ; '
string = re.sub(r"mme_ip_address\s*=\s*\(([^\$]+?)\)\s*;", replacement_text, string, re.M)
else :
replacement_text = keyword + ' = ' + replacement_text + ' ; '
string = re.sub(r"%s\s*=\s*([^\$]+?)\s*;" % keyword , replacement_text, string, re.M)
#else :
# replacement_text = keyword + ' =\"' + replacement_text + '\" ; '
# string = re.sub(r"%s\s*=\s*\"([^\$]+?)\"\s*;" % keyword , replacement_text, string, re.M)
file = open(filename, 'w')
file.write(string)
file.close()
[Dialer Defaults]
Modem = /dev/ttyUSB0
ISDN = off
Modem Type = Analog Modem
Baud = 9600
Init = ATZ
Init2 = AT+CPIN?
Init3 = AT+CGREG?
Init4 = AT+COPS?
Init5 = AT+CSQ
Init6 =
Init7 = AT+CGATT=1
Init8 =
Init9 =
Phone = *99***1#
Phone1 =
Phone2 =
Phone3 =
Phone4 =
Dial Prefix =
Dial Attempts = 1
Dial Command = ATM1L3DT
Ask Password = off
Password = ''
Username = ImaginLab
Auto Reconnect = off
Abort on Busy = off
Carrier Check = on
Check Def Route = on
Abort on No Dialtone = on
Stupid Mode = on
Idle Seconds = 0
Auto DNS = on
;Minimize = off
;Dock = off
;Do NOT edit this file by hand!
......@@ -54,6 +54,8 @@ CFLAGS_PROCESSOR_USER=""
RUN_GROUP=0
TEST_CASE_GROUP=""
trap handle_ctrl_c INT
function print_help() {
echo_info '
This program installs OpenAirInterface Software
......@@ -80,8 +82,6 @@ Options
Makes the LTE softmodem
--UE
Makes the UE specific parts (ue_ip, usim, nvram)
--EPC
Makes the EPC (MME-SPGW, HSS)
--RRH
Makes the RRH
-r | --3gpp-release
......@@ -116,8 +116,8 @@ Options
Usage (first build):
oaisim (eNB + UE): ./build_oai -I -g --oaisim -x --install-system-files
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB --EPC -x --install-system-files -w USRP
Eurecom EXMIMO + COTS UE : ./build_oai -I -g --eNB -x --install-system-files
NI/ETTUS B201 + COTS UE : ./build_oai -I -g --eNB -x --install-system-files -w USRP
Usage (Regular):
oaisim : ./build_oai --oaisim -x
Eurecom EXMIMO + OAI ENB : ./build_oai --eNB -x
......@@ -159,10 +159,6 @@ function main() {
UE=1
echo_info "Will compile UE"
shift;;
--EPC)
EPC=1
echo_info "Will compile EPC"
shift;;
--RRH)
RRH=1
echo_info "Will compile RRH"
......@@ -416,7 +412,7 @@ function main() {
# EXMIMO drivers & firmware loader
###############
if [ "$HW" = "EXMIMO" -a "$EPC" = "0" ] ; then
if [ "$HW" = "EXMIMO" ] ; then
echo_info "Compiling Express MIMO 2 board drivers"
compilations \
......@@ -554,42 +550,24 @@ function main() {
rrh_gw $dbin/rrh_gw
fi
# EPC compilation
##################
if [ "$EPC" = "1" ] ; then
echo_info "Compiling EPC"
# Example HSS and EPC run on the same host
if [ "$CLEAN" = "1" ]; then
$OPENAIR_DIR/cmake_targets/tools/build_epc --clean --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
$OPENAIR_DIR/cmake_targets/tools/build_hss --clean --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
else
$OPENAIR_DIR/cmake_targets/tools/build_epc --debug --transport-tcp-only --transport-prefer-tcp --s6a-server
$OPENAIR_DIR/cmake_targets/tools/build_hss --debug --transport-tcp-only --transport-prefer-tcp --fqdn `hostname --fqdn` --connect-to-mme `hostname --fqdn`
fi
# if [ "$INSTALL_SYSTEM_FILES" = "1" ] ;then
# if [ -f $dbin/hss.conf ] ; then
# sed -e 's/ *= */=/' $dbin/hss.conf > $dconf/hss.conf.nospace
# source $dconf/hss.conf.nospace
# rm -f $dconf/hss.conf.nospace
# create_hss_database root linux "$MYSQL_user" "$MYSQL_pass" "$MYSQL_db"
# else
# echo_warning "not created HSS database: config not found"
# fi
# fi
fi
# Auto-tests
#####################
if [ "$OAI_TEST" = "1" ]; then
echo_info "10. Running OAI pre commit tests (pre-ci) ..."
read -s -p "Enter Password: " mypassword
echo -e "\n"
echo_info "The log file for the autotest script for debugging is located here: $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log "
echo_info "The results of autotests results is located here: $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
echo_info "You can hit CTRL-C any time to terminate the autotests..."
rm -fr $OPENAIR_DIR/cmake_targets/autotests/log
mkdir -p $OPENAIR_DIR/cmake_targets/autotests/log
if [ "$RUN_GROUP" -eq "1" ]; then
$SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP"
echo '$mypassword' | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash -g "$TEST_CASE_GROUP" >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
else
$SUDO $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash
echo '$mypassword' | $OPENAIR_DIR/cmake_targets/autotests/run_exec_autotests.bash >& $OPENAIR_DIR/cmake_targets/autotests/log/autotests.log &
fi
wait
else
echo_info "10. Bypassing the Tests ..."
fi
......
......@@ -255,7 +255,10 @@ check_install_oai_software() {
openssl \
python \
subversion \
xmlstarlet
xmlstarlet \
python-pip \
pydb \
wvdial
$SUDO update-alternatives --set liblapack.so /usr/lib/atlas-base/atlas/liblapack.so
if [ `lsb_release -rs` = '12.04' ] ; then
install_nettle_from_source
......@@ -263,6 +266,8 @@ check_install_oai_software() {
else
$SUDO apt-get install -y libgnutls-dev nettle-dev nettle-bin
fi
$SUDO pip install paramiko
$SUDO pip install pyroute2
install_asn1c_from_source
}
......@@ -319,3 +324,42 @@ set_openair_env(){
export OPENAIR_TARGETS=$openair_path/targets
}
################################
# Function to killall the subprocesses when Ctrl-C Key is hit
###############################
function handle_ctrl_c(){
CURPID=$$
ppid=$$
arraycounter=1
echo_info "** Trapped CTRL-C. Killing all subprocesses now..."
while true
do
FORLOOP=FALSE
# Get all the child process id
for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'`
do
if [ $i -ne $CURPID ] ; then
procid[$arraycounter]=$i
arraycounter=`expr $arraycounter + 1`
ppid=$i
FORLOOP=TRUE
fi
done
if [ "$FORLOOP" = "FALSE" ] ; then
arraycounter=`expr $arraycounter - 1`
## We want to kill child process id first and then parent id's
while [ $arraycounter -ne 0 ]
do
echo "first we send ctrl-c to program"
$SUDO kill -INT "${procid[$arraycounter]}"
sleep 5
echo "Now we force kill if that didn't work"
$SUDO kill -9 "${procid[$arraycounter]}" >/dev/null
arraycounter=`expr $arraycounter - 1`
done
exit
fi
done
}
File mode changed from 100644 to 100755
......@@ -68,7 +68,7 @@ declare MAX_RATE=1000
# set paths to the required binaries and check if the required binaries are available
ENB_CONFIG=$OPENAIR_DIR/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.generic.oaisim.local_no_mme.conf
OAISIM_EXEC=$OPENAIR_DIR/targets/bin/oaisim_nos1
OAISIM_EXEC=$OPENAIR_DIR/cmake_targets/oaisim_noS1_build_oai/build/oaisim_nos1
BYPASSE_ITTI=0
OTGPLOT="$OPENAIR2_DIR/UTIL/OTG/OTGplot"
PS2PDF="ps2pdf"
......@@ -301,8 +301,8 @@ oaisim_otg_stats(){
sync
if [ ! -f $OAISIM_EXEC ]; then
echo_info "3.1 compiling OAISIM ($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c)"
($OPENAIR_TARGETS/cmake_targets/build_oai --oaisim -c >> results/perf_log.txt 2>&1 )
echo_info "3.1 compiling OAISIM ($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1)"
($OPENAIR_DIR/cmake_targets/build_oai --oaisim -c --noS1 >> results/perf_log.txt 2>&1 )
build_stats=$?
if [ $build_stats != 0 ] ; then
echo_error "$OAISIM_EXEC cannot be built, check results/perf_log.txt file"
......
......@@ -583,6 +583,10 @@ int main(int argc, char **argv)
sprintf(bler_fname,"ULbler_mcs%d_nrb%d_ChannelModel%d_nsim%d.csv",mcs,nb_rb,chMod,n_frames);
bler_fd = fopen(bler_fname,"w");
if (bler_fd==NULL) {
fprintf(stderr,"Problem creating file %s\n",bler_fname);
exit(-1);
}
fprintf(bler_fd,"#SNR;mcs;nb_rb;TBS;rate;errors[0];trials[0];errors[1];trials[1];errors[2];trials[2];errors[3];trials[3]\n");
......@@ -591,13 +595,16 @@ int main(int argc, char **argv)
hostname[1023] = '\0';
gethostname(hostname, 1023);
printf("Hostname: %s\n", hostname);
char dirname[FILENAME_MAX];
sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname);
mkdir(dirname, 0777);
sprintf(time_meas_fname,"%s/time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
dirname,
//char dirname[FILENAME_MAX];
//sprintf(dirname, "%s//SIMU/USER/pre-ci-logs-%s", getenv("OPENAIR_TARGETS"),hostname);
//mkdir(dirname, 0777);
sprintf(time_meas_fname,"time_meas_prb%d_mcs%d_antrx%d_channel%s_tx%d.csv",
N_RB_DL,mcs,n_rx,channel_model_input,transmission_mode);
time_meas_fd = fopen(time_meas_fname,"w");
if (time_meas_fd==NULL) {
fprintf(stderr,"Cannot create file %s!\n",time_meas_fname);
exit(-1);
}
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment