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