本文整理汇总了Python中sandbox.Sandbox.get_root方法的典型用法代码示例。如果您正苦于以下问题:Python Sandbox.get_root方法的具体用法?Python Sandbox.get_root怎么用?Python Sandbox.get_root使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sandbox.Sandbox
的用法示例。
在下文中一共展示了Sandbox.get_root方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from sandbox import Sandbox [as 别名]
# 或者: from sandbox.Sandbox import get_root [as 别名]
#.........这里部分代码省略.........
del argv[i]
for i, arg in enumerate(argv):
if arg == '--repo':
repo = argv[i + 1]
del argv[i]
del argv[i]
if global_vars.ea and ip and user and passwd:
setup.setSetupFile()
setup.configAppliance(global_vars.ea, ip, user, passwd)
#make sure we're creating a new PSA if an appliance sandbox type is being used
if 'appliance' in sb.get_sandboxtype().get_variant():
global_vars.ea = 'sb-test-appliance'
if '--recreate-psa' not in argv and global_vars.ea in isetup.getAppliances():
argv.append('--recreate-psa')
isetup.setSetupFile()
#create the appliance if the appliance doesn't exist in the setup file
if global_vars.ea and global_vars.ea not in isetup.getAppliances():
ansi.printc('Appliance %s does not exist, will attempt to create it in 5 seconds, push ctrl+c to cancel' % global_vars.ea, colors.WARNING_COLOR)
time.sleep(5)
ip = controlVM.createPSA(global_vars.ea, branding, release, repo)
isetup.setAppliance(global_vars.ea, ip, 'root', 'psa')
if '--recreate-psa' in argv:
assert global_vars.ea, 'A VM must be specified with the --ea option to use the --recreate-psa option'
controlVM.createPSA(global_vars.ea, branding, release, repo)
argv.remove('--recreate-psa')
# Support "modes" of tests. This allows us to run a set of tests in
# more than one way -- for example, with valgrind enabled or disabled,
# or with SearchServer using hs5 versus hs3.
mode_path = os.path.join(sb.get_root(), _MODE_FILE)
argv, modes = get_modes(argv)
if os.path.isfile(mode_path):
os.remove(mode_path)
if modes:
if modes[0].lower() != 'none':
with open(mode_path, 'w') as f:
f.write(','.join(modes))
attr_arg = find_attr_arg_index(argv)
if len(modes) == 0 and attr_arg is None:
modeattrs = sb.get_sandboxtype().get_test_mode_attrs_combo()
result = 0
runcompiled = True
runcodescan = True
for modeattr in modeattrs.split(';'):
runnable_assembly._modes = None
if modeattr.find(':') == -1:
if len(modeattr) > 3:
print('Skipping mode+attr combo "%s" because no separator ":" was found' % modeattr)
continue
print('Running mode+attr combo: %s' % modeattr)
mode, attrs = modeattr.split(':')
argnew = argv[:]#copy argv into argnew so we can append things for this round of tests
argnew.insert(1, '-A')
argnew.insert(2, attrs.strip())
argnew.insert(3, '--mode')
argnew.insert(4, mode.strip())
if not runcompiled:
argnew.append('--skip-compiled')
if not runcodescan:
argnew.append('--skip-codescan')
result = result + main(argnew);