1 | """ |
---|
2 | Script to run all the produce_results scripts in the Tests/xxx/xxx/ directories |
---|
3 | """ |
---|
4 | |
---|
5 | import os |
---|
6 | import anuga.utilities.system_tools as anugast |
---|
7 | import anuga |
---|
8 | import time |
---|
9 | |
---|
10 | from anuga.utilities.argparsing import parse_standard_args |
---|
11 | |
---|
12 | #-------------------------------- |
---|
13 | # Setup Default values for basis |
---|
14 | # algorithm parameters. |
---|
15 | #-------------------------------- |
---|
16 | alg, cfl = parse_standard_args() |
---|
17 | |
---|
18 | |
---|
19 | #--------------------------------- |
---|
20 | # Get the current svn revision |
---|
21 | #--------------------------------- |
---|
22 | |
---|
23 | timestamp = time.asctime() |
---|
24 | major_revision = anuga.config.major_revision |
---|
25 | minor_revision = anuga.utilities.system_tools.get_revision_number() |
---|
26 | |
---|
27 | |
---|
28 | #--------------------------------- |
---|
29 | # Run the tests |
---|
30 | #--------------------------------- |
---|
31 | buildroot = os.getcwd() |
---|
32 | |
---|
33 | Upper_dirs = os.listdir('./Tests') |
---|
34 | |
---|
35 | try: |
---|
36 | Upper_dirs.remove('.svn') |
---|
37 | except ValueError: |
---|
38 | pass |
---|
39 | #print Upper_dirs |
---|
40 | os.chdir('./Tests') |
---|
41 | |
---|
42 | for dir in Upper_dirs: |
---|
43 | |
---|
44 | os.chdir(dir) |
---|
45 | print 'Changing to', os.getcwd() |
---|
46 | Lower_dirs = os.listdir('.') |
---|
47 | try: |
---|
48 | Lower_dirs.remove('.svn') |
---|
49 | except ValueError: |
---|
50 | pass |
---|
51 | #print Lower_dirs |
---|
52 | for l_dir in Lower_dirs: |
---|
53 | os.chdir(l_dir) |
---|
54 | print 'Changing to', os.getcwd() |
---|
55 | try: |
---|
56 | cmd = 'python produce_results.py -alg %s -cfl %s '% (alg,cfl) |
---|
57 | print 'Running: '+cmd |
---|
58 | os.system( cmd ) |
---|
59 | except: |
---|
60 | print '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 | |
---|
69 | os.chdir('..') |
---|
70 | #---------------------------------- |
---|
71 | # Now it is ok to create the latex |
---|
72 | # macro file with run parameters |
---|
73 | #---------------------------------- |
---|
74 | |
---|
75 | f = open('saved_parameters.tex','w') |
---|
76 | f.write('\\newcommand{\\cfl}{\\UScore{%s}}\n' % str(cfl)) |
---|
77 | f.write('\\newcommand{\\alg}{\\UScore{%s}}\n' % str(alg)) |
---|
78 | f.write('\\newcommand{\\majorR}{\\UScore{%s}}\n' % str(major_revision)) |
---|
79 | f.write('\\newcommand{\\minorR}{\\UScore{%s}}\n' % str(minor_revision)) |
---|
80 | f.write('\\newcommand{\\timeR}{{%s}}\n' % str(timestamp)) |
---|
81 | |
---|
82 | f.close() |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | |
---|