# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 725bf42d4713eaee5c12cd39752e86ca56dee4ce
# Parent 10bafcc750fb5553abfb5ac8196c4925c7aed034
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@xxxxxxxxxxxxx>
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/block-create/06_block_attach_baddomain_neg.py
--- a/tools/xm-test/tests/block-create/06_block_attach_baddomain_neg.py Tue Nov
15 18:19:02 2005
+++ b/tools/xm-test/tests/block-create/06_block_attach_baddomain_neg.py Wed Nov
16 11:36:47 2005
@@ -11,7 +11,7 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm block-attach returned bad status, expected non 0, status is:
%i" % status )
-elif where > 1:
+elif where == -1:
FAIL("xm block-attach returned bad output, expected Error, output is:
%s" % output )
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py
--- a/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py Tue Nov
15 18:19:02 2005
+++ b/tools/xm-test/tests/block-create/07_block_attach_baddevice_neg.py Wed Nov
16 11:36:47 2005
@@ -42,7 +42,7 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm block-attach returned bad status, expected non 0, status is:
%i" % status )
-elif where > 1:
+elif where == -1:
FAIL("xm block-attach returned bad output, expected Error, output is:
%s" % output )
try:
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py
--- a/tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py
Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/block-create/08_block_attach_bad_filedevice_neg.py
Wed Nov 16 11:36:47 2005
@@ -41,7 +41,7 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm block-attach returned bad status, expected non 0, status is:
%i" % status )
-elif where > 1:
+elif where == -1:
FAIL("xm block-attach returned bad output, expected Error, output is:
%s" % output )
try:
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/console/01_console_badopt_neg.py
--- a/tools/xm-test/tests/console/01_console_badopt_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/console/01_console_badopt_neg.py Wed Nov 16
11:36:47 2005
@@ -17,5 +17,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm console returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm console didn't report error on bad argument")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/console/02_console_baddom_neg.py
--- a/tools/xm-test/tests/console/02_console_baddom_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/console/02_console_baddom_neg.py Wed Nov 16
11:36:47 2005
@@ -15,7 +15,7 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm console returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm console failed to report error on bad domid")
status, output = traceCommand("xm console NON_EXIST")
@@ -23,5 +23,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm console returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm console failed to report error on bad domname")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/create/02_create_noparm_neg.py
--- a/tools/xm-test/tests/create/02_create_noparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/create/02_create_noparm_neg.py Wed Nov 16
11:36:47 2005
@@ -12,6 +12,6 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm create returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm create failed to report error on missing args")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/create/03_create_badparm_neg.py
--- a/tools/xm-test/tests/create/03_create_badparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/create/03_create_badparm_neg.py Wed Nov 16
11:36:47 2005
@@ -15,5 +15,5 @@
status, output = traceCommand("xm create -x")
eyecatcher = "Error:"
where = output.find(eyecatcher)
-if where != 0:
+if where == -1:
FAIL("xm create failed to report error on bad arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/create/05_create_noroot_noram_neg.py
--- a/tools/xm-test/tests/create/05_create_noroot_noram_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/create/05_create_noroot_noram_neg.py Wed Nov 16
11:36:47 2005
@@ -22,5 +22,5 @@
eyecatcher = "NOROOT"
status, output = traceCommand("xm list")
where = output.find(eyecatcher)
-if where != -1 :
+if where != -1:
FAIL("xm create test05 passed with no root and no ramdisk. Expected
result: Fail.")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/destroy/02_destroy_noparm_neg.py
--- a/tools/xm-test/tests/destroy/02_destroy_noparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/destroy/02_destroy_noparm_neg.py Wed Nov 16
11:36:47 2005
@@ -12,5 +12,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm destroy returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm destroy failed to report error for missing arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/destroy/03_destroy_nonexist_neg.py
--- a/tools/xm-test/tests/destroy/03_destroy_nonexist_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/destroy/03_destroy_nonexist_neg.py Wed Nov 16
11:36:47 2005
@@ -12,5 +12,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm destroy returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm destroy failed to report error for bad arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/destroy/04_destroy_badparm_neg.py
--- a/tools/xm-test/tests/destroy/04_destroy_badparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/destroy/04_destroy_badparm_neg.py Wed Nov 16
11:36:47 2005
@@ -12,5 +12,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm destroy returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm destroy failed to report error for bad domid")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/dmesg/02_dmesg_basic_neg.py
--- a/tools/xm-test/tests/dmesg/02_dmesg_basic_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/dmesg/02_dmesg_basic_neg.py Wed Nov 16 11:36:47 2005
@@ -12,6 +12,6 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm dmesg returned invalid %i != 0" % status)
-elif where == 1:
+elif where == -1:
FAIL("xm dmesg failed to report error for bad arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/help/01_help_basic_pos.py
--- a/tools/xm-test/tests/help/01_help_basic_pos.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/help/01_help_basic_pos.py Wed Nov 16 11:36:47 2005
@@ -10,5 +10,5 @@
status, output = traceCommand("xm help")
eyecatcher = "Usage:"
where = output.find(eyecatcher)
-if where != 0:
+if where == -1:
FAIL("xm help: didn't see the usage string")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/help/02_help_basic_neg.py
--- a/tools/xm-test/tests/help/02_help_basic_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/help/02_help_basic_neg.py Wed Nov 16 11:36:47 2005
@@ -10,5 +10,5 @@
status, output = traceCommand("xm")
eyecatcher = "Usage:"
where = output.find(eyecatcher)
-if where != 0:
+if where == -1:
FAIL("xm: didn't display usage when given no arguments")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/help/03_help_badparm_neg.py
--- a/tools/xm-test/tests/help/03_help_badparm_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/help/03_help_badparm_neg.py Wed Nov 16 11:36:47 2005
@@ -10,5 +10,5 @@
status, output = traceCommand("xm -x")
eyecatcher = "Error:"
where = output.find(eyecatcher)
-if where != 0:
+if where == -1:
FAIL("xm failed to report error for bad arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/help/05_help_nonroot_pos.py
--- a/tools/xm-test/tests/help/05_help_nonroot_pos.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/help/05_help_nonroot_pos.py Wed Nov 16 11:36:47 2005
@@ -13,5 +13,5 @@
status, output = traceCommand("xm help")
eyecatcher = "Usage:"
where = output.find(eyecatcher)
-if where != 0:
+if where == -1:
FAIL("xm help: didn't see the usage string")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/list/02_list_badparm_neg.py
--- a/tools/xm-test/tests/list/02_list_badparm_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/list/02_list_badparm_neg.py Wed Nov 16 11:36:47 2005
@@ -12,5 +12,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm list returned invalud %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm list failed to report error for bad arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/list/03_list_nonexist_neg.py
--- a/tools/xm-test/tests/list/03_list_nonexist_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/list/03_list_nonexist_neg.py Wed Nov 16 11:36:47 2005
@@ -12,6 +12,6 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm list returned invalid %i != 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm list failed to report error for invalid domid")
diff -r 10bafcc750fb -r 725bf42d4713 tools/xm-test/tests/list/06_list_nonroot.py
--- a/tools/xm-test/tests/list/06_list_nonroot.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/list/06_list_nonroot.py Wed Nov 16 11:36:47 2005
@@ -11,5 +11,5 @@
status, output = traceCommand("xm list")
eyecatcher = "Error: Most commands need root access"
where = output.find(eyecatcher)
-if where != 0:
+if where == -1:
FAIL("xm help: didn't see the root hint, saw %s" % output)
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/memset/02_memset_badparm_neg.py
--- a/tools/xm-test/tests/memset/02_memset_badparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/memset/02_memset_badparm_neg.py Wed Nov 16
11:36:47 2005
@@ -24,7 +24,7 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm mem-set returned invalid %i == 0" % status)
-elif where > 1:
+elif where == -1:
FAIL("xm mem-set failed to report error for missing arg")
# destroy non existent parm input - negative test
@@ -32,7 +32,7 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm mem-set returned invalid %i == 0" % status)
-elif where != 0:
+elif where == -1:
FAIL("xm mem-set failed to report error for bad arg")
# destroy non existent domain - negative test
@@ -40,14 +40,14 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm mem-set returned invalid %i == 0" % status)
-elif where != 0:
+elif where == -1:
FAIL("xm mem-set failed to report error for invalid domid")
# destroy non existent domain and memory - negative test
status, output = traceCommand("xm mem-set 6666 64")
where = output.find(eyecatcher)
if status == 0:
- FAIL("xm mem-set returned invalid %i != 0" % status)
-elif where != 0:
+ FAIL("xm mem-set returned invalid %i == -1" % status)
+elif where == -1:
FAIL("xm mem-set failed to report error for invalid domid")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/pause/02_pause_badopt_neg.py
--- a/tools/xm-test/tests/pause/02_pause_badopt_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/pause/02_pause_badopt_neg.py Wed Nov 16 11:36:47 2005
@@ -25,7 +25,7 @@
if status == 0:
domain.destroy()
FAIL("xm pause returned bad status, expected non 0, status is: %i" %
status )
-elif where > 1:
+elif where == -1:
domain.destroy()
FAIL("xm pause returned bad output, expected Error, output is: %s" %
output )
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/pause/03_pause_badname_neg.py
--- a/tools/xm-test/tests/pause/03_pause_badname_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/pause/03_pause_badname_neg.py Wed Nov 16 11:36:47 2005
@@ -14,5 +14,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm pause returned bad status, expected non 0, status is: %i" %
status )
-elif where > 1:
+elif where == -1:
FAIL("xm pause returned bad output, expected Error, output is: %s" %
output )
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/pause/04_pause_badid_neg.py
--- a/tools/xm-test/tests/pause/04_pause_badid_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/pause/04_pause_badid_neg.py Wed Nov 16 11:36:47 2005
@@ -14,5 +14,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm pause returned bad status, expected non 0, status is: %i" %
status )
-elif where > 1:
+elif where == -1:
FAIL("xm pause returned bad output, expected Error, output is: %s" %
output )
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/reboot/02_reboot_badopt_neg.py
--- a/tools/xm-test/tests/reboot/02_reboot_badopt_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/reboot/02_reboot_badopt_neg.py Wed Nov 16
11:36:47 2005
@@ -25,7 +25,7 @@
if status == 0:
domain.destroy()
FAIL("xm reboot returned invalid %i == 0" % status )
-elif where > 1:
+elif where == -1:
domain.destroy()
FAIL("xm reboot failed to report error for bad arg")
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/reboot/03_reboot_badname_neg.py
--- a/tools/xm-test/tests/reboot/03_reboot_badname_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/reboot/03_reboot_badname_neg.py Wed Nov 16
11:36:47 2005
@@ -14,5 +14,5 @@
where = output.find(eyecatcher)
if status == 0:
FAIL("xm reboot returned invalid %i == 0" % status )
-elif where > 1:
+elif where == -1:
FAIL("xm reboot failed to report error for non-existent domain" )
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/restore/02_restore_badparm_neg.py
--- a/tools/xm-test/tests/restore/02_restore_badparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/restore/02_restore_badparm_neg.py Wed Nov 16
11:36:47 2005
@@ -21,5 +21,5 @@
FAIL("xm restore returned bad status, expected non 0, status is: %i" %
status)
elif where2 == 0:
FAIL("xm restore returned a stack dump, expected nice error message")
-elif where1 > 0:
+elif where1 == -1:
FAIL("xm restore returned bad output, expected Error:, output is: %s" %
output)
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/restore/03_restore_badfilename_neg.py
--- a/tools/xm-test/tests/restore/03_restore_badfilename_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/restore/03_restore_badfilename_neg.py Wed Nov 16
11:36:47 2005
@@ -21,5 +21,5 @@
FAIL("xm restore returned bad status, expected non 0, status is: %i" %
status)
elif where2 == 0:
FAIL("xm restore returned a stack dump, expected nice error message")
-elif where1 > 0:
+elif where1 == -1:
FAIL("xm restore returned bad output, expected Error:, output is: %s" %
output)
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/save/02_save_badparm_neg.py
--- a/tools/xm-test/tests/save/02_save_badparm_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/save/02_save_badparm_neg.py Wed Nov 16 11:36:47 2005
@@ -21,5 +21,5 @@
FAIL("xm save returned bad status, expected non 0, status is: %i" % status)
elif where2 == 0:
FAIL("xm save returned a stack dump, expected nice error message")
-elif where1 > 0:
+elif where1 == -1:
FAIL("xm save returned bad output, expected Error:, output is: %s" %
output)
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/save/03_save_bogusfile_neg.py
--- a/tools/xm-test/tests/save/03_save_bogusfile_neg.py Tue Nov 15 18:19:02 2005
+++ b/tools/xm-test/tests/save/03_save_bogusfile_neg.py Wed Nov 16 11:36:47 2005
@@ -38,5 +38,5 @@
FAIL("xm save returned bad status, expected non 0, status is: %i" % status)
elif where1 == 0:
FAIL("xm save returned a stack dump, expected nice error message")
-elif where2 > 0:
+elif where2 == -1:
FAIL("xm save returned bad output, expected Error:, output is: %s" %
output)
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py
--- a/tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/shutdown/02_shutdown_badparm_neg.py Wed Nov 16
11:36:47 2005
@@ -32,7 +32,7 @@
where = output.find(eyecatcher)
if (ret == 0):
FAIL("xm shutdown returned invalid %i == 0" % ret)
-elif where != 0:
+elif where == -1:
FAIL("xm shutdown failed to report error for bad arg")
# Stop the domain (nice shutdown)
diff -r 10bafcc750fb -r 725bf42d4713
tools/xm-test/tests/shutdown/03_shutdown_nonexist_neg.py
--- a/tools/xm-test/tests/shutdown/03_shutdown_nonexist_neg.py Tue Nov 15
18:19:02 2005
+++ b/tools/xm-test/tests/shutdown/03_shutdown_nonexist_neg.py Wed Nov 16
11:36:47 2005
@@ -18,5 +18,5 @@
where = output.find(eyecatcher)
if (ret == 0):
FAIL("xm shutdown returned invalid %i == 0" % ret)
-elif where != 0:
+elif where == -1:
FAIL("xm shutdown failed to report error for bad domid")
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|