1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
|
#!/usr/bin/python
import os
import sys
import re
import glob
import string
# list of tests to run ...
# prefixes
# C = command line scripts
# G = graphics and internal GUI
standard_prefixes = ['C', 'G' ]
# set module path for generic python stuff
ppath = ''
if os.environ.has_key('PYTHONPATH'):
ppath = os.environ['PYTHONPATH']
ppath = ppath + ":" + os.getcwd() + "/../modules"
os.environ['PYTHONPATH'] = ppath
# uniform parameter handling
argv = sys.argv
if len(argv):
if re.search("\.py$",argv[0]):
argv = argv[1:]
# ---
pymol = "pymol"
cmd = "../pymol.com "
cmp = "cmp"
ref = "ref"
inp = "inp"
if not os.path.exists(cmp):
os.mkdir(cmp)
if len(argv)>1:
tests = argv
else:
tests = standard_prefixes
for test in tests:
flist = glob.glob( inp+"/"+test+"*" )
cvs = inp+"/CVS"
if cvs in flist:
flist.remove(cvs)
flist.sort()
for ifil in flist:
# get options
f = open(ifil)
opt = string.strip(f.readline())
opt = re.sub("^\s*\#","",opt)
f.close()
tst = re.sub(r".*/","",ifil) # get exact test name without suffix
tst = re.sub(r"\..*","",tst)
print " run_tests: "+tst+"..."
syscmd = cmd+" "+opt+" "+ifil+" | python trim.py | tee "+cmp+"/"+tst+".log 2>&1"
os.system(syscmd)
# check log file and any other output files
for ref_fil in ( glob.glob(ref+"/"+tst+".*")):
postfx = re.sub(r".*/","",ref_fil)
cmp_fil = cmp+"/"+postfx
if os.path.exists(cmp_fil):
if os.system("diff -q "+ref_fil+" "+cmp_fil+" >/dev/null"):
sys.stdout.flush()
df = os.popen("diff "+ref_fil+" "+cmp_fil)
diffs = df.readlines()
df.close()
print " run_tests: "+ \
postfx+" DIFFERS over about %d lines." % int(len(diffs)/2)
else:
print " run_tests: "+postfx+" is missing."
# check for extraneous, unverifiable files
for cmp_fil in ( glob.glob(cmp+"/"+tst+".*")):
postfx = re.sub(r".*/","",cmp_fil)
ref_fil = ref+"/"+postfx
if not os.path.exists(ref_fil):
print " run_tests: no reference version for "+cmp+"/"+postfx+"."
|