Last change
on this file since 7293 was
7017,
checked in by rwilson, 16 years ago
|
Improved reporting.
|
-
Property svn:executable set to
*
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6991] | 1 | #!/bin/env python |
---|
| 2 | |
---|
| 3 | '''Testlet to check that various filesystems are accessible''' |
---|
| 4 | |
---|
| 5 | import os |
---|
| 6 | import time |
---|
| 7 | import test_utils as util |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | # paths we are testig |
---|
| 11 | Test_Paths = ('/nas/gemd/georisk_models', |
---|
| 12 | ) |
---|
| 13 | |
---|
[7017] | 14 | name = 'Test of filesystem accessibility' |
---|
| 15 | |
---|
[6991] | 16 | def test(logfile): |
---|
| 17 | result = True |
---|
| 18 | |
---|
| 19 | (cluster, domain) = util.get_hostname() |
---|
| 20 | |
---|
[6993] | 21 | # get python to run |
---|
[6996] | 22 | python_env_var = os.getenv('PYTHON') |
---|
[6991] | 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 | |
---|
| 41 | if __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.