Commit Graph

107 Commits

Author SHA1 Message Date
Cole Robinson
153dcba126 uitests: test createvm.py with an empty connection
Fix the 'No networking' createvm case that it shows was broken

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson
aab71cc4d0 tests: Move all testdriver XML to the same dir
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson
f6c6f033d9 tests: Move checkprops.py magic skipping to pytest
We want to skip these tests if previous tests failed or were skipped,
but current impl depends on unittest specifics. Move it to pytest

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:47:58 -04:00
Cole Robinson
61a947d667 tests: Rename clistate -> TESTCONFIG
Makes it more clear it's a constant class, and its purpose

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:38:40 -04:00
Cole Robinson
4226a4c1d5 setup: Kill old test_* command infrastructure
pytest invocations are now preferred. Leave plain `./setup.py test`
as a stub that errors and points to pytest.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:32 -04:00
Cole Robinson
b24892448c tests: Add armv7l domcaps data, and use it
Rather than using a hacked x86 domcaps data

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson
9a0d49a718 virtinst: uri: Rework MagicURI to work with passed in fakeuri
Rather than individual options for each possible hypervisor,
and annotations like 'remote' or 'session', just have it take a
fake URI to mock

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson
e784376699 tests: Rename all test files to have test_ prefix
This will help for a possible future conversion to pytest

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
78c8aef75e tests: Move all data directories to data/
This cleans up the file hierarchy a bit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
8fe0a208db Move virt-* code into their modules
This layout is closer to what most python modules have nowadays.
It also simplifies testing and static analysis setup.

Keep virt-* wrappers locally, for ease of running these commands
from a git checkout.

Adjust the wrapper binaries we install on via packaging to be
pure python, which makes things like running gdb easier.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 18:27:20 -05:00
Erik Skultety
9bfdd92c0e tests: Introduce real-world AMD SEV domain capabilities
Rather than editing existing Intel domain capabilities by hand, use
capabilities from a real AMD HW. We're later going to use these to fill
in SEV platform specific data automatically.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Cole Robinson
361657ad15 virtinst: Add a lot of test code coverage
* Delete dead code
* Add tests for various device default code paths
* Rework certain conditions a bit so code coverage always hits them
2019-06-09 18:59:50 -04:00
Cole Robinson
f3b0830cf3 tests: Add run_without_testsuite_hacks decorator 2019-06-08 09:11:00 -04:00
Cole Robinson
7d17d5d03b virtinst: Run register_libvirt_error_handler on import
We basically want this everywhere, and transparently, so run it on
import like we do for gettext setup
2019-06-07 16:56:57 -04:00
Pavel Hrdina
fab7af30a1 tests: add kvm-x86_64-rhel7-domcaps
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 14:47:37 +02:00
Andrea Bolognani
a989986cb9 tests: Add RISC-V support
RISC-V doesn't support KVM yet, so we are forced to use TCG
on x86 until that's working.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Cole Robinson
fcabcb7a95 tests: clitest: Add a test case for the last commit
We need a custom test driver input to reproduce the pool collision
2019-03-26 11:15:46 -04:00
Cole Robinson
3be238b03e tests: test_urls: Add --*libosinfo, --iso-only, --url-only
These are options that will help tweak the test_urls logic,
to help as we try to ensure libosinfo covers all the cases
we care about.
2019-03-24 12:32:03 -04:00
Cole Robinson
2ba48539ea tests: Regenerate with osinfo-db git 2018-10-13 16:33:37 -04:00
Cole Robinson
edab908f42 guest: Use q35 chipset by default for new qemu + supported OS
There's been various discussions about changing the x86 default
from 'pc' to 'q35' over the years, but it's unlikely to happen
at the qemu or libvirt level for compatibility reasons. So
let's start using it for new enough OS that support it.
2018-10-13 14:58:57 -04:00
Cole Robinson
877cbade4a tests: Move OLD_OSINFO check to central place
Other tests may need it in the future
2018-10-04 19:29:41 -04:00
Cole Robinson
2b41e130d8 connection: rename fetch_all_guests->fetch_all_domains
The virtinst class is erroneously called Guest, but these
functions are dealing with libvirt <domain> XML, so rename them
2018-08-31 16:50:46 -04:00
Cole Robinson
83a9e613e9 tests: uitests: Fix breakage
Needs adapting to latest TPM addhw work, and armv7 UEFI support
2018-08-31 16:47:10 -04:00
Cole Robinson
8e150901f4 clitest: Streamline the string format dict
Remove a bunch of dead entries, open code a bunch of limited usage,
and only use the dict for commonly referenced data
2018-06-12 14:07:50 -04:00
Cole Robinson
d68305eaab tests: utils: Move all URI strings to URIs object
Non-functional change, just makes code org nicer
2018-06-12 14:07:50 -04:00
Cole Robinson
e0e6ac6956 tests: Remove useless read_file helper 2018-06-12 14:07:50 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
6954c6774a tests: Fix running testsuite on older libvirt
If we try to run the testsuite on anything older than libvirt 3.1,
it immediately throws an exception before processing any tests,
due to choking on parsing drm bits from testdriver.xml. This global
failure is only due to sloppy coding though.

Turn all test cases that use testdriver.xml into skips in this case,
so we can at least get some test coverage otherwise.
2018-02-22 16:01:24 -05:00
Cole Robinson
62fecb09d3 tests: Create a smaller testsuite.xml
Right now, most test cases will create a libvirt test driver using
tests/testdriver.xml. This is problematic for 2 reasons:

1) testdriver.xml is 3500 lines of XML, and it's parsed hundreds of
   times. Opening it is responsible for about 25% of test suite time
2) Older libvirt chokes on testdriver.xml, meaning the test suite will
   be useless there. This is a recurring problem as new features are
   added to testdriver.xml

Most test cases don't actually need all the test state in testdriver.xml
though. So this creates a smaller testsuite.xml which has a lower
libvirt requirement and is much quicker to parse. New XML bits should
continue to go into testdriver.xml so we can keep testsuite.xml as
the more stripped down option.
2018-02-22 15:44:06 -05:00
Cole Robinson
c05cd52772 setup: Use CLIState for setting --debug value 2018-02-22 15:18:47 -05:00
Cole Robinson
98d880a179 tests: Differentiate conn cache based on actual open URI
Since what is actually passed to libvirt here is what actually matters,
not all our fakeuri trickery
2018-02-20 12:21:45 -05:00
Cole Robinson
4b4f532417 uitests: Wire up --coverage
Need to launch the external coverage process to actually measure
things
2018-01-09 13:51:53 -05:00
Cole Robinson
044d93d471 tests: Rework how we pass command line objects down to test data 2018-01-08 17:05:55 -05:00
Radostin Stoyanov
a2bcd6c43a Do not compare between None and int
In Python 2 comparison between int and None is allowed but in
Pyhton 3 it is not.

Example:

Pyhton 2

    >>> None > 0
    False

Python 3

    >>> None > 0
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: '>' not supported between instances of 'NoneType' and 'int'
2017-10-20 13:18:31 -04:00
Cole Robinson
f0e36d52e7 tests: bypass cache hacking for test:///default
To allow us to test the standard code in some cases. Would have caught
the previous issue
2017-08-30 10:36:37 -04:00
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
1a09a05dc7 tests: Add a clone test for importing nvram directory
Need to use some callback magic to fake it like there's a file in
an existing directory
2017-07-20 17:51:06 -04:00
Cole Robinson
6b586e2bed tests: Rework connection caching
Drop the callbacks and instead prime the connection's internal cache.
This will simplify upcoming changes
2017-07-20 17:28:38 -04:00
Cole Robinson
55aa23b400 connection: Return copys of cached object lists
Incase any users manipulate the lists, we don't want that to affect
our caching. Could prevent future mistakes
2017-07-20 17:28:38 -04:00
Cole Robinson
4e4a6c817f connection: Rework cache function layout slightly
Have the internal polling functions not touch the connection cache.
This let's us not worry about the connection cache in the test suite,
where clear_cache wasn't 100% correct.
2017-07-20 17:28:38 -04:00
Pavel Hrdina
4f8e795c6a virtinst: if required by UEFI enable SMM feature and set q35 machine type
If we detect that the UEFI image is build to require SMM feature we
should configure the guest to enable SMM feature and set q35 machine
type.  Without this user wouldn't be able to boot the guest.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1387479

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-06-01 09:58:46 +02:00
Cole Robinson
f551d7e55d Replace file() usage with open()
Same semantics, but the latter is needed for python3
2017-05-05 14:53:12 -04:00
Cole Robinson
62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Cole Robinson
e7e9369989 util: Catch libxml2 stderr messages
Similar to what we do with libvirt. Was never really relevant before,
but some of the namespace XML stuff can be a bit noisy even though it
doesn't have any functional impact that I can tell
2017-03-06 22:15:46 -05:00
Mikhail Feoktistov
3870001fd2 virtinst: Add tests for Virtuozzo hypervisor 2017-03-01 15:45:24 -05:00
Pavel Hrdina
3d73f9cd3b tests: add aarch64 domcapabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-10 18:09:54 +02:00
Kevin Zhao
79d02e356b Add a capatilities-xml for s390x, and add a clitest for it.
Add a capatilities xml file for s390x ,the capatility for IBM
Distro called KVMIBM,mainly focus on a KVM hypervious on S390x.
Also add a clitest by using virt-install.
2015-11-04 14:42:26 -05:00
Cole Robinson
7f1af40262 tests: Share sanitize_xml helpers 2015-09-22 12:41:57 -04:00
Cole Robinson
82ea5bfc62 tests: Add qemu:///session unit tests 2015-08-10 12:46:47 -04:00