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
|
import sys
import subprocess
import os
import os.path
sys.path.append("../doc/examples")
import gfs2tex
env = "export PYTHONPATH=$PYTHONPATH:" + os.getcwd() + " &&"
n = 0
failed = 0
for start in sys.argv[1:]:
for root, dirs, files in os.walk(start,topdown=True):
if not ".xvpics" in root:
test = gfs2tex.Example(root)
status,msg = test.run(env)
if status != None:
print("FAIL:",root)
if len(msg) > 0:
print(" ".join(msg))
print("{\color{Red}FAIL}:", file=open(test.path + "/status",'w'))
failed += 1
else:
print("PASS:",root)
print("{\color{OliveGreen}PASS}:", file=open(test.path + "/status",'w'))
n += 1
if failed:
msg = repr(failed) + " of " + repr(n) + " tests failed"
else:
msg = "All " + repr(n) + " tests passed"
print(len(msg)*"=")
print(msg)
print(len(msg)*"=")
if failed:
sys.exit(1)
|