Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / lib / python2.4 / test / test_nis.py
CommitLineData
86530b38
AT
1from test.test_support import verbose, TestFailed, TestSkipped
2import nis
3
4print 'nis.maps()'
5try:
6 maps = nis.maps()
7except nis.error, msg:
8 # NIS is probably not active, so this test isn't useful
9 if verbose:
10 raise TestFailed, msg
11 # only do this if running under the regression suite
12 raise TestSkipped, msg
13
14done = 0
15for nismap in maps:
16 if verbose:
17 print nismap
18 mapping = nis.cat(nismap)
19 for k, v in mapping.items():
20 if verbose:
21 print ' ', k, v
22 if not k:
23 continue
24 if nis.match(k, nismap) != v:
25 print "NIS match failed for key `%s' in map `%s'" % (k, nismap)
26 else:
27 # just test the one key, otherwise this test could take a
28 # very long time
29 done = 1
30 break
31 if done:
32 break