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

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

Updating acceptance test files. Still pre-2010 tests.

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/bin/env python
2
3"""Testlet to check that various filesystems are accessible"""
4
5import os
6import time
7import test_utils as util
8
9
10# paths we are testig
11Test_Paths = ('/nas/gemd/georisk_models',
12             )
13
14name = 'Test of filesystem accessibility'
15
16def test(logfile):
17    result = True
18
19    (cluster, domain) = util.get_hostname()
20
21    # get python to run
22    python_env_var = os.getenv('PYTHON')
23
24    # get max width of the filesystem paths
25    width = 0
26    for path in Test_Paths:
27        width = max(len(path), width)
28
29    # test each path
30    for path in Test_Paths:
31        util.log_print(logfile, "Testing: %s" % path.ljust(width+2))
32        if os.path.isdir(path):
33            util.log_print_nl(logfile, 'OK')
34        else:
35            util.log_print_nl(logfile, 'NOT ACCESSIBLE')
36            result = False
37
38    return result
39
40
41if __name__ == '__main__':
42    import sys
43
44    logfile = 'test.log'
45    if len(sys.argv) > 1:
46        logfile = sys.argv[1]
47
48    try:
49        os.remove(logfile)
50    except:
51        pass
52
53    if not test(logfile):
54        sys.exit(10)
55
56    sys.exit(0)
57
Note: See TracBrowser for help on using the repository browser.