source: misc/tools/acceptance_tests/test_validate_anuga.py @ 7664

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

more tests

File size: 1.5 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 validate_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    os.chdir(os.path.join(ANUGAPATH, '..','..', 'anuga_validation',
32                          'automated_validation_tests'))
33   
34    # run validate_all.py
35    util.log_print_nl(logfile, '%s validate_all.py' % python_env_var)
36    (_, fd) = os.popen4('%s validate_all.py' % python_env_var)
37    test_result = fd.read()
38    status = fd.close()
39    util.log_print(logfile, test_result)
40   
41    # return to original directory
42    os.chdir(home_directory)
43
44    return result
45
46
47if __name__ == '__main__':
48    import sys
49
50    home_directory = os.getcwd()
51    logfile = os.path.join(home_directory, 'test.log')
52    if len(sys.argv) > 1:
53        logfile = sys.argv[1]
54
55    try:
56        os.remove(logfile)
57    except:
58        pass
59
60    if not test(logfile):
61        sys.exit(10)
62
63    sys.exit(0)
Note: See TracBrowser for help on using the repository browser.