source: trunk/anuga_core/validation_tests/produce_results.py @ 8533

Last change on this file since 8533 was 8533, checked in by steve, 12 years ago

A few enhancements to valuidation tests

File size: 2.3 KB
Line 
1"""
2Script to run all the produce_results scripts in the Tests/xxx/xxx/ directories
3"""
4
5import os
6import anuga
7import time
8from anuga import indent
9
10#--------------------------------
11# Get Default values for
12# algorithm parameters.
13#--------------------------------
14from parameters import alg
15from parameters import cfl
16
17#---------------------------------
18# Get the current svn revision
19#---------------------------------
20timestamp = time.asctime()
21major_revision = anuga.config.major_revision
22minor_revision = anuga.utilities.system_tools.get_revision_number()
23
24#---------------------------------
25# Run the tests
26#---------------------------------
27buildroot = os.getcwd()
28
29Upper_dirs = os.listdir('./Tests')
30
31try:
32    Upper_dirs.remove('.svn')
33except ValueError:
34    pass
35#print Upper_dirs
36os.chdir('./Tests')
37
38print 'Tests'
39for dir in Upper_dirs:
40
41    os.chdir(dir)
42
43    print indent + dir
44    #print 'Changing to', os.getcwd()
45    Lower_dirs = os.listdir('.')
46    try:
47        Lower_dirs.remove('.svn')
48    except ValueError:
49        pass
50    #print Lower_dirs
51    for l_dir in Lower_dirs:
52        os.chdir(l_dir)
53        #print os.getcwd()
54        print 2*indent + l_dir
55        try:
56            cmd = 'python produce_results.py'
57            print 3*indent + 'Running: '+cmd
58            os.system( cmd )
59        except:
60            print 3*indent + 'Failed running produce_results in '+os.getcwd()
61            pass
62
63        os.chdir('..')
64        #print 'Changing to', os.getcwd()
65
66    os.chdir('..')
67    #print 'Changing to', os.getcwd()
68   
69os.chdir('..')
70#----------------------------------
71# Now it is ok to create the latex
72# macro file with run parameters
73#----------------------------------
74
75f = open('saved_parameters.tex','w')
76f.write('\\newcommand{\\cfl}{\\UScore{%s}}\n' % str(cfl))
77f.write('\\newcommand{\\alg}{\\UScore{%s}}\n' % str(alg))
78f.write('\\newcommand{\\majorR}{\\UScore{%s}}\n' % str(major_revision))
79f.write('\\newcommand{\\minorR}{\\UScore{%s}}\n' % str(minor_revision))
80f.write('\\newcommand{\\timeR}{{%s}}\n' % str(timestamp))
81
82f.close()
83
84
85cmd = 'pdflatex -shell-escape -interaction=batchmode report.tex'
86print cmd
87import subprocess
88subprocess.call( [cmd], shell=True )
89cmd = 'mv report.pdf report_cfl_%s_alg_%s.pdf' % (str(cfl), str(alg))
90print cmd
91subprocess.call( [cmd] , shell=True )
92
93
94
95
96
Note: See TracBrowser for help on using the repository browser.