debuggers.hg

view tools/xm-test/tests/security-acm/02_security-acm_dom_start.py @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2006
4 # Author: Stefan Berger <stefanb@us.ibm.com>
5 #
6 # Simple test that starts two labeled domains; both domains should start
7 #
8 # The following xm subcommands are tested:
9 # - dumppolicy
10 # - labels
12 from XmTestLib import *
13 from acm_utils import *
14 import commands
15 import os
17 testlabel1 = "green"
18 testlabel2 = "red"
20 status, output = traceCommand("xm labels")
22 labels = ["SystemManagement", "blue", "red", "green"]
23 for l in labels:
24 if not re.search(l, output):
25 FAIL("Label '%s' not found in current policy!", l)
27 status, output = traceCommand("xm dumppolicy")
28 if status != 0:
29 FAIL("'xm dumppolicy' returned an error code.")
30 lines = ["ssidref 0: 00 00 00 00",
31 "ssidref 1: 01 00 00 00",
32 "ssidref 2: 00 01 00 00",
33 "ssidref 3: 00 00 01 00",
34 "ssidref 4: 00 00 00 01"]
35 for l in lines:
36 if not re.search(l, output):
37 FAIL("Could not find '%s' in output of 'xm dumppolicy'" % l)
39 config = {"access_control":"policy=%s,label=%s" % (testpolicy,testlabel1)}
40 verbose = True
41 domain1 = XmTestDomain(name="domain-%s" % testlabel1,
42 extraConfig=config)
44 try:
45 domain1.start(noConsole=True)
46 except DomainError, e:
47 if verbose:
48 print e.extra
49 FAIL("Unable to start 1st labeled test domain.")
51 config = {"access_control":"policy=%s,label=%s" % (testpolicy,testlabel2)}
53 domain2 = XmTestDomain(name="domain-%s" % testlabel2,
54 extraConfig=config)
56 try:
57 domain2.start(noConsole=True)
58 except DomainError, e:
59 if verbose:
60 print e.extra
61 FAIL("Unable to start 2nd labeled test domain.")
63 domain2.destroy()
64 domain1.destroy()