~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/create/06_create_mem_neg.py

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
# Copyright (C) International Business Machines Corp., 2005
 
4
# Author: Li Ge <lge@us.ibm.com>
 
5
 
 
6
# Test Description:
 
7
# Negative Tests:
 
8
# Test 1: Test for creating domain with mem=0. Verify fail
 
9
# Test 2: Test for creating domain with mem>sys_mem. Verify fail
 
10
 
 
11
import sys
 
12
import re
 
13
import time
 
14
 
 
15
from XmTestLib import *
 
16
 
 
17
rdpath = os.environ.get("RD_PATH")
 
18
if not rdpath:
 
19
    rdpath = "../ramdisk"
 
20
 
 
21
# Test 1: create a domain with mem=0
 
22
config1 = {"memory": 0}
 
23
domain1=XmTestDomain(extraConfig=config1)
 
24
 
 
25
try:
 
26
    domain1.start(noConsole=True)
 
27
    eyecatcher1 = "Created"
 
28
except DomainError, e:
 
29
    eyecatcher1 = "Fail"
 
30
 
 
31
if eyecatcher1 != "Fail":
 
32
    domain1.stop()
 
33
    FAIL("xm create let me create a domain with 0 memory")
 
34
 
 
35
 
 
36
# Test 2: create a domain with mem>sys_mem
 
37
 
 
38
mem = int(getInfo("total_memory"))
 
39
extreme_mem = mem + 100
 
40
 
 
41
config2 = {"memory": extreme_mem}
 
42
domain2=XmTestDomain(extraConfig=config2)
 
43
 
 
44
try:
 
45
    domain2.start(noConsole=True)
 
46
    eyecatcher2 = "Created"
 
47
except DomainError, e:
 
48
    eyecatcher2 = "Fail"
 
49
 
 
50
if eyecatcher2 != "Fail":
 
51
    domain2.stop()
 
52
    FAIL("xm create let me create a domain with mem > sys_mem")
 
53