aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/info/02_info_compiledata_pos.py
blob: 189fce17cba9a536bc93d2238065b2e64e4966dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/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) < 2:
        FAIL("Found invalid line: [%s]" % line)
    else:
        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_compiler
if not re.match("gcc version", map["cc_compiler"]):
    FAIL("Bad cc_compiler field: %s" % map["cc_compiler"])

# Check cc_compile_by
if 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?