source: branches/numpy_misc/tools/acceptance_tests/test_all.py @ 7025

Last change on this file since 7025 was 7025, checked in by rwilson, 11 years ago

Added EQRM to acceptance suite.

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/bin/env python
2
3'''Run all acceptance tests in order.'''
4
5import os
6import sys
7import time
8import shutil
9import test_utils as util
10
11
12# the test files, in desired order
13Tests = ['test_dump_python_environment.py',
14         'test_python_packages.py',
15         'test_filesystem_accessibility.py',
16         'test_ssh_to_compute_nodes.py',
17         'test_quadrature_parallel_interleaved.py',
18         'test_latency_bandwidth.py',
19         'test_test_pypar.py',
20#         'test_inter_latency.py',
21         'test_test_all.py',
22         'test_eqrm.py',
23        ]
24
25
26if __name__ == '__main__':
27    home_directory = os.getcwd()
28    logfile = os.path.join(home_directory, 'test.log')
29    if len(sys.argv) > 1:
30        logfile = sys.argv[1]
31
32    try:
33        os.remove(logfile)
34    except:
35        pass
36
37    # make sure we are running on a cluster machine
38    (hostname, _) = util.get_hostname()
39    cluster_info = util.get_cluster_info(hostname)
40    if cluster_info is None:
41        util.log_print_nl(logfile,
42                          'Sorry, you must be running on a cluster master node.')
43        util.log_print_nl(logfile, "You are on machine '%s'." % hostname)
44        sys.exit(10)
45
46    # copy machines_<name> files from here to ~
47    home = os.getenv('HOME')
48    if not home:
49        util.log_print_nl(logfile, "Sorry, you don't have the 'HOME' environment variable set.")
50        sys.exit(10)
51    machine_file = 'machines_%s' % hostname
52    shutil.copyfile(machine_file, os.path.join(home, '.'+machine_file))
53
54    # make sure environment variables are set
55    python = os.getenv('PYTHON')
56    pythonpath = os.getenv('PYTHONPATH')
57    eqrmpath = os.getenv('EQRMPATH')
58    if eqrmpath is None:
59        eqrmpath = ''
60    if not python or not pythonpath:
61        if not python:
62            util.log_print_nl(logfile, 'Sorry, you must set the PYTHON environment variable.')
63        if not pythonpath:
64            util.log_print_nl(logfile, 'Sorry, you must set the PYTHONPATH environment variable.')
65        sys.exit(10)
66
67    # make sure all OK with user
68    print '*' * 80
69    print '* Acceptance test for %s cluster' % hostname
70    print '*' * 80
71    print ''
72    print 'PYTHON=%s' % python
73    print 'PYTHONPATH=%s' % pythonpath
74    print 'EQRMPATH=%s' % eqrmpath
75    print ''
76    res = raw_input('This test will run with the above environment variables, OK? ')
77    if len(res) == 0 or res[0].upper() != 'Y':
78        sys.exit(10)
79    print ''
80
81    # put header on log
82    util.log_nl(logfile, '#' * 80)
83    util.log_nl(logfile, '# Acceptance test of cluster %s' % hostname)
84    util.log_nl(logfile, '#' * 80)
85    util.log_nl(logfile)
86
87    # run the tests
88    for test_module in Tests:
89        (import_name, _) = test_module.split('.', 1)
90        import_code = 'import %s as test' % import_name
91
92        exec import_code
93
94        start_time = time.time()
95        test_name = test.name
96        util.header(logfile, test_module, '%s on %s.' % (test_name, hostname))
97        #test_code = ("test.test('%s')" % logfile)
98
99        test.test(logfile)
100        #exec test_code
101
102        util.footer(logfile, start_time)
Note: See TracBrowser for help on using the repository browser.