Commit 7113151c authored by Tom Trafford's avatar Tom Trafford

Updated tests for Panda 1.0

parent 29a597af
......@@ -3,9 +3,7 @@ import os, sys, getopt
import csv
import collections
PAR_DIR = os.path.join(__file__, os.pardir)
ROOT_DIR = os.path.dirname(os.path.abspath(PAR_DIR))
APP_DIR = os.path.join(ROOT_DIR, "PandATest")
APP_DIR = os.path.abspath(os.path.dirname(__file__))
class ConfigReader(object):
def __init__(self):
......
......@@ -11,10 +11,8 @@ class Encoder(PandATest.PandATest):
def setup_quad(self):
#(cmd, (expected result, +- bound of result))
setup_quad_commands = OrderedDict([
('INENC{}.BYPASS=On'.format(self.blocknum), ('OK', 0)),
('OUTENC{}.BYPASS=On'.format(self.blocknum), ('OK', 0)),
('INENC{}.PROTOCOL=Quadrature'.format(self.blocknum), ('OK', 0)),
('OUTENC{}.PROTOCOL=Quadrature'.format(self.blocknum), ('OK', 0))
('OUTENC{}.PROTOCOL=ABZ Passthrough'.format(self.blocknum), ('OK', 0))
])
#SET FOR QUADRATURE
for cmd, expected in setup_quad_commands.items():
......@@ -25,17 +23,31 @@ class Encoder(PandATest.PandATest):
def setup_ssi(self):
setup_ssi_commands = OrderedDict([
('INENC{}.PROTOCOL=SSI'.format(self.blocknum), ('OK', 0)),
('OUTENC{}.PROTOCOL=SSI'.format(self.blocknum), ('OK', 0))
('OUTENC{}.PROTOCOL=SSI'.format(self.blocknum), ('OK', 0)),
('INENC{}.CLK_SRC=From CLK'.format(self.blocknum), ('OK', 0))
])
#SET FOR SSI
for cmd, expected in setup_ssi_commands.items():
response = self.send_cmd(cmd)
self.test_result.append(
self.check_response(response, expected[0], cmd, expected[1]))
def setup_data(self):
setup_data_commands = OrderedDict([
('INENC{}.PROTOCOL=SSI'.format(self.blocknum), ('OK', 0)),
('OUTENC{}.PROTOCOL=DATA Passthrough'.format(self.blocknum), ('OK', 0)),
('INENC{}.CLK_SRC=From CLK'.format(self.blocknum), ('OK', 0)),
('OUTENC{}.CONN=ONE'.format(self.blocknum), ('OK', 0))
])
#SET FOR SSI
for cmd, expected in setup_data_commands.items():
response = self.send_cmd(cmd)
self.test_result.append(
self.check_response(response, expected[0], cmd, expected[1]))
def check_daughter_board(self):
#CHECK FOR CONTROL ENCODERS
response = self.send_cmd('INENC{}.DCARD_ID?'.format(self.blocknum))
response = self.send_cmd('INENC{}.DCARD_TYPE?'.format(self.blocknum))
if 'Encoder Control' not in response:
print "Encoder {} daughter board mismatch: {}".format(self.blocknum,
response)
......
......@@ -33,7 +33,7 @@ class EncoderLB(Encoder.Encoder):
self.outputs[0]: self.inputs[0]
}
self.toggle_val('INENC', '', 'OUTENC', '', default_val)
self.setup_data()
self.outputs = ['DATA']
self.inputs = self.outputs
self.ch_connect = {
......
......@@ -33,7 +33,7 @@ class EncoderUP(Encoder.Encoder):
self.outputs[0]: -1,
}
self.toggle_val('INENC', '', 'OUTENC', '', default_val)
self.setup_data()
self.outputs = ['DATA']
self.inputs = self.outputs
self.ch_connect = {
......
......@@ -9,19 +9,19 @@ class Fmc(PandATest.PandATest):
#(cmd, (expected result, +/- tolerance of result))
internal_commands = OrderedDict([
('FMC.FMC_PRSNT?', ('OK =1', 0)),
('FMC.LOOP_PERIOD=125', ('OK', 0)),
('FMC.SOFT_RESET=', ('OK', 0)),
('FMC.LA_P_ERROR?', ('OK =0', 0)),
('FMC.LA_N_ERROR?', ('OK =0', 0)),
('FMC.GTREFCLK?', ('OK =8191', 1)),
('FMC.FMC_CLK0?', ('OK =10240', 1)),
('FMC.FMC_CLK1?', ('OK =10240', 1)),
('FMC.LINK_UP?', ('OK =1', 0)),
('FMC_LBACK.FMC_PRSNT?', ('OK =1', 0)),
('FMC_LBACK.LOOP_PERIOD=125', ('OK', 0)),
('FMC_LBACK.SOFT_RESET=', ('OK', 0)),
('FMC_LBACK.LA_P_ERROR?', ('OK =0', 0)),
('FMC_LBACK.LA_N_ERROR?', ('OK =0', 0)),
('FMC_LBACK.GTREFCLK?', ('OK =8191', 1)),
('FMC_LBACK.FMC_CLK0?', ('OK =10240', 1)),
('FMC_LBACK.FMC_CLK1?', ('OK =10240', 1)),
('FMC_LBACK.LINK_UP?', ('OK =1', 0)),
])
external_commands = OrderedDict([
('FMC.EXT_CLK?', ('OK ={}', 1)),
('FMC_LBACK.EXT_CLK?', ('OK ={}', 1)),
])
for cmd, expected in internal_commands.items():
......
......@@ -15,8 +15,8 @@ class PandATest(object):
1: "..OK"
}
self.toggle_cmd = {
0: 'BITS.ZERO',
1: 'BITS.ONE'
0: 'ZERO',
1: 'ONE'
}
self.unplugged_string = {
False : 'Loop Back',
......@@ -111,4 +111,4 @@ class PandATest(object):
self.test_result.append(0)
self.logger.info("{:<28}[{:<9}] {}".format(
"OUT{}=>{}, INP{}=>".format(output, tgl_val, inp),
response, self.ok_string[self.test_result[-1]]))
\ No newline at end of file
response, self.ok_string[self.test_result[-1]]))
......@@ -8,16 +8,18 @@ class Sfp(PandATest.PandATest):
def test_code(self):
#(cmd, (expected result, +- tolerance of result))
internal_commands = OrderedDict([
('SFP.SOFT_RESET=', ('OK', 0)),
('SFP.SFP_CLK1?', ('OK=3276', 1)),
('SFP.SFP_CLK2?', ('OK=3276', 1)),
('SFP.SFP_CLK3?', ('OK=3276', 1)),
('SFP.LINK1_UP?', ('OK =1', 0)),
('SFP.ERROR1_COUNT?', ('OK =0', 0)),
('SFP.LINK2_UP?', ('OK =1', 0)),
('SFP.ERROR2_COUNT?', ('OK =0', 0)),
('SFP.LINK3_UP?', ('OK =1', 0)),
('SFP.ERROR3_COUNT?', ('OK =0', 0))
('SFP1_LBACK.SOFT_RESET=', ('OK', 0)),
('SFP2_LBACK.SOFT_RESET=', ('OK', 0)),
('SFP3_LBACK.SOFT_RESET=', ('OK', 0)),
('SFP1_LBACK.SFP_CLK?', ('OK=3276', 1)),
('SFP2_LBACK.SFP_CLK?', ('OK=3276', 1)),
('SFP3_LBACK.SFP_CLK?', ('OK=3276', 1)),
('SFP1_LBACK.LINK_UP?', ('OK =1', 0)),
('SFP1_LBACK.ERROR_COUNT?', ('OK =0', 0)),
('SFP2_LBACK.LINK_UP?', ('OK =1', 0)),
('SFP2_LBACK.ERROR_COUNT?', ('OK =0', 0)),
('SFP3_LBACK.LINK_UP?', ('OK =1', 0)),
('SFP3_LBACK.ERROR_COUNT?', ('OK =0', 0))
])
for cmd, expected in internal_commands.items():
......
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