tps: change tps for pts (Production Test Suite). Added license

parent f78c441c
Production Test Suite, automatized tests for OHWR boards.
Copyright (C) 2011 CERN
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This is the infamous Test Production Suite facility,
aka TPS of "Office Space" fame.
This is Production Test Suite project.
Supporting automated hardware testing at BE/CO/HT
since 2011 or even less
License: GPL v2 or later
......@@ -21,18 +21,18 @@ import string
from ConfigParser import ConfigParser, NoOptionError
from optparse import OptionParser
from sha import sha as sha160
from tpsexcept import *
from ptsexcept import *
default_config_file = 'tpsdefault.cfg'
default_log_pattern = 'tps_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_name = 'tps_run_{runid}_{timestamp}_{board}_{serial}.txt'
default_config_file = 'ptsdefault.cfg'
default_log_pattern = 'pts_tst_{runid}_{timestamp}_{board}_{serial}_{number}.txt'
default_log_name = 'pts_run_{runid}_{timestamp}_{board}_{serial}.txt'
default_zip_name = 'zip_run_{runid}_{timestamp}_{board}_{serial}.zip'
default_test_pattern = r'test[0-9][0-9]'
default_test_syntax = r'(test)?(\d\d)'
original_raw_input = raw_input
def tps_raw_input(msg, default='y'):
def pts_raw_input(msg, default='y'):
try:
ret = original_raw_input(msg)
except EOFError:
......@@ -55,7 +55,7 @@ def run_test(testname, logname, yes=False):
if yes:
tmpin = sys.stdin
sys.stdin = open('/dev/null')
__builtins__.raw_input = tps_raw_input
__builtins__.raw_input = pts_raw_input
mod = __import__(testname, globals(), locals(), [])
mod.main(default_directory='./test/spec/python')
finally:
......@@ -93,7 +93,7 @@ class Suite(object):
except IOError:
errmsg = 'could not read configuration file {0}'
errmsg = errmsg.format(self.config)
raise TpsCritical(errmsg)
raise PtsCritical(errmsg)
config = ConfigParser(cfg)
try:
......@@ -131,10 +131,10 @@ class Suite(object):
if not self.board:
msg = 'invalid board name [{0}]'.format(self.board)
raise TpsInvalid(msg)
raise PtsInvalid(msg)
if not self.serial:
msg = 'invalid serial number [{0}]'.format(self.serial)
raise TpsInvalid(msg)
raise PtsInvalid(msg)
# self.serial = self.serial.strip(',')
if not self.extra_serial:
self.extra_serial = '0000'
......@@ -150,7 +150,7 @@ class Suite(object):
pass
except IOError:
msg = 'invalid test path [{0}]'.format(self.test_path)
raise TpsInvalid(msg)
raise PtsInvalid(msg)
try:
tmp = os.tempnam(self.log_path)
......@@ -160,7 +160,7 @@ class Suite(object):
pass
except:
msg = 'invalid log path [{0}]'.format(self.log_path)
raise TpsInvalid(msg)
raise PtsInvalid(msg)
if not self.repeat:
self.repeat = 1
......@@ -169,17 +169,17 @@ class Suite(object):
self.repeat = int(self.repeat)
except ValueError:
msg = 'invalid repeat factor [{0}]'.format(self.repeat)
raise TpsInvalid(msg)
raise PtsInvalid(msg)
if not self.sequence:
raise TpsNoBatch('null test sequence')
raise PtsNoBatch('null test sequence')
run = []
for testno in self.sequence:
test_glob = os.path.join(self.test_path, 'test' + testno + '.py')
files = glob.glob(test_glob)
if not files:
print files, test_glob
raise TpsBadTestNo('no test number [%s], aborting' % testno)
raise PtsBadTestNo('no test number [%s], aborting' % testno)
run.append(files[0])
if self.randomize:
......@@ -252,17 +252,17 @@ class Suite(object):
log.write('running test {0} = {1}\n'.format(shortname, test))
print 'running test ' + shortname
run_test(testname, logname, yes=self.yes)
except TpsCritical, e:
except PtsCritical, e:
print 'test [%s]: critical error, aborting: [%s]' % (shortname, e)
log.write(' critical error in test {0}, exception [{1}]\n'.format(shortname, e))
log.write(' cannot continue, aborting test suite')
failures.append((shortname, e, ))
break
except TpsError, e:
except PtsError, e:
print 'test [%s]: error, continuing: [%s]' % (shortname, e)
log.write(' error in test {0}, exception [{1}]\n'.format(shortname, e))
failures.append((shortname, e, ))
except TpsUser, e:
except PtsUser, e:
print 'test [%s]: user error, user intervention required: [%s]' % (shortname, e)
log.write(' error in test {0}, exception [{1}]\n'.format(shortname, e))
failures.append((shortname, e, ))
......@@ -280,7 +280,7 @@ class Suite(object):
elif ans == 'c':
log.write(' user intervention: continue\n')
continue
except TpsWarning, e:
except PtsWarning, e:
print 'test [%s]: warning: [%s]' % (shortname, e)
log.write(' warning in test {0}, exception [{1}]\n'.format(shortname, e))
failures.append((shortname, e, ))
......@@ -477,7 +477,7 @@ def main():
s.sequence = valid
try:
s.validate_and_compute_run()
except TpsInvalid, e:
except PtsInvalid, e:
print 'bad parameters:', e
return
......
......@@ -3,7 +3,7 @@
LOGDIR=./log
mkdir -p $LOGDIR
sudo rm -fr $LOGDIR/tps*
sudo rm -fr $LOGDIR/pts*
serial=$1
if [ x$1 = x"" ]; then
......@@ -28,7 +28,7 @@ echo -n "Press enter to continue...\n"
read tmp
echo -n "--------------------------------------------------------------\n"
sudo ./tps.py -b SPEC -s $serial -e $extra_serial -t./test/spec/python -l $LOGDIR 00 01 02 03 04 05 06 07 08 09 10 12
sudo ./pts.py -b SPEC -s $serial -e $extra_serial -t./test/spec/python -l $LOGDIR 00 01 02 03 04 05 06 07 08 09 10 12
echo -n "Press enter to exit... "
......
#! /usr/bin/env python
# coding: utf8
class TpsException(Exception):
class PtsException(Exception):
pass
class TpsCritical(TpsException):
class PtsCritical(PtsException):
"""critical error, abort the whole test suite"""
pass
class TpsError(TpsException):
class PtsError(PtsException):
"""error, continue remaining tests in test suite"""
pass
class TpsUser(TpsException):
class PtsUser(PtsException):
"""error, user intervention required"""
pass
class TpsWarning(TpsException):
class PtsWarning(PtsException):
"""warning, a cautionary message should be displayed"""
pass
class TpsInvalid(TpsException):
class PtsInvalid(PtsException):
"""reserved: invalid parameters"""
class TpsNoBatch(TpsInvalid):
class PtsNoBatch(PtsInvalid):
"""reserved: a suite was created without batch of tests to run"""
pass
class TpsBadTestNo(TpsInvalid):
class PtsBadTestNo(PtsInvalid):
"""reserved: a bad test number was given"""
pass
......
......@@ -10,7 +10,7 @@ import sys
import rr # Needed for accessing the rawrabbit driver
import time
import os
from tpsexcept import * # Declaration of Exceptions
from ptsexcept import * # Declaration of Exceptions
"""
test00: example test which prints 'hello <name>'
......
#! /usr/bin/env python
# coding: utf8
class PtsException(Exception):
pass
class PtsCritical(PtsException):
"""critical error, abort the whole test suite"""
pass
class PtsError(PtsException):
"""error, continue remaining tests in test suite"""
pass
class PtsUser(PtsException):
"""error, user intervention required"""
pass
class PtsWarning(PtsException):
"""warning, a cautionary message should be displayed"""
pass
class PtsInvalid(PtsException):
"""reserved: invalid parameters"""
class PtsNoBatch(PtsInvalid):
"""reserved: a suite was created without batch of tests to run"""
pass
class PtsBadTestNo(PtsInvalid):
"""reserved: a bad test number was given"""
pass
if __name__ == '__main__':
pass
......@@ -10,7 +10,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test02: checks the EEPROM of the GENNUM chip.
......@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if tmp & 0x1:
break
elif tmp & 0xC:
raise TpsError ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
raise PtsError ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
sys.exit()
i-=1
if i == 0:
raise TpsError ('ERROR, completion status not detected!!')
raise PtsError ('ERROR, completion status not detected!!')
sys.exit()
# Change to read mode
......@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j-=1
if j == 0:
error_flag = 1
raise TpsWarning('ERROR, completion status not detected!!')
raise PtsWarning('ERROR, completion status not detected!!')
# Read data from fifo
while transfer_len > 0:
read_data.append(0xFF & self.gennum.iread(4, self.I2C_DATA, 4))
......@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
break
elif tmp & 0xC:
raise TpsWarning ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
raise PtsWarning ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
tmp = self.gennum.iread(4, 0x914, 4)
return total_transfer
i-=1
......@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if written == len(file_data):
print 'EEPROM written with '+file_name+' content!'
else :
raise TpsError ("ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file.")
raise PtsError ("ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file.")
return 0
def compare_eeprom_with_file(self, file_name):
......@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if file_data[i] == eeprom_data[i]:
print 'EEPROM= %.2X, FILE= %.2X => OK' %(eeprom_data[i],file_data[i])
else :
raise TpsError('EEPROM= %.2X, FILE= %.2X => ERROR' %(eeprom_data[i],file_data[i]))
raise PtsError('EEPROM= %.2X, FILE= %.2X => ERROR' %(eeprom_data[i],file_data[i]))
def file_dump_to_gennum(self, file_name):
if file_name == "":
......
......@@ -10,7 +10,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test00: checks voltage of the power pins in FMC connector.
......@@ -70,7 +70,7 @@ class COpenCoresI2C:
self.wait_busy()
if(self.rd_reg(self.R_SR) & self.SR_RXACK):
raise TpsError('Failed I2C communication. No ACK upon address (device 0x%x not connected?)' % addr)
raise PtsError('Failed I2C communication. No ACK upon address (device 0x%x not connected?)' % addr)
def write(self, data, last):
self.wr_reg(self.R_TXR, data);
......@@ -80,7 +80,7 @@ class COpenCoresI2C:
self.wr_reg(self.R_CR, cmd);
self.wait_busy();
if(self.rd_reg(self.R_SR) & self.SR_RXACK):
raise TpsError('Failed I2C communication. No ACK upon write')
raise PtsError('Failed I2C communication. No ACK upon write')
def read(self, last):
cmd = self.CR_RD;
......@@ -172,15 +172,15 @@ def main (default_directory='.'):
# Check the values of the ADC.
if(float(value8) < 1.58) or (float(value8) > 1.75) :
raise TpsError ("Error in VS_VADJ (2.5V) measured "+ adc_convert_to_real_value(8, value8) + "V.")
raise PtsError ("Error in VS_VADJ (2.5V) measured "+ adc_convert_to_real_value(8, value8) + "V.")
print "VS_VADJ = " + adc_convert_to_real_value(8, value8)
if(float(value7) < 1.88) or (float(value7) > 2.13):
raise TpsError ("Error in VS_P12V_x (12V) measured "+ adc_convert_to_real_value(7, value7) + "V.")
raise PtsError ("Error in VS_P12V_x (12V) measured "+ adc_convert_to_real_value(7, value7) + "V.")
print "VS_P12V_x = " + adc_convert_to_real_value(7, value7)
if(float(value6) < 1.64) or (float(value6) > 1.82):
raise TpsError ("Error in VS_P3V3_x (3.3V) measured "+ adc_convert_to_real_value(6, value6) + "V.")
raise PtsError ("Error in VS_P3V3_x (3.3V) measured "+ adc_convert_to_real_value(6, value6) + "V.")
print "VS_P3V3_x = " + adc_convert_to_real_value(6, value6)
if __name__ == '__main__' :
......
......@@ -13,7 +13,7 @@ import time
import os
import errno
from tpsexcept import * # jdgc
from ptsexcept import * # jdgc
"""
test01: checks the low speed pins of FMC connector (low count connector).
......@@ -1104,7 +1104,7 @@ def summary_results(testStatus):
for i in sorted(testStatus.keys()):
if testStatus[i] == 'Fail':
raise TpsError("FMC connector failure")
raise PtsError("FMC connector failure")
print string
......
......@@ -12,7 +12,7 @@ import time
import os
import os.path
from ctypes import *
from tpsexcept import *
from ptsexcept import *
"""
test03: loads a firmware file to Flash memory and boots from it. The FW just blinks the leds.
......@@ -40,7 +40,7 @@ def main (default_directory='.'):
flash.lib.gpio_bootselect(flash.GENNUM_FLASH);
version = hex(flash.lib.flash_read_id());
if (version != "0x202016"):
raise TpsError('Error: version of the flash is not correct: ' + version);
raise PtsError('Error: version of the flash is not correct: ' + version);
# Load a new firmware to the Flash memory.
print "Starting the process to load a FW into Flash memory"
......@@ -74,7 +74,7 @@ def main (default_directory='.'):
sys.stdout = tmp_stdout;
sys.stdin = tmp_stdin;
if (ask == "N") :
raise TpsError("Error loading FW through the Flash memory or there is a problem with the LEDs");
raise PtsError("Error loading FW through the Flash memory or there is a problem with the LEDs");
if __name__ == '__main__' :
main();
......@@ -10,7 +10,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test00: checks the presence of the SFP connector and reads the type of connector
......@@ -146,7 +146,7 @@ def main (default_directory='.'):
if (type == 3) :
print "Type is correct"
else :
raise TpsError("Wrong type of connector. It should be 0x3")
raise PtsError("Wrong type of connector. It should be 0x3")
if __name__ == '__main__' :
main();
......
......@@ -13,7 +13,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test05: check SATA ports and high speed pins on FMC connector (low count connector).
......@@ -70,7 +70,7 @@ class COpenCoresI2C:
self.wait_busy()
if(self.rd_reg(self.R_SR) & self.SR_RXACK):
raise TpsError('No ACK upon address (device 0x%x not connected?)' % (addr >> 1))
raise PtsError('No ACK upon address (device 0x%x not connected?)' % (addr >> 1))
def write(self, data, last):
self.wr_reg(self.R_TXR, data);
......@@ -80,7 +80,7 @@ class COpenCoresI2C:
self.wr_reg(self.R_CR, cmd);
self.wait_busy();
if(self.rd_reg(self.R_SR) & self.SR_RXACK):
raise TpsError('No ACK upon write')
raise PtsError('No ACK upon write')
def read(self, last):
cmd = self.CR_RD;
......@@ -263,7 +263,7 @@ class CSI570 :
break;
if (not finish):
raise TpsError('SI570: Not found a proper setup')
raise PtsError('SI570: Not found a proper setup')
tmp = freq_dco / 114.28;
rfreq = int((tmp * (2**28)));
......@@ -397,7 +397,7 @@ class CMinic:
mask = 1 << 2;
if(self.minic_readl(self.MINIC_REG_MCR) & mask) :
raise TpsError('MINIC: TX error');
raise PtsError('MINIC: TX error');
def receive(self, size) :
# Setup RX
......@@ -555,7 +555,7 @@ def main (default_directory='.'):
if (p.is_alive()) :
p.terminate();
raise TpsError("Test SATA 0 -> SATA 1: Error in SATA 1, RX")
raise PtsError("Test SATA 0 -> SATA 1: Error in SATA 1, RX")
time.sleep(2);
......@@ -574,7 +574,7 @@ def main (default_directory='.'):
if (p.is_alive()) :
p.terminate();
raise TpsError ("Test SATA 1 -> SATA 0: Error in SATA 0, RX")
raise PtsError ("Test SATA 1 -> SATA 0: Error in SATA 0, RX")
time.sleep(2)
......@@ -594,7 +594,7 @@ def main (default_directory='.'):
if (p.is_alive()) :
p.terminate();
raise TpsError ("Test SFP -> DP0: Error in DP0, RX")
raise PtsError ("Test SFP -> DP0: Error in DP0, RX")
time.sleep(2);
......@@ -613,7 +613,7 @@ def main (default_directory='.'):
if (p.is_alive()) :
p.terminate();
raise TpsError ("Test DP0 -> SFP: Error in SFP, RX")
raise PtsError ("Test DP0 -> SFP: Error in SFP, RX")
if __name__ == '__main__' :
main();
......@@ -10,7 +10,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test06: checks Silabs SI570 oscillator.
......@@ -70,7 +70,7 @@ class COpenCoresI2C:
self.wait_busy()
if(self.rd_reg(self.R_SR) & self.SR_RXACK):
raise TpsError('Failed I2C. No ACK upon address (device 0x%x not connected?)' % addr)
raise PtsError('Failed I2C. No ACK upon address (device 0x%x not connected?)' % addr)
def write(self, data, last):
self.wr_reg(self.R_TXR, data);
......@@ -80,7 +80,7 @@ class COpenCoresI2C:
self.wr_reg(self.R_CR, cmd);
self.wait_busy();
if(self.rd_reg(self.R_SR) & self.SR_RXACK):
raise TpsError('Failed I2C. No ACK upon write')
raise PtsError('Failed I2C. No ACK upon write')
def read(self, last):
cmd = self.CR_RD;
......@@ -220,7 +220,7 @@ class CSI570 :
break;
if (not finish):
raise TpsError('SI570: Not found a proper setup')
raise PtsError('SI570: Not found a proper setup')
tmp = freq_dco / 114.28;
rfreq = int((tmp * (2**28)));
......@@ -260,7 +260,7 @@ def main (default_directory='.'):
if (gennum.iread(0,0x80000,4)) :
print "SI570 CLK present: OK"
else :
raise TpsError("SIS570 CLK present: FAILED")
raise PtsError("SIS570 CLK present: FAILED")
if __name__ == '__main__' :
main();
......@@ -15,7 +15,7 @@ import i2c
import gn4124
import os
from tpsexcept import *
from ptsexcept import *
"""
test07: checks data and address lines of DDR memory.
......@@ -54,7 +54,7 @@ def main (default_directory='.'):
num_data_lines = 16;
if (len(pages) < (num_addr_lines + 2)) :
raise TpsError("Not enough pages");
raise PtsError("Not enough pages");
data = 0xDEADBABE
# Clear memory pages
......@@ -174,7 +174,7 @@ def main (default_directory='.'):
if (error) :
print "RESULT: [FAILED]"
raise TpsError ("Error in DDR data/address lines. Please check log file for more information")
raise PtsError ("Error in DDR data/address lines. Please check log file for more information")
else :
print "RESULT: [OK]"
......
......@@ -12,7 +12,7 @@ import rr
import time
import math
import os.path
from tpsexcept import * # jdgc
from ptsexcept import * # jdgc
""" SPEC test for two clock domains.
......@@ -368,7 +368,7 @@ def main (default_directory='.'):
for i in range (0, len(double_counter.results)):
if (double_counter.results[i] == False):
print "Test " + str(i) +":\tFAIL"
raise TpsCritical("Mismatch between expected fast cycles and expected ones")
raise PtsCritical("Mismatch between expected fast cycles and expected ones")
else:
print "Test " + str(i) +":\tPASS"
......
......@@ -11,7 +11,7 @@ import rr
import time
import os
from ctypes import *
from tpsexcept import *
from ptsexcept import *
"""
test09: reads serial number of the temperature sensor.
......
......@@ -11,7 +11,7 @@ import rr
import time
import os
import serial
from tpsexcept import *
from ptsexcept import *
from multiprocessing import Process
"""
......@@ -62,7 +62,7 @@ def rx_thread(ser):
char1 = ser.read(1);
if (char1 != "A") :
raise TpsError("UART sent 'A'. USB received: "+ char1)
raise PtsError("UART sent 'A'. USB received: "+ char1)
print "UART sent 'A'. USB received: " + char1
......@@ -91,7 +91,7 @@ def main (default_directory='.'):
char1 = uart.read();
if (chr(char1) != 'a') :
raise TpsError("USB sent 'a'. UART received: "+ chr(char1))
raise PtsError("USB sent 'a'. UART received: "+ chr(char1))
print "USB sent 'a'. UART Received: " + chr(char1);
......
......@@ -10,7 +10,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test10: overwrites GENNUM EEPROM with VENDOR ID, DEVICE ID of SPEC Board.
......@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if tmp & 0x1:
break
elif tmp & 0xC:
raise TpsError ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
raise PtsError ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
sys.exit()
i-=1
if i == 0:
raise TpsError ('ERROR, completion status not detected!!')
raise PtsError ('ERROR, completion status not detected!!')
sys.exit()
# Change to read mode
......@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j-=1
if j == 0:
error_flag = 1
raise TpsWarning('ERROR, completion status not detected!!')
raise PtsWarning('ERROR, completion status not detected!!')
# Read data from fifo
while transfer_len > 0:
read_data.append(0xFF & self.gennum.iread(4, self.I2C_DATA, 4))
......@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
break
elif tmp & 0xC:
raise TpsWarning ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
raise PtsWarning ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
tmp = self.gennum.iread(4, 0x914, 4)
return total_transfer
i-=1
......@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if written == len(file_data):
print 'EEPROM written with '+file_name+' content!'
else :
raise TpsError ("ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file.")
raise PtsError ("ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file.")
return 0
def compare_eeprom_with_file(self, file_name):
......@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if file_data[i] == eeprom_data[i]:
print 'EEPROM= %.2X, FILE= %.2X => OK' %(eeprom_data[i],file_data[i])
else :
raise TpsError('EEPROM= %.2X, FILE= %.2X => ERROR' %(eeprom_data[i],file_data[i]))
raise PtsError('EEPROM= %.2X, FILE= %.2X => ERROR' %(eeprom_data[i],file_data[i]))
def main (default_directory='.'):
......
......@@ -10,7 +10,7 @@ import sys
import rr
import time
import os
from tpsexcept import *
from ptsexcept import *
"""
test10_rooback: overwrites GENNUM's EEPROM with the default value of GENNUM Vendor ID.
......@@ -73,11 +73,11 @@ class EEPROM_GENNUM:
if tmp & 0x1:
break
elif tmp & 0xC:
raise TpsError ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
raise PtsError ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
sys.exit()
i-=1
if i == 0:
raise TpsError ('ERROR, completion status not detected!!')
raise PtsError ('ERROR, completion status not detected!!')
sys.exit()
# Change to read mode
......@@ -107,7 +107,7 @@ class EEPROM_GENNUM:
j-=1
if j == 0:
error_flag = 1
raise TpsWarning('ERROR, completion status not detected!!')
raise PtsWarning('ERROR, completion status not detected!!')
# Read data from fifo
while transfer_len > 0:
read_data.append(0xFF & self.gennum.iread(4, self.I2C_DATA, 4))
......@@ -175,7 +175,7 @@ class EEPROM_GENNUM:
#print 'TR_SIZE=%d' % tmp
break
elif tmp & 0xC:
raise TpsWarning ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
raise PtsWarning ('NACK detected or TIMEOUT, IRT_STATUS = 0x%x!!' % tmp)
tmp = self.gennum.iread(4, 0x914, 4)
return total_transfer
i-=1
......@@ -263,7 +263,7 @@ class EEPROM_GENNUM:
if written == len(file_data):
print 'EEPROM written with '+file_name+' content!'
else :
raise TpsError ("ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file.")
raise PtsError ("ERROR writting to the EEPROM: Written lenght doesn't correspond with the length of the file.")
return 0
def compare_eeprom_with_file(self, file_name):
......@@ -293,7 +293,7 @@ class EEPROM_GENNUM:
if file_data[i] == eeprom_data[i]:
print 'EEPROM= %.2X, FILE= %.2X => OK' %(eeprom_data[i],file_data[i])
else :
raise TpsError('EEPROM= %.2X, FILE= %.2X => ERROR' %(eeprom_data[i],file_data[i]))
raise PtsError('EEPROM= %.2X, FILE= %.2X => ERROR' %(eeprom_data[i],file_data[i]))
def main (default_directory='.'):
......
#! /usr/bin/env python
# coding: utf8
class TpsException(Exception):
class PtsException(Exception):
pass
class TpsCritical(TpsException):
class PtsCritical(PtsException):
"""critical error, abort the whole test suite"""
pass
class TpsError(TpsException):
class PtsError(PtsException):
"""error, continue remaining tests in test suite"""
pass
class TpsUser(TpsException):
class PtsUser(PtsException):
"""error, user intervention required"""
pass
class TpsWarning(TpsException):
class PtsWarning(PtsException):
"""warning, a cautionary message should be displayed"""
pass
class TpsInvalid(TpsException):
class PtsInvalid(PtsException):
"""reserved: invalid parameters"""
class TpsNoBatch(TpsInvalid):
class PtsNoBatch(PtsInvalid):
"""reserved: a suite was created without batch of tests to run"""
pass
class TpsBadTestNo(TpsInvalid):
class PtsBadTestNo(PtsInvalid):
"""reserved: a bad test number was given"""
pass
......
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