aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xm-test/tests/create/06_create_mem_neg.py
blob: f8bc946bcde592510fd606c35f4f6f4d365b3443 (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
45
46
47
48
49
50
51
52
53
#!/usr/bin/python

# Copyright (C) International Business Machines Corp., 2005
# Author: Li Ge <lge@us.ibm.com>

# Test Description:
# Negative Tests:
# Test 1: Test for creating domain with mem=0. Verify fail
# Test 2: Test for creating domain with mem>sys_mem. Verify fail

import sys
import re
import time

from XmTestLib import *

rdpath = os.environ.get("RD_PATH")
if not rdpath:
	rdpath = "../ramdisk"

# Test 1: create a domain with mem=0
config1 = {"memory": 0}
domain1=XmTestDomain(extraConfig=config1)

try:
    domain1.start(noConsole=True)
    eyecatcher1 = "Created"
except DomainError, e:
    eyecatcher1 = "Fail"

if eyecatcher1 != "Fail":
	domain1.stop()
        FAIL("xm create let me create a domain with 0 memory")


# Test 2: create a domain with mem>sys_mem

mem = int(getInfo("total_memory"))
extreme_mem = mem + 100

config2 = {"memory": extreme_mem}
domain2=XmTestDomain(extraConfig=config2)

try:
    domain2.start(noConsole=True)
    eyecatcher2 = "Created"
except DomainError, e:
    eyecatcher2 = "Fail"

if eyecatcher2 != "Fail":
        domain2.stop()
        FAIL("xm create let me create a domain with mem > sys_mem")