mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Factor out the parsing of XAUTHORITY, so that it can be used by the unit test,
and fix that test to use it. Signed-off-by: Ewan Mellor <ewan@xensource.com>
This commit is contained in:
1 parent
d5ed151f12
commit
45bd0044c4
2 files changed
+20
-8
No files matched your search
@@ -850,6 +850,18 @@ def make_domain(opts, config):
|
||||
opts.info("Started domain %s" % (dom))
|
||||
return int(sxp.child_value(dominfo, 'domid'))
|
||||
|
||||
|
||||
def get_xauthority():
|
||||
xauth = os.getenv("XAUTHORITY")
|
||||
if not xauth:
|
||||
home = os.getenv("HOME")
|
||||
if not home:
|
||||
import posix, pwd
|
||||
home = pwd.getpwuid(posix.getuid())[5]
|
||||
xauth = home + "/.Xauthority"
|
||||
return xauth
|
||||
|
||||
|
||||
def parseCommandLine(argv):
|
||||
gopts.reset()
|
||||
args = gopts.parse(argv)
|
||||
@@ -864,14 +876,7 @@ def parseCommandLine(argv):
|
||||
gopts.vals.display = os.getenv("DISPLAY")
|
||||
|
||||
if not gopts.vals.xauthority:
|
||||
xauth = os.getenv("XAUTHORITY")
|
||||
if not xauth:
|
||||
home = os.getenv("HOME")
|
||||
if not home:
|
||||
import posix, pwd
|
||||
home = pwd.getpwuid(posix.getuid())[5]
|
||||
xauth = home + "/.Xauthority"
|
||||
gopts.vals.xauthority = xauth
|
||||
gopts.vals.xauthority = get_xauthority()
|
||||
|
||||
# Process remaining args as config variables.
|
||||
for arg in args:
|
||||
|
||||
@@ -51,6 +51,7 @@ class test_create(unittest.TestCase):
|
||||
'path' : '.:/etc/xen',
|
||||
'builder' : 'linux',
|
||||
'nics' : -1,
|
||||
'xauthority': xen.xm.create.get_xauthority(),
|
||||
})
|
||||
|
||||
|
||||
@@ -99,6 +100,8 @@ on_crash = 'destroy'
|
||||
'interface' : 'eth0',
|
||||
'path' : '.:/etc/xen',
|
||||
'builder' : 'linux',
|
||||
|
||||
'xauthority' : xen.xm.create.get_xauthority(),
|
||||
})
|
||||
|
||||
|
||||
@@ -138,6 +141,8 @@ cpu_weight = 0.75
|
||||
'path' : '.:/etc/xen',
|
||||
'builder' : 'linux',
|
||||
'nics' : -1,
|
||||
|
||||
'xauthority' : xen.xm.create.get_xauthority(),
|
||||
})
|
||||
|
||||
|
||||
@@ -188,6 +193,8 @@ ne2000=0
|
||||
'dhcp' : 'off',
|
||||
'interface' : 'eth0',
|
||||
'path' : '.:/etc/xen',
|
||||
|
||||
'xauthority' : xen.xm.create.get_xauthority(),
|
||||
})
|
||||
|
||||
|
||||
|
||||