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
This commit is contained in:
@@ -48,6 +48,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send_recv('cd $OPENAIR_TARGETS;')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '00'
|
||||
name = 'Check oai.svn.add'
|
||||
conf = 'svn st -q | grep makefile'
|
||||
@@ -68,6 +69,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send('mkdir ' + logdir + ';')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '01'
|
||||
name = 'Compile oai.rel8.make'
|
||||
conf = 'make'
|
||||
@@ -84,8 +86,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
rv = 0
|
||||
else:
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '02'
|
||||
name = 'Compile oai.rel8.nas.make'
|
||||
conf = 'make nasmesh_fix; make NAS=1'
|
||||
@@ -97,6 +100,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
trace = logdir + '/log_' + case + test + '_1.txt;'
|
||||
tee = ' 2>&1 | tee ' + trace
|
||||
oai.send_expect_false('make nasmesh_fix' + tee, makerr1, 60)
|
||||
oai.send('cp $OPENAIR2_DIR/NAS/DRIVER/MESH/nasmesh.ko .')
|
||||
trace = logdir + '/log_' + case + test + '_2.txt;'
|
||||
tee = ' 2>&1 | tee ' + trace
|
||||
oai.send_expect_false('make NAS=1 JF=1 -j4' + tee, makerr1, 1500)
|
||||
@@ -112,6 +116,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send('cd RT/USER;')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '03'
|
||||
name = 'Compile oai.rel8.rf.make'
|
||||
conf = 'make RTAI=0 EXMIMO=1 Rel8=1'
|
||||
@@ -131,6 +136,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send('cd SIMULATION/LTE_PHY;')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '04'
|
||||
name = 'Compile oai.rel8.phy.dlsim.make'
|
||||
conf = 'make dlsim'
|
||||
@@ -148,6 +154,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '05'
|
||||
name = 'Compile oai.rel8.phy.ulsim.make'
|
||||
conf = 'make ulsim'
|
||||
@@ -168,6 +175,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send('cd SIMU/USER;')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '06'
|
||||
name = 'Compile oai.rel8.itti.make'
|
||||
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 Rel8=1'
|
||||
@@ -185,6 +193,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '07'
|
||||
name = 'Compile oai.rel10.make'
|
||||
conf = 'make RLC_STOP_ON_LOST_PDU=1 Rel10=1'
|
||||
@@ -204,6 +213,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '08'
|
||||
name = 'Compile oai.rel10.itti.make'
|
||||
conf = 'make DISABLE_XER_PRINT=1 ENABLE_ITTI=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
|
||||
@@ -219,7 +229,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
rv = 0
|
||||
else:
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '13'
|
||||
name = 'Compile oai_nw_ether IP driver'
|
||||
conf = 'make oai_nw_drv'
|
||||
@@ -237,7 +249,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
|
||||
else:
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '14'
|
||||
name = 'Compile oai.rel8.itti.ral.make'
|
||||
conf = 'make DISABLE_XER_PRINT=1 NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel8=1'
|
||||
@@ -254,7 +268,9 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.fail(case, test, name, conf, e.value, diag, logfile,trace)
|
||||
else:
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '15'
|
||||
name = 'Compile oai.rel10.itti.ral.make'
|
||||
conf = 'make DISABLE_XER_PRINT=1 NAS=1 OAI_NW_DRIVER_TYPE_ETHERNET=1 ENABLE_ITTI=1 USER_MODE=1 OPENAIR2=1 ENABLE_RAL=1 MIH_C_MEDIEVAL_EXTENSIONS=1 RLC_STOP_ON_LOST_PDU=1 Rel10=1'
|
||||
|
||||
@@ -51,6 +51,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send('cd SIMU/USER;')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '00'
|
||||
name = 'Run oai.rel8.sf'
|
||||
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 = 'Run oai.rel8.err'
|
||||
conf = '-a -A AWGN -n 100 -l7'
|
||||
@@ -85,6 +87,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '02'
|
||||
name = 'Run oai.rel8.abs.rrc'
|
||||
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
@@ -100,6 +103,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '03'
|
||||
name = 'Run oai.rel8.abs.ping'
|
||||
diag = 'Data-plane is not working normally, check the OAI protocol stack, OAI driver, and normal operation of the OS'
|
||||
@@ -123,12 +127,13 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
|
||||
oai.send_expect('ping 10.0.'+str(j+1)+'.'+str(NUM_eNB+i+1) + ' -c ' + str(random.randint(2, 10))+ ' -s ' + str(random.randint(128, 1500)) + tee_ping, ' 0% packet loss', 20)
|
||||
if user == 'root' :
|
||||
oai.send('pkill oaisim.rel8.nas.'+host)
|
||||
oai.send('pkill oaisim.rel8.nas.'+host)
|
||||
else :
|
||||
oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas.'+host)
|
||||
oai.send('pkill -f oaisim.rel8.nas.'+host)
|
||||
time.sleep(1)
|
||||
oai.send('echo '+pw+ ' | sudo -S pkill oaisim.rel8.nas.'+host)
|
||||
oai.send('pkill -f -KILL oaisim.rel8.nas.'+host)
|
||||
else :
|
||||
oai.send('echo '+pw+ ' | sudo -S pkill -f oaisim.rel8.nas.'+host)
|
||||
time.sleep(1)
|
||||
oai.send('echo '+pw+ ' | sudo -S pkill -f -KILL oaisim.rel8.nas.'+host)
|
||||
|
||||
oai.rm_driver(oai,user,pw)
|
||||
|
||||
@@ -138,6 +143,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '04'
|
||||
name = 'Run oai.rel8.phy.rrc'
|
||||
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
@@ -153,6 +159,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '05'
|
||||
name = 'Run oai.rel8.phy.rrc.fdd'
|
||||
diag = 'RRC procedure is not finished completely in FDD mode, check the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
@@ -168,6 +175,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '06'
|
||||
name = 'Run oai.rel8.itti.abs.rrc'
|
||||
diag = 'RRC procedure is not finished completely, check the eNB config file (default is enb.band7.generic.conf), in addition to the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
@@ -188,6 +196,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test='07'
|
||||
name = 'Run oai.rel8.abs.ocg.otg'
|
||||
diag = 'Check the scenario if the tests 0202 and 0203 are passed.'
|
||||
|
||||
@@ -51,6 +51,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
oai.send('cd SIMU/USER;')
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '00'
|
||||
name = 'Run oai.rel10.sf'
|
||||
conf = '-a -A AWGN -l7 -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 = 'Run oai.rel10.err'
|
||||
conf = '-a -A AWGN -l7 -n 100'
|
||||
@@ -85,6 +87,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '02'
|
||||
name = 'Run oai.rel10.abs.rrc'
|
||||
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
@@ -100,6 +103,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '03'
|
||||
name = 'Run oai.rel10.phy.rrc'
|
||||
diag = 'RRC procedure is not finished completely, check the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
@@ -115,6 +119,7 @@ def execute(oai, user, pw, host, logfile,logdir,debug):
|
||||
log.ok(case, test, name, conf, '', logfile)
|
||||
|
||||
try:
|
||||
log.start()
|
||||
test = '04'
|
||||
name = 'Run oai.rel10.phy.rrc.fdd'
|
||||
diag = 'RRC procedure is not finished completely in FDD mode, check the execution logs and trace BCCH, CCCH, and DCCH channels'
|
||||
|
||||
@@ -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'
|
||||
|
||||
+37
-2
@@ -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')
|
||||
|
||||
+26
-19
@@ -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")
|
||||
|
||||
+29
-21
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user