Last change
on this file since 7244 was
7017,
checked in by rwilson, 16 years ago
|
Improved reporting.
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Line | |
---|
1 | #!/bin/env python |
---|
2 | |
---|
3 | '''Testlet to run the 'test_all.py' ANUGA script.''' |
---|
4 | |
---|
5 | import os |
---|
6 | import time |
---|
7 | import test_utils as util |
---|
8 | |
---|
9 | name = 'Running ANUGA test_all.py' |
---|
10 | |
---|
11 | def test(logfile): |
---|
12 | result = True |
---|
13 | |
---|
14 | (cluster, domain) = util.get_hostname() |
---|
15 | |
---|
16 | # get python to run |
---|
17 | python_env_var = os.getenv('PYTHON') |
---|
18 | |
---|
19 | # remember the directory we are in and go to ANUGA test directory |
---|
20 | home_directory = os.getcwd() |
---|
21 | pythonpath = os.getenv('PYTHONPATH') |
---|
22 | os.chdir(os.path.join(pythonpath, 'anuga')) |
---|
23 | |
---|
24 | # compile C code |
---|
25 | util.log_print_nl(logfile, '%s compile_all.py' % python_env_var) |
---|
26 | (_, fd) = os.popen4('%s compile_all.py' % python_env_var) |
---|
27 | compile_result = fd.read() |
---|
28 | status = fd.close() |
---|
29 | util.log_print(logfile, compile_result) |
---|
30 | |
---|
31 | # run test_all.py |
---|
32 | util.log_print_nl(logfile, '%s test_all.py' % python_env_var) |
---|
33 | (_, fd) = os.popen4('%s test_all.py' % python_env_var) |
---|
34 | test_result = fd.read() |
---|
35 | status = fd.close() |
---|
36 | util.log_print(logfile, test_result) |
---|
37 | |
---|
38 | # return to original directory |
---|
39 | os.chdir(home_directory) |
---|
40 | |
---|
41 | return result |
---|
42 | |
---|
43 | |
---|
44 | if __name__ == '__main__': |
---|
45 | import sys |
---|
46 | |
---|
47 | home_directory = os.getcwd() |
---|
48 | logfile = os.path.join(home_directory, 'test.log') |
---|
49 | if len(sys.argv) > 1: |
---|
50 | logfile = sys.argv[1] |
---|
51 | |
---|
52 | try: |
---|
53 | os.remove(logfile) |
---|
54 | except: |
---|
55 | pass |
---|
56 | |
---|
57 | if not test(logfile): |
---|
58 | sys.exit(10) |
---|
59 | |
---|
60 | sys.exit(0) |
---|
Note: See
TracBrowser
for help on using the repository browser.