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

« back to all changes in this revision

Viewing changes to tools/xm-test/tests/help/06_help_allcmds.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: Dan Smith <danms@us.ibm.com>
 
5
 
 
6
from XmTestLib import *
 
7
 
 
8
import re
 
9
 
 
10
MAX_ARGS = 10
 
11
 
 
12
# These commands aren't suitable for this test, so we
 
13
# ignore them
 
14
skipcommands = ["top", "log"]
 
15
 
 
16
status, output = traceCommand("xm help --long")
 
17
 
 
18
commands = []
 
19
badcommands = []
 
20
 
 
21
lines = output.split("\n")
 
22
for l in lines:
 
23
    match = re.match("^    ([a-z][^ ]+).*$", l)
 
24
    if match:
 
25
        commands.append(match.group(1))
 
26
 
 
27
for c in commands:
 
28
    if c in skipcommands:
 
29
        continue
 
30
 
 
31
    arglist = ""
 
32
    for i in range(0,MAX_ARGS+1):
 
33
        if i > 0:
 
34
            arglist += "%i " % i
 
35
 
 
36
        status, output = traceCommand("xm %s %s" % (c, arglist))
 
37
 
 
38
        if output.find("Traceback") != -1:
 
39
            badcommands.append(c + " " + arglist)
 
40
            if verbose:
 
41
                print "Got Traceback: %s %s" % (c, arglist)
 
42
 
 
43
if badcommands:
 
44
    FAIL("Got a traceback on: %s" % str(badcommands))