source: branches/numpy_misc/tools/acceptance_tests/test_eqrm.py @ 7230

Last change on this file since 7230 was 7079, checked in by rwilson, 16 years ago

Changed test to force a compile before testing.

  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/bin/env python
2
3'''Testlet to run the EQRM 'test_all.py' script.'''
4
5import os
6import time
7import test_utils as util
8
9name = 'Running EQRM 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 EQRM test directory
20    home_directory = os.getcwd()
21    eqrm_path = os.getenv('EQRMPATH')
22    if not eqrm_path:
23        util.log_print_nl(logfile, "The EQRMPATH environment variable not set, "
24                                   "can't test EQRM.")
25        return False
26
27    os.chdir(os.path.join(eqrm_path))
28    print 'in %s' % os.getcwd()
29
30    # run clean_all.py
31    util.log_print_nl(logfile, '%s clean_all.py' % python_env_var)
32    (fd_in, fd_out) = os.popen4('%s clean_all.py' % python_env_var)
33    fd_in.write('y\n')
34    fd_in.close()
35    clean_result = fd_out.read()
36    fd_out.close()
37    util.log_print(logfile, clean_result)
38
39    # run test_all.py
40    util.log_print_nl(logfile, '%s test_all.py' % python_env_var)
41    (_, fd_out) = os.popen4('%s test_all.py' % python_env_var)
42    test_result = fd_out.read()
43    status = fd_out.close()
44    util.log_print(logfile, test_result)
45
46    # return to original directory
47    os.chdir(home_directory)
48
49    return result
50
51
52if __name__ == '__main__':
53    import sys
54
55    home_directory = os.getcwd()
56    logfile = os.path.join(home_directory, 'test.log')
57    if len(sys.argv) > 1:
58        logfile = sys.argv[1]
59
60    try:
61        os.remove(logfile)
62    except:
63        pass
64
65    if not test(logfile):
66        sys.exit(10)
67
68    sys.exit(0)
Note: See TracBrowser for help on using the repository browser.