source: misc/tools/acceptance_tests/test_test_all.py @ 7656

Last change on this file since 7656 was 7656, checked in by gray, 14 years ago

Updating acceptance test files. Still pre-2010 tests.

  • 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
5import os
6import time
7import test_utils as util
8
9name = 'Running ANUGA test_all.py'
10
11def 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    ANUGAPATH = os.getenv('ANUGAPATH')
22    os.chdir(os.path.join(ANUGAPATH, '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
44if __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.