Files
xen/tools/xm-test/tests/console/02_console_baddom_neg.py
T
emellor@leeni.uk.xensource.com f1f5c0ba12 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>
2005-11-16 12:36:47 +01:00

28 lines
778 B
Python

#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Li Ge <lge@us.ibm.com>
# Test Description:
# Negative Tests:
# Test for attempting to connect to non existent domname, domid. Verify fail.
import re
from XmTestLib import *
status, output = traceCommand("xm console 5000")
eyecatcher = "Error"
where = output.find(eyecatcher)
if status == 0:
FAIL("xm console returned invalid %i != 0" % status)
elif where == -1:
FAIL("xm console failed to report error on bad domid")
status, output = traceCommand("xm console NON_EXIST")
eyecatcher = "Error"
where = output.find(eyecatcher)
if status == 0:
FAIL("xm console returned invalid %i != 0" % status)
elif where == -1:
FAIL("xm console failed to report error on bad domname")