1 | #!/usr/bin/python |
---|
2 | |
---|
3 | # Copyright (C) International Business Machines Corp., 2005 |
---|
4 | # Author: Woody Marvel <marvel@us.ibm.com> |
---|
5 | ## |
---|
6 | ## Description: |
---|
7 | ## Test xm mem-set output and status |
---|
8 | ## Negative Tests: |
---|
9 | ## 1) Test xm mem_set (no parm) |
---|
10 | ## 2) Test xm list (non existent parm) |
---|
11 | ## 3) Test xm list (non existent domain) |
---|
12 | ## |
---|
13 | ## |
---|
14 | ## Author: Woody Marvel marvel@us.ibm.com |
---|
15 | ## |
---|
16 | |
---|
17 | import re |
---|
18 | |
---|
19 | from XmTestLib import * |
---|
20 | |
---|
21 | if ENABLE_HVM_SUPPORT: |
---|
22 | SKIP("Mem-set not supported for HVM domains") |
---|
23 | |
---|
24 | # destroy no parm input - negative test |
---|
25 | status, output = traceCommand("xm mem-set") |
---|
26 | eyecatcher = "Error:" |
---|
27 | where = output.find(eyecatcher) |
---|
28 | if status == 0: |
---|
29 | FAIL("xm mem-set returned invalid %i == 0" % status) |
---|
30 | elif where == -1: |
---|
31 | FAIL("xm mem-set failed to report error for missing arg") |
---|
32 | |
---|
33 | # destroy non existent parm input - negative test |
---|
34 | status, output = traceCommand("xm mem-set -x") |
---|
35 | where = output.find(eyecatcher) |
---|
36 | if status == 0: |
---|
37 | FAIL("xm mem-set returned invalid %i == 0" % status) |
---|
38 | elif where == -1: |
---|
39 | FAIL("xm mem-set failed to report error for bad arg") |
---|
40 | |
---|
41 | # destroy non existent domain - negative test |
---|
42 | status, output = traceCommand("xm mem-set 6666") |
---|
43 | where = output.find(eyecatcher) |
---|
44 | if status == 0: |
---|
45 | FAIL("xm mem-set returned invalid %i == 0" % status) |
---|
46 | elif where == -1: |
---|
47 | FAIL("xm mem-set failed to report error for invalid domid") |
---|
48 | |
---|
49 | # destroy non existent domain and memory - negative test |
---|
50 | status, output = traceCommand("xm mem-set 6666 64") |
---|
51 | where = output.find(eyecatcher) |
---|
52 | if status == 0: |
---|
53 | FAIL("xm mem-set returned invalid %i == -1" % status) |
---|
54 | elif where == -1: |
---|
55 | FAIL("xm mem-set failed to report error for invalid domid") |
---|
56 | |
---|