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

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

Using do_tests_checks_demos_audits from EQRM in cluster test_eqrm.py acceptance test. It now relies EQRM being in the pythonpath environment variable.

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