FPGA_GenericIP/firmware/top/scripts/vptest.py

46 lines
1,006 B
Python

import sys
import os
import subprocess
# ---------------------------------------------------------
# Check the result
# ---------------------------------------------------------
def check_results(runLogName) :
failed = True
searchfile = open(runLogName, 'r')
for line in searchfile:
if 'SUCCESS' in line:
failed = False
print 'Test appears to have been successful.'
break
searchfile.close()
return failed
def run () :
# ----------------------------------------------
# Run the simulation
if len(sys.argv) == 1 :
status = subprocess.call(['mingw32-make', 'run'])
else :
status = subprocess.call(['mingw32-make', ''.join(sys.argv[1:]), 'run'])
if status != 0 :
return status
# ----------------------------------------------
# Check the result
failed = check_results('sim.log')
if failed :
exit(1)
else :
exit(0)
run()