Commit 8073aefe authored by knopp's avatar knopp
Browse files

applied patches from S. Held, addition of scansim.c and PHY files for UE band scanning

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6475 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 2ff16039
......@@ -51,6 +51,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '00'
name = 'Perf oai.dlsim.sanity'
conf = '-a -A AWGN -n 100'
......@@ -71,6 +72,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '01'
name = 'Perf oai.dlsim.test1'
diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
......@@ -99,6 +101,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
# log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06'
name = 'Perf oai.dlsim.test6'
diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
......@@ -113,6 +116,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06b'
name = 'Perf oai.dlsim.test6b'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
......@@ -127,6 +131,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '07'
name = 'Perf oai.dlsim.test7'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
......@@ -142,6 +147,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
try:
log.start()
test = '07b'
name = 'Perf oai.dlsim.test7b'
diag = 'Test 7b, 5 MHz, R3-1.FDD (MCS 15), ETU70, 1.4 dB (30%)'
......@@ -156,6 +162,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10'
name = 'Perf oai.dlsim.test10'
diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
......@@ -170,6 +177,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10b'
name = 'Perf oai.dlsim.test10b'
diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
......@@ -184,6 +192,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '11'
name = 'Perf oai.dlsim.test11'
diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
......
......@@ -51,6 +51,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '00'
name = 'Perf oai.dlsim.sanity'
conf = '-a -A AWGN -n 100'
......@@ -71,6 +72,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '01'
name = 'Perf oai.ulsim.test1'
diag = 'Test 1, 10 MHz, R2.FDD (MCS 5), EVA5, -1dB'
......@@ -86,6 +88,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06'
name = 'Perf oai.ulsim.test5'
diag = 'Test 5, 1.4 MHz, R4.FDD (MCS 4), EVA5, 0dB (70%)'
......@@ -101,6 +104,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06'
name = 'Perf oai.ulsim.test6'
diag = 'Test 6, 10 MHz, R3.FDD (MCS 15), EVA5, 6.7dB (70%)'
......@@ -116,6 +120,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '06b'
name = 'Perf oai.ulsim.test6b'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (70%)'
......@@ -131,6 +136,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '07'
name = 'Perf oai.ulsim.test7'
diag = 'Test 6b, 5 MHz, R3-1.FDD (MCS 15), EVA5, 6.7dB (30%)'
......@@ -146,6 +152,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10'
name = 'Perf oai.ulsim.test10'
diag = 'Test 10, 5 MHz, R6.FDD (MCS 25), EVA5, 17.4 dB (70%)'
......@@ -161,6 +168,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '10b'
name = 'Perf oai.ulsim.test10b'
diag = 'Test 10b, 5 MHz, R6-1.FDD (MCS 24,18 PRB), EVA5, 17.5dB (70%)'
......@@ -176,6 +184,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '11'
name = 'Perf oai.ulsim.test11'
diag = 'Test 11, 10 MHz, R7.FDD (MCS 25), EVA5, 17.7dB (70%)'
......
......@@ -50,6 +50,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '01'
name = 'Compile oai.rel8.phy.dlsim.make'
conf = 'make dlsim' # PERFECT_CE=1 # for perfect channel estimation
......@@ -68,6 +69,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = '02'
name = 'Compile oai.rel8.phy.ulsim.make'
conf = 'make ulsim'
......
......@@ -74,6 +74,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,cpu):
oai.send('cd $OPENAIR1_DIR;')
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '200'
name = 'Run oai.dlsim.sanity'
conf = '-a -n 100'
......@@ -94,6 +95,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug,cpu):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = 210
name = 'Run oai.dlsim.perf.'+str(PERF)+'%'
......
......@@ -73,6 +73,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug,cpu):
oai.send('cd SIMULATION/LTE_PHY;')
try:
log.start()
test = '300'
name = 'Run oai.ulsim.sanity'
conf = '-a -n 100'
......@@ -93,6 +94,7 @@ def execute(oai, user, pw, host,logfile,logdir,debug,cpu):
log.ok(case, test, name, conf, '', logfile)
try:
log.start()
test = 310
name = 'Run oai.ulsim.perf.'+str(PERF)+'%'
diag = 'no diagnostic is available, check the log file'
......
......@@ -39,14 +39,24 @@ import re
import time
import datetime
import array
import xml.etree.ElementTree as ET
debug = False
docfile = ''
start_time = time.time()
testcase_starttime = start_time
debug = 0
stats = {'passed':0, 'failed':0, 'skipped':0, 'internal_errors':0, 'cmd':0}
# xml result (jUnit like)
xUnitTestsuites = ET.Element( 'testsuites' )
xUnitTestsuite = ET.SubElement( xUnitTestsuites, 'testsuite' )
xUnitTestsuite.set( 'name', 'OAI' )
xUnitTestsuite.set( 'timestamp', datetime.datetime.fromtimestamp(start_time).strftime('%Y-%m-%dT%H:%M:%S') )
xUnitTestsuite.set( 'hostname', 'localhost' )
#xUnitSystemOut = ET.SubElement( xUnitTestsuite, 'system-out' )
class bcolors:
header = '\033[95m'
okblue = '\033[94m'
......@@ -55,6 +65,10 @@ class bcolors:
fail = '\033[91m'
normal = '\033[0m'
def __init__(self):
if not sys.stdout.isatty():
self.disable()
def disable(self):
self.header = ''
self.okblue = ''
......@@ -78,6 +92,11 @@ def writefile(logfile, message):
def sleep(seconds):
time.sleep(seconds)
def start():
"""Start the timer for the following testcase."""
global testcase_starttime
testcase_starttime = time.time()
def set_debug_level(level):
debug = level
......@@ -116,6 +135,14 @@ def statistics(logfile):
writefile(logfile, 'Testing pass rate ' + repr((stats['passed'] * 100) / total_tests) + '%')
writefile(logfile, '===============================================\n')
xUnitTestsuite.set( 'tests', repr(total_tests) )
xUnitTestsuite.set( 'failures', repr(stats['failed']) )
xUnitTestsuite.set( 'skipped', repr(stats['skipped']) )
xUnitTestsuite.set( 'errors', '0' )
time_delta = datetime.datetime.now() - datetime.datetime.fromtimestamp(start_time)
xUnitTestsuite.set( 'time', repr(time_delta.total_seconds()) )
writefile( logfile + '.xml', ET.tostring( xUnitTestsuites, encoding="utf-8", method="xml" ) )
def log_record(level, message):
ts = time.strftime('%d %b %Y %H:%M')
message = ts + ' [' + level + '] ' + message
......@@ -167,5 +194,13 @@ def report(case, test, name, conf, status, output, diag=None, desc=None):
if desc:
writefile(output, desc)
#log_record('report', + case + test + ' documented')
e = ET.SubElement( xUnitTestsuite, 'testcase' )
e.set( 'name', case + '_' + test + '_' + name )
e.set( 'classname', 'shellscript' )
e.set( 'time', repr( time.time() - testcase_starttime ) )
if status == 'failed':
e = ET.SubElement( e, 'failure' )
e.set( 'message', 'failed' )
e.text = diag
if status == 'skipped':
e = ET.SubElement( e, 'skipped' )
......@@ -132,8 +132,26 @@ class openair(core):
except Exception, val:
time.sleep(5)
print "Error:", val
def connect_localshell(self, prompt='$'):
self.prompt1 = prompt
self.prompt2 = prompt
while 1:
try:
# start a shell and use the current environment
self.oai = pexpect.spawn('bash --norc --noprofile')
index = self.oai.expect([re.escape(self.prompt1), re.escape(self.prompt2), pexpect.TIMEOUT], timeout=40)
if index == 0 :
return 'Ok'
else :
sys.exit(1)
except Exception, val:
time.sleep(5)
print "Error:", val
def disconnect(self):
print 'disconnecting the ssh connection to ' + self.address + '\n'
self.oai.send('exit')
......
......@@ -57,6 +57,7 @@ debug = 0
pw =''
i = 0
dlsim=0
localshell=0
for arg in sys.argv:
if arg == '-d':
......@@ -69,11 +70,14 @@ for arg in sys.argv:
pw = sys.argv[i+1]
elif arg == '-P' :
dlsim = 1
elif arg == '-l' :
localshell = 1
elif arg == '-h' :
print "-d: low debug level"
print "-dd: high debug level"
print "-p: set the prompt"
print "-w: set the password for ssh to localhost"
print "-l: use local shell instead of ssh connection"
sys.exit()
i= i + 1
......@@ -99,26 +103,29 @@ except KeyError:
host = os.uname()[1]
oai = openair('localdomain','localhost')
#start_time = time.time() # datetime.datetime.now()
try:
user = getpass.getuser()
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
print '******* Connecting to the localhost to perform the test *******\n'
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
# issues in ubuntu 12.04
# oai.connect(user,pw)
oai.connect2(user,pw)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
user = getpass.getuser()
if localshell == 0:
try:
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
print '******* Connecting to the localhost to perform the test *******\n'
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
# issues in ubuntu 12.04
# oai.connect(user,pw)
oai.connect2(user,pw)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
else:
pw = ''
oai.connect_localshell()
test = 'test01'
ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
......
......@@ -58,6 +58,7 @@ i = 0
clean = 0
start_case = 0
cpu = -1
localshell=0
for arg in sys.argv:
if arg == '-d':
......@@ -74,6 +75,8 @@ for arg in sys.argv:
cpu = sys.argv[i+1]
elif arg == '-s' :
start_case = sys.argv[i+1]
elif arg == '-l' :
localshell = 1
elif arg == '-h' :
print "-d: low debug level"
print "-dd: high debug level"
......@@ -81,6 +84,7 @@ for arg in sys.argv:
print "-w: set the password for ssh to localhost"
print "-c: clean the log directory "
print "-t: set the cpu "
print "-l: use local shell instead of ssh connection"
sys.exit()
i= i + 1
......@@ -106,28 +110,32 @@ host = os.uname()[1]
# get the oai object
oai = openair('localdomain','localhost')
#start_time = time.time() # datetime.datetime.now()
try:
user = getpass.getuser()
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
if cpu > -1 :
print '******* Connecting to the localhost <'+host+'> to perform the test on CPU '+str(cpu)+' *******\n'
else :
print '******* Connecting to the localhost <'+host+'> to perform the test *******\n'
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
print "prompt: " + prompt
user = getpass.getuser()
if localshell == 0:
try:
print '\n******* Note that the user <'+user+'> should be a sudoer *******\n'
if cpu > -1 :
print '******* Connecting to the localhost <'+host+'> to perform the test on CPU '+str(cpu)+' *******\n'
else :
print '******* Connecting to the localhost <'+host+'> to perform the test *******\n'
oai.connect(user,pw,prompt)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
if not pw :
print "username: " + user
pw = getpass.getpass()
else :
print "username: " + user
#print "password: " + pw
print "prompt: " + prompt
oai.connect(user,pw,prompt)
#oai.get_shell()
except :
print 'Fail to connect to the local host'
sys.exit(1)
else:
pw = ''
print "prompt: " + prompt
oai.connect_localshell(prompt)
test = 'test02'
ctime=datetime.datetime.utcnow().strftime("%Y-%m-%d.%Hh%M")
......
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