02_info_compiledata_pos.py

来自「xen 3.2.2 源码」· Python 代码 · 共 43 行

PY
43
字号
#!/usr/bin/python# Copyright (C) International Business Machines Corp., 2005# Author: Dan Smith <danms@us.ibm.com>import re;from XmTestLib import *status, output = traceCommand("xm info")output = re.sub(" +", " ", output)lines = output.split("\n")map = {}for line in lines:    pieces = line.split(" : ", 1)    if len(pieces) > 1:        map[pieces[0]] = pieces[1]for field in ["cores_per_socket", "threads_per_core", "cpu_mhz",              "total_memory", "free_memory", "xen_major", "xen_minor",              "xen_pagesize"]:    val = map[field]    if not val.isdigit():        FAIL("Numeric field %s not all-numbers: %s" % (field, val))# Check cc_compilerif not re.match("gcc version", map["cc_compiler"]):    FAIL("Bad cc_compiler field: %s" % map["cc_compiler"])# Check cc_compile_byif not re.match("[A-z0-9_]+", map["cc_compile_by"]):    FAIL("Bad cc_compile_by field: %s" % map["cc_compile_by"])# Check cc_compile_domain# --- What should it look like?

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?