From 748ff1c4cc249be6c3de30429ec0092a7832af33 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 19 Jan 2014 10:37:14 -0500 Subject: virt-xml: Initial commit, basic set of tests --- .gitignore | 1 + man/virt-xml.pod | 77 ++++++ setup.py | 13 +- tests/__init__.py | 1 + tests/cli-test-xml/compare/virtxml-edit-all.xml | 30 +++ .../cli-test-xml/compare/virtxml-edit-neg-num.xml | 13 + .../cli-test-xml/compare/virtxml-edit-pos-num.xml | 13 + .../compare/virtxml-edit-select-disk-target.xml | 13 + .../compare/virtxml-edit-select-network-mac.xml | 13 + .../compare/virtxml-edit-select-sound-model.xml | 13 + .../compare/virtxml-edit-simple-boot.xml | 17 ++ .../compare/virtxml-edit-simple-channel.xml | 13 + .../compare/virtxml-edit-simple-clock.xml | 19 ++ .../compare/virtxml-edit-simple-console.xml | 13 + .../compare/virtxml-edit-simple-controller.xml | 13 + .../compare/virtxml-edit-simple-cpu.xml | 24 ++ .../compare/virtxml-edit-simple-disk.xml | 16 ++ .../compare/virtxml-edit-simple-features.xml | 17 ++ .../compare/virtxml-edit-simple-filesystem.xml | 18 ++ .../compare/virtxml-edit-simple-graphics.xml | 13 + .../compare/virtxml-edit-simple-host-device.xml | 17 ++ .../compare/virtxml-edit-simple-memballoon.xml | 13 + .../compare/virtxml-edit-simple-network.xml | 19 ++ .../compare/virtxml-edit-simple-numatune.xml | 13 + .../compare/virtxml-edit-simple-parallel.xml | 15 ++ .../compare/virtxml-edit-simple-redirdev.xml | 15 ++ .../compare/virtxml-edit-simple-rng.xml | 13 + .../compare/virtxml-edit-simple-security.xml | 12 + .../compare/virtxml-edit-simple-serial.xml | 13 + .../compare/virtxml-edit-simple-smartcard.xml | 13 + .../compare/virtxml-edit-simple-soundhw.xml | 13 + .../compare/virtxml-edit-simple-tpm.xml | 13 + .../compare/virtxml-edit-simple-vcpus.xml | 21 ++ .../compare/virtxml-edit-simple-video.xml | 13 + .../compare/virtxml-edit-simple-watchdog.xml | 13 + tests/cli-test-xml/compare/virtxml-print-xml.xml | 17 ++ tests/clitest.py | 93 ++++++- tests/testdriver.xml | 31 ++- virt-manager.spec.in | 4 + virt-xml | 283 +++++++++++++++++++++ virtinst/cli.py | 118 +++++++-- 41 files changed, 1064 insertions(+), 48 deletions(-) create mode 100644 man/virt-xml.pod create mode 100644 tests/cli-test-xml/compare/virtxml-edit-all.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-neg-num.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-pos-num.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-select-disk-target.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-select-network-mac.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-select-sound-model.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-boot.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-channel.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-clock.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-console.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-controller.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-cpu.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-disk.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-features.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-filesystem.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-graphics.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-host-device.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-memballoon.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-network.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-numatune.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-parallel.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-redirdev.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-rng.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-security.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-serial.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-smartcard.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-soundhw.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-tpm.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-vcpus.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-video.xml create mode 100644 tests/cli-test-xml/compare/virtxml-edit-simple-watchdog.xml create mode 100644 tests/cli-test-xml/compare/virtxml-print-xml.xml create mode 100755 virt-xml diff --git a/.gitignore b/.gitignore index 4171678c..3ee600eb 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ po/virt-manager.pot /man/virt-image.1 /man/virt-convert.1 /man/virt-image.5 +/man/virt-xml.1 /virt-manager.spec /virtcli/cli.cfg diff --git a/man/virt-xml.pod b/man/virt-xml.pod new file mode 100644 index 00000000..720995fd --- /dev/null +++ b/man/virt-xml.pod @@ -0,0 +1,77 @@ +=pod + +=head1 NAME + +virt-xml - XXX + +=head1 SYNOPSIS + +B XXX + +=head1 DESCRIPTION + +B XXX + +=head1 OPTIONS + +=over 4 + +=item -h, --help + +Show the help message and exit + +=back + +=head2 BAR SECTION + +=over 2 + +=item FOO + +FOO + +=item BAR + +BAR + +=back + +=head2 Miscellaneous Options + +=over 2 + +=item -q, --quiet + +Avoid verbose output. + +=item -d, --debug + +Print debugging information + +=item --dry-run + +Proceed through the conversion process, but don't convert disks or actually +write any converted files. + +=back + +=head1 EXAMPLES + +XXX + +=head1 BUGS + +Please see http://virt-manager.org/page/BugReporting + +=head1 COPYRIGHT + +Copyright (C) Red Hat, Inc, and various contributors. +This is free software. You may redistribute copies of it under the terms +of the GNU General Public License C. +There is NO WARRANTY, to the extent permitted by law. + +=head1 SEE ALSO + +L, the project website C + +=cut diff --git a/setup.py b/setup.py index 6103f938..b774f898 100755 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def _generate_potfiles_in(): return ret scripts = ["virt-manager", "virt-install", - "virt-clone", "virt-image", "virt-convert"] + "virt-clone", "virt-image", "virt-convert", "virt-xml"] potfiles = "\n".join(scripts) + "\n\n" potfiles += "\n".join(find("virtManager", "*.py")) + "\n\n" @@ -145,7 +145,7 @@ class my_build(build): def _make_bin_wrappers(self): cmds = ["virt-manager", "virt-install", "virt-clone", - "virt-image", "virt-convert"] + "virt-image", "virt-convert", "virt-xml"] if not os.path.exists("build"): os.mkdir("build") @@ -559,7 +559,7 @@ class CheckPylint(Command): def run(self): files = ["setup.py", "virt-install", "virt-clone", "virt-image", - "virt-convert", "virt-manager", + "virt-convert", "virt-xml", "virt-manager", "virtcli", "virtinst", "virtconv", "virtManager", "tests"] @@ -590,7 +590,8 @@ setup( "build/virt-clone", "build/virt-install", "build/virt-image", - "build/virt-convert"]), + "build/virt-convert", + "build/virt-xml"]), data_files=[ ("share/virt-manager/", [ @@ -599,6 +600,7 @@ setup( "virt-clone", "virt-image", "virt-convert", + "virt-xml", ]), ("share/glib-2.0/schemas", ["data/org.virt-manager.virt-manager.gschema.xml"]), @@ -609,7 +611,8 @@ setup( "man/virt-install.1", "man/virt-clone.1", "man/virt-image.1", - "man/virt-convert.1" + "man/virt-convert.1", + "man/virt-xml.1" ]), ("share/man/man5", ["man/virt-image.5"]), diff --git a/tests/__init__.py b/tests/__init__.py index 4ab1002c..237cbb83 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -70,6 +70,7 @@ virtinstall = _import("virtinstall", "virt-install") virtimage = _import("virtimage", "virt-image") virtclone = _import("virtclone", "virt-clone") virtconvert = _import("virtconvert", "virt-convert") +virtxml = _import("virtxml", "virt-xml") # Variable used to store a local iso or dir path to check for a distro # Specified via 'python setup.py test_urls --path" diff --git a/tests/cli-test-xml/compare/virtxml-edit-all.xml b/tests/cli-test-xml/compare/virtxml-edit-all.xml new file mode 100644 index 00000000..f239b0fd --- /dev/null +++ b/tests/cli-test-xml/compare/virtxml-edit-all.xml @@ -0,0 +1,30 @@ +--- Original XML ++++ Altered XML +@@ -265,21 +265,25 @@ + + + ++ + + + +
+ ++ + + + +
+ ++ + + + +
+ ++ + + + + +Domain 'test-many-devices' defined successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virtxml-edit-neg-num.xml b/tests/cli-test-xml/compare/virtxml-edit-neg-num.xml new file mode 100644 index 00000000..aea38550 --- /dev/null +++ b/tests/cli-test-xml/compare/virtxml-edit-neg-num.xml @@ -0,0 +1,13 @@ +--- Original XML ++++ Altered XML +@@ -258,7 +258,7 @@ + + + + + + +Domain 'test-many-devices' defined successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virtxml-edit-pos-num.xml b/tests/cli-test-xml/compare/virtxml-edit-pos-num.xml new file mode 100644 index 00000000..10a64999 --- /dev/null +++ b/tests/cli-test-xml/compare/virtxml-edit-pos-num.xml @@ -0,0 +1,13 @@ +--- Original XML ++++ Altered XML +@@ -253,7 +253,7 @@ + + + +- ++ + + +Domain 'test-many-devices' defined successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virtxml-edit-select-disk-target.xml b/tests/cli-test-xml/compare/virtxml-edit-select-disk-target.xml new file mode 100644 index 00000000..27b4b341 --- /dev/null +++ b/tests/cli-test-xml/compare/virtxml-edit-select-disk-target.xml @@ -0,0 +1,13 @@ +--- Original XML ++++ Altered XML +@@ -65,7 +65,7 @@ +
+ + +- ++ + + + 5242880 + +Domain 'test-many-devices' defined successfully. \ No newline at end of file diff --git a/tests/cli-test-xml/compare/virtxml-edit-select-network-mac.xml b/tests/cli-test-xml/compare/virtxml-edit-select-network-mac.xml new file mode 100644 index 00000000..2d1fe324 --- /dev/null +++ b/tests/cli-test-xml/compare/virtxml-edit-select-network-mac.xml @@ -0,0 +1,13 @@ +--- Original XML ++++ Altered XML +@@ -159,7 +159,7 @@ + + +