Commit f5b60413 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

fm: Added support for Run One Test script

parent 572fc240
......@@ -19,6 +19,7 @@ all:
cp ubuntu/$(BOARD)/pyts/pts.py ubuntu/$(BOARD)/pts
cp ubuntu/$(BOARD)/pyts/jpts.py ubuntu/$(BOARD)/jpts
cp ubuntu/$(BOARD)/pyts/one.py ubuntu/$(BOARD)/one
ln -s pyts/dac_vcxo_pll.py ubuntu/$(BOARD)/test01.py
ln -s pyts/leds.py ubuntu/$(BOARD)/test02.py
ln -s pyts/ttl_pulse_switch.py ubuntu/$(BOARD)/test03.py
......
......@@ -108,7 +108,7 @@ if __name__ == '__main__':
parser.add_option("-l", "--lun", help="Logical Unit Number", type="int", default=ELMASLOT, dest="lun")
parser.add_option("-s", "--snum", help="Serial number(s)", dest="snum", action="store", nargs=2, default=("0","0"))
parser.add_option("-n", "--name", help="Board name", dest="board_name", default="ttlbl")
parser.add_option("-n", "--name", help="Board name", dest="board_name", default=BOARD)
parser.add_option("-b", "--bus", help="Bus VME/PCI/SKT", dest="bus_type", default="SKT")
parser.add_option("-o", "--outdir", help="Path to log directory", dest="dir_name", default=".")
parser.add_option("-d", "--debug", help="Debug Option", dest="debug", default=False, action="store_true")
......
......@@ -9,31 +9,71 @@ import subprocess
import re
sys.path.append('.')
sys.path.append("pyts/")
##-------------------------------------------------------------------------------------------------
## Method to turn on the VME crate.
##-------------------------------------------------------------------------------------------------
## It calls the men-on script which sends the necessary SMTP commands to the ELMA crate to turn on
## power to the VME backplane.
##-------------------------------------------------------------------------------------------------
def men_on():
print("Switching on the ELMA crate")
subprocess.call("shell/men-on", shell=True, stdout=fnull, stderr=fnull)
time.sleep(1)
##-------------------------------------------------------------------------------------------------
## Method to turn off the VME crate.
##-------------------------------------------------------------------------------------------------
## It calls the men-off script which sends the necessary SMTP commands to the ELMA crate to turn off
## power to the VME backplane.
##-------------------------------------------------------------------------------------------------
def men_off():
print("Switching off the ELMA crate")
subprocess.call("shell/men-off", shell=True, stdout=fnull, stderr=fnull)
time.sleep(1)
##-------------------------------------------------------------------------------------------------
## Main "method" of PTS
##-------------------------------------------------------------------------------------------------
if __name__ == '__main__':
print "\nHello and Welcome to the TTLBL PTS Run One Test!\n"
fnull = open(os.devnull, "w")
men_off()
tsts = [1,2,3,4,5,6,7,8,10,12,13,14,15,16,17]
tnum = input("--> Which test number:")
tnum = input("--> Which test number: ")
if tnum in tsts:
pass
else:
print "Sorry that test can't be run"
sys.exit(1)
tcnt = input("--> How many times to run test:")
tcnt = input("--> How many times to run test: ")
if tcnt < 0:
print "Sorry bad run count"
sys.exit(1)
cmd = "ssh -X pts@men /home/pts/ubuntu/ttlbl/jpts-run-one %d %d " % (tnum, tcnt)
subprocess.call(cmd, shell=True, stdout=fnull, stderr=fnull)
men_on()
print "Loading FPGA bitstream..."
ret = subprocess.call("cd boot; ./program", shell=True, stdout=fnull, stderr=fnull)
time.sleep(1)
if (ret != 0):
print "ERROR: Bitstream download fail. Check JTAG connectivity."
else:
# Run JPTS
cmd = "./jpts %d,%d" % (tnum, tcnt)
subprocess.call(cmd, shell=True, stdout=sys.stdout, stderr=sys.stderr)
cmd = "more log/*.log"
subprocess.call(cmd, shell=True, stdout=sys.stdout, stderr=sys.stderr)
cmd = "more /home/pts/ubuntu/ttlbl/log/*.log"
subprocess.call(cmd, shell=True, stdout=sys.stdout, stderr=sys.stderr)
men_off()
msg = "--> To exit PTS Run One Test, type 'ok': "
ok = raw_input(msg)
......
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