Commit fe17f01b authored by Rohit Gupta's avatar Rohit Gupta

bugfixes for intergration with GitLabCI

parent 15ee5719
......@@ -118,8 +118,7 @@ class core:
rsp1 = self.prompt1
rsp2 = self.prompt2
if sudo == True:
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
command = 'echo \'' + '' + '\' | sudo -S -E bash -c \' ' + command + '\' '
self.wait_quiet()
if self.send_cr:
log.stats['cmd'] += 1
......@@ -140,7 +139,7 @@ class core:
rsp2 = self.prompt2
self.wait_quiet()
if sudo == True:
command = 'echo \'' + self.password + '\' | sudo -S -E ' + command
command = 'echo \'' + '' + '\' | sudo -S -E bash -c \' ' + command + '\' '
if self.send_cr:
log.stats['cmd'] += 1
self.oai.sendline(command)
......
......@@ -112,6 +112,7 @@ class openair(core):
except Exception, e:
error=''
error = error + ' In function: ' + sys._getframe().f_code.co_name + ': *** Caught exception: ' + str(e.__class__) + " : " + str( e)
error = error + 'address = "'+ self.address +' username = ' + username
error = error + traceback.format_exc()
print error
print "Retrying again in 1 seconds"
......
......@@ -262,7 +262,7 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote_testc
if operation == "get_all":
ssh.get_all(logdir_remote_testcase , logdir_local_base)
elif operation == "put_all":
ssh.put_all(logdir_remote_testcase , logdir_local_base)
ssh.put_all(logdir_local_base, logdir_remote_testcase )
else:
print "Error: Uknown operation in SSHSessionWrapper. Exiting now..."
sys.exit(1)
......@@ -929,13 +929,16 @@ GitOAI5GRepoBranch=''
GitOAI5GHeadVersion=''
user=''
pw=''
testcasegroup=''
NFSResultsShare=''
cleanUpRemoteMachines=False
openairdir_local = os.environ.get('OPENAIR_DIR')
if openairdir_local is None:
print "Environment variable OPENAIR_DIR not set correctly"
sys.exit()
locallogdir = openairdir_local + '/cmake_targets/autotests/log/'
locallogdir = openairdir_local + '/cmake_targets/autotests/log'
MachineList = ''
MachinneListGeneric=''
#Remove the contents of local log directory
#os.system(' rm -fr ' + locallogdir + '; mkdir -p ' + locallogdir )
flag_remove_logdir=False
......@@ -987,6 +990,16 @@ while i < len (sys.argv):
elif arg == '-n':
NFSResultsShare = sys.argv[i+1]
i = i +1
elif arg == '-MachineList':
MachineList = sys.argv[i+1]
MachineList = MachineList.replace("\"","")
MachineList = MachineList.replace("\'","")
i = i +1
elif arg == '-MachineListGeneric':
MachineListGeneric = sys.argv[i+1]
MachineListGeneric = MachineListGeneric.replace("\"","")
MachineListGeneric = MachineListGeneric.replace("\'","")
i = i +1
elif arg == '-h' :
print "-d: low debug level"
print "-dd: high debug level"
......@@ -1001,6 +1014,8 @@ while i < len (sys.argv):
print "-u: use the user name passed as argument"
print "-p: use the password passed as an argument"
print "-n: Set the NFS share passed as an argument"
print "-MachineList : overrides the MachineList parameter in test_case_list.xml"
print "-MachineListGeneric : overrides the MachineListGeneric parameter in test_case_list.xml"
sys.exit()
else :
print "Unrecongnized Option: <" + arg + ">. Use -h to see valid options"
......@@ -1042,7 +1057,6 @@ print "user = " + user
xmlInputFile=os.environ.get('OPENAIR_DIR')+"/cmake_targets/autotests/test_case_list.xml"
NFSResultsDir = '/mnt/sradio'
cleanupOldProgramsScript = '$OPENAIR_DIR/cmake_targets/autotests/tools/remove_old_programs.bash'
testcasegroup=''
logdir = '/tmp/' + 'OAITestFrameWork-' + user + '/'
logdirOAI5GRepo = logdir + 'openairinterface5g/'
logdirOpenaircnRepo = logdir + 'openair-cn/'
......@@ -1063,8 +1077,8 @@ xmlRoot = xmlTree.getroot()
MachineList = xmlRoot.findtext('MachineList',default='')
if MachineList =='':
MachineList = xmlRoot.findtext('MachineList',default='')
NFSResultsShare = xmlRoot.findtext('NFSResultsShare',default='')
GitOpenaircnRepo = xmlRoot.findtext('GitOpenair-cnRepo',default='')
GitOAI5GRepo = xmlRoot.findtext('GitOAI5GRepo',default='')
......@@ -1076,7 +1090,8 @@ GitOpenaircnRepoBranch = xmlRoot.findtext('GitOpenair-cnRepoBranch',default='')
CleanUpOldProgs = xmlRoot.findtext('CleanUpOldProgs',default='')
CleanUpAluLteBox = xmlRoot.findtext('CleanUpAluLteBox',default='')
Timeout_execution = int (xmlRoot.findtext('Timeout_execution'))
MachineListGeneric = xmlRoot.findtext('MachineListGeneric',default='')
if MachineListGeneric == '':
MachineListGeneric = xmlRoot.findtext('MachineListGeneric',default='')
TestCaseExclusionList = xmlRoot.findtext('TestCaseExclusionList',default='')
ExmimoRfStop = xmlRoot.findtext('ExmimoRfStop',default='')
......@@ -1100,7 +1115,7 @@ if GitOAI5GHeadVersion == '':
print "Error getting the OAI5GBranch Head version...Exiting"
sys.exit()
NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion + '/'
NFSTestsResultsDir = NFSResultsShare + '/'+ GitOAI5GRepoBranch + '/' + GitOAI5GHeadVersion
print "NFSTestsResultsDir = " + NFSTestsResultsDir
......@@ -1338,7 +1353,6 @@ for testcase in testcaseList:
desc = testcase.findtext('desc',default='')
#print "Machine list top level = " + ','.join(MachineList)
if search_test_case_group(testcasename, testcasegroup, TestCaseExclusionList) == True:
cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop)
if testcaseclass == 'lte-softmodem' :
eNBMachine = testcase.findtext('eNB',default='')
UEMachine = testcase.findtext('UE',default='')
......@@ -1351,11 +1365,12 @@ for testcase in testcaseList:
print "eNBMachine : " + eNBMachine + "UEMachine : " + UEMachine + "EPCMachine : " + EPCMachine + "MachineList : " + ','.join(MachineList)
print "testcasename = " + testcasename + " class = " + testcaseclass
threadListGlobal = wait_testcaseclass_generic_threads(threadListGlobal, Timeout_execution)
cleanOldProgramsAllMachines(oai_list, CleanUpOldProgs, CleanUpAluLteBox, ExmimoRfStop)
handle_testcaseclass_softmodem (testcase, CleanUpOldProgs, logdirOAI5GRepo, logdirOpenaircnRepo, MachineList, user, pw, CleanUpAluLteBox, ExmimoRfStop )
elif (testcaseclass == 'compilation'):
threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,Timeout_execution, ExmimoRfStop)
elif (testcaseclass == 'execution'):
threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox,ExmimoRfStop)
threadListGlobal = handle_testcaseclass_generic (testcasename, threadListGlobal, CleanUpOldProgs, logdirOAI5GRepo, MachineListGeneric, user, pw, CleanUpAluLteBox, Timeout_execution, ExmimoRfStop)
else :
print "Unknown test case class: " + testcaseclass
sys.exit()
......@@ -1370,13 +1385,15 @@ for testcase in testcaseList:
#sys.exit(1)
print "Exiting the test cases execution now..."
print "Exiting the test cases execution now. Waiting for existing threads to complete..."
for t in threadListGlobal:
t.join
for param in threadListGlobal:
thread_id = param["thread_id"]
thread_id.join()
print "Creating xml file for overall results..."
cmd = "cat $OPENAIR_DIR/cmake_targets/autotests/log/*/*.xml > $OPENAIR_DIR/cmake_targets/autotests/log/results_autotests.xml "
os.system('cmd')
res=os.system(cmd)
print "Now copying files to NFS Share"
oai_localhost = openair('localdomain','localhost')
......@@ -1388,7 +1405,7 @@ print "Deleting NFSTestResults Dir..." + res
print "Copying files from GilabCI Runner Machine : " + host + "locallogdir = " + locallogdir + ", NFSTestsResultsDir = " + NFSTestsResultsDir
#ssh = SSHSession(UEMachine , username=user, key_file=None, password=password)
#ssh.get_all(logdir_UE , logdir_local + '/cmake_targets/autotests/log/'+ testcasename)
SSHSessionWrapper('localhost', user, None, password, NFSTestsResultsDir , locallogdir, "put_all")
SSHSessionWrapper('localhost', user, None, pw , NFSTestsResultsDir , locallogdir, "put_all")
sys.exit()
......
<testCaseList>
<MachineList>calisson mozart stevens nano amerique</MachineList>
<MachineList>mozart calisson stevens nano </MachineList>
<NFSResultsShare>/mnt/sradio/TEST_RESULTS/</NFSResultsShare>
<GitOAI5GRepo>https://gitlab.eurecom.fr/oai/openairinterface5g.git</GitOAI5GRepo>
<GitOpenair-cnRepo>https://gitlab.eurecom.fr/oai/openair-cn.git</GitOpenair-cnRepo>
......@@ -11,7 +11,7 @@
<ExmimoRfStop>$OPENAIR_DIR/cmake_targets/build_oai -w EXMIMO -c; sudo -S -E $OPENAIR_DIR/cmake_targets/tools/stop_exmimo2; dmesg|tail</ExmimoRfStop>
<Timeout_execution>36000</Timeout_execution>
<TestCaseExclusionList>0104+ 015502 015505 015506 015507 015508 015508 015509 015510 015511 015600 015700 016102 016105</TestCaseExclusionList>
<MachineListGeneric>calisson stevens mozart nano amerique</MachineListGeneric>
<MachineListGeneric>mozart calisson stevens nano </MachineListGeneric>
<testCase id="010101" >
<class>compilation</class>
<desc>Build oaisim.Rel8</desc>
......
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