source: misc/tools/acceptance_tests/test_ssh_to_compute_nodes.py @ 7276

Last change on this file since 7276 was 7276, checked in by ole, 15 years ago

Merged numpy branch back into the trunk.

In ~/sandpit/anuga/anuga_core/source
svn merge -r 6246:HEAD ../../branches/numpy .

In ~/sandpit/anuga/anuga_validation
svn merge -r 6417:HEAD ../branches/numpy_anuga_validation .

In ~/sandpit/anuga/misc
svn merge -r 6809:HEAD ../branches/numpy_misc .

For all merges, I used numpy version where conflicts existed

The suites test_all.py (in source/anuga) and validate_all.py passed using Python2.5 with numpy on my Ubuntu Linux box.

  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/env python
2
3'''Testlet to check that can ssh to each subordinate node of the cluster.'''
4
5import os
6import time
7import test_utils as util
8
9name = 'Test of compute-node accessibility via ssh'
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    # get cluster-specific information
20    cluster_dict = util.get_cluster_info(cluster)
21    if cluster_dict is None:
22        util.log_print_nl(logfile, 'Sorry, you must be on one of these clusters:')
23        for name in Cluster_Info:
24            util.log_print_nl(logfile, '\t%s' % name)
25        util.log_print_nl(logfile, 'You are on the %s machine.' % cluster)
26        return False
27
28    # get max width of the compute node names
29    width = len(cluster_dict['node_stem']) + len(str(cluster_dict['num_nodes']))
30
31    # get list of non-bad nodes
32    test_nodes = util.get_node_numbers(cluster, strip_bad_nodes=True)
33
34    # test each node
35    for node_num in test_nodes:
36        node_name = cluster_dict['node_stem'] % node_num
37        util.log_print(logfile, "Testing: %s" % node_name.ljust(width+2))
38        (_, fd) = os.popen4('ssh %s exit' % node_name)
39        data = fd.read()
40        status = fd.close()
41        #if status is None:
42        if len(data) == 0:
43            util.log_print_nl(logfile, 'OK')
44        else:
45            util.log_print(logfile, data)
46            result = False
47
48    return result
49
50
51if __name__ == '__main__':
52    import sys
53
54    logfile = 'test.log'
55    if len(sys.argv) > 1:
56        logfile = sys.argv[1]
57
58    try:
59        os.remove(logfile)
60    except:
61        pass
62
63    if not test(logfile):
64        sys.exit(10)
65
66    sys.exit(0)
Note: See TracBrowser for help on using the repository browser.