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

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

Updating acceptance test files. Still pre-2010 tests.

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