view tools/xm-test/tests/list/02_list_badparm_neg.py @ 7855:725bf42d4713

Review checks for Error string when checking that bad arguments are handled
correctly. Many checks were looking using output.find("Error") > 1, which is
incorrect, as we do not guarantee that the word "Error" will be first in the
output (never mind the fact that strings are indexed from 0).

All these checks have been changed to compare against -1. In particular, this
should fix the failure of create_noparm_neg and create_badparm_neg on a machine
with the /etc/xen/xmdefconfig file in place, as xm create issues the
Using config file "/etc/xen/xmdefconfig" diagnostic before reporting the error.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@leeni.uk.xensource.com
date Wed Nov 16 12:36:47 2005 +0100 (2005-11-16)
parents ecb5997f7b25
children ac5c0a100868
line source
1 #!/usr/bin/python
3 # Copyright (C) International Business Machines Corp., 2005
4 # Author: Woody Marvel <marvel@us.ibm.com>
6 import re
8 from XmTestLib import *
10 status, output = traceCommand("xm list -x")
11 eyecatcher = "Error:"
12 where = output.find(eyecatcher)
13 if status == 0:
14 FAIL("xm list returned invalud %i != 0" % status)
15 elif where == -1:
16 FAIL("xm list failed to report error for bad arg")