Last change
on this file since 7214 was
7017,
checked in by rwilson, 16 years ago
|
Improved reporting.
|
-
Property svn:executable set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[6991] | 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 | |
---|
[7017] | 9 | name = 'Running ANUGA test_all.py' |
---|
[6991] | 10 | |
---|
| 11 | def test(logfile): |
---|
| 12 | result = True |
---|
| 13 | |
---|
| 14 | (cluster, domain) = util.get_hostname() |
---|
| 15 | |
---|
[6993] | 16 | # get python to run |
---|
[6996] | 17 | python_env_var = os.getenv('PYTHON') |
---|
[6993] | 18 | |
---|
[6991] | 19 | # remember the directory we are in and go to ANUGA test directory |
---|
| 20 | home_directory = os.getcwd() |
---|
| 21 | pythonpath = os.getenv('PYTHONPATH') |
---|
[6996] | 22 | os.chdir(os.path.join(pythonpath, 'anuga')) |
---|
[6991] | 23 | |
---|
| 24 | # compile C code |
---|
[6996] | 25 | util.log_print_nl(logfile, '%s compile_all.py' % python_env_var) |
---|
| 26 | (_, fd) = os.popen4('%s compile_all.py' % python_env_var) |
---|
[6991] | 27 | compile_result = fd.read() |
---|
| 28 | status = fd.close() |
---|
| 29 | util.log_print(logfile, compile_result) |
---|
| 30 | |
---|
| 31 | # run test_all.py |
---|
[6996] | 32 | util.log_print_nl(logfile, '%s test_all.py' % python_env_var) |
---|
| 33 | (_, fd) = os.popen4('%s test_all.py' % python_env_var) |
---|
[6991] | 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.