[PATCH v2 00/22] tests/qtest: migration-test refactoring

Fabiano Rosas posted 22 patches 1 year, 2 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
MAINTAINERS                                   |    5 +-
docs/devel/testing/index.rst                  |    1 +
docs/devel/testing/main.rst                   |   12 +
docs/devel/testing/migration.rst              |  261 ++
docs/devel/testing/qtest.rst                  |    1 +
tests/meson.build                             |    2 +-
.../guestperf-batch.py                        |    0
.../guestperf-plot.py                         |    0
.../guestperf.py                              |    0
.../guestperf/__init__.py                     |    0
.../guestperf/comparison.py                   |    0
.../guestperf/engine.py                       |    0
.../guestperf/hardware.py                     |    0
.../guestperf/plot.py                         |    0
.../guestperf/progress.py                     |    0
.../guestperf/report.py                       |    0
.../guestperf/scenario.py                     |    0
.../guestperf/shell.py                        |    0
.../guestperf/timings.py                      |    0
.../initrd-stress.sh                          |    0
.../meson.build                               |    0
.../{migration => migration-stress}/stress.c  |    0
tests/qtest/meson.build                       |   46 +-
tests/qtest/migration-test-smoke.c            |   39 +
tests/qtest/migration-test.c                  | 4029 +----------------
tests/{ => qtest}/migration/Makefile          |    0
tests/{ => qtest}/migration/aarch64/Makefile  |    0
.../migration/aarch64/a-b-kernel.S            |    0
.../migration/aarch64/a-b-kernel.h            |    0
tests/qtest/migration/bootfile.c              |   70 +
.../migration/bootfile.h}                     |    9 +-
tests/qtest/migration/compression-tests.c     |  244 +
tests/qtest/migration/cpr-tests.c             |   65 +
tests/qtest/migration/file-tests.c            |  338 ++
tests/{ => qtest}/migration/i386/Makefile     |    0
.../migration/i386/a-b-bootblock.S            |    0
.../migration/i386/a-b-bootblock.h            |    0
.../migration-qmp.c}                          |  567 ++-
tests/qtest/migration/migration-qmp.h         |   46 +
tests/qtest/migration/migration-util.c        |  362 ++
.../migration-util.h}                         |   30 +-
tests/qtest/migration/misc-tests.c            |  280 ++
tests/qtest/migration/postcopy-tests.c        |  114 +
tests/{ => qtest}/migration/ppc64/Makefile    |    0
.../{ => qtest}/migration/ppc64/a-b-kernel.S  |    0
.../{ => qtest}/migration/ppc64/a-b-kernel.h  |    0
tests/qtest/migration/precopy-tests.c         | 1012 +++++
tests/{ => qtest}/migration/s390x/Makefile    |    0
tests/{ => qtest}/migration/s390x/a-b-bios.c  |    0
tests/{ => qtest}/migration/s390x/a-b-bios.h  |    0
tests/qtest/migration/test-framework.c        |  969 ++++
tests/qtest/migration/test-framework.h        |  236 +
tests/qtest/migration/tls-tests.c             |  797 ++++
tests/qtest/virtio-net-failover.c             |    3 +-
54 files changed, 5190 insertions(+), 4348 deletions(-)
create mode 100644 docs/devel/testing/migration.rst
rename tests/{migration => migration-stress}/guestperf-batch.py (100%)
rename tests/{migration => migration-stress}/guestperf-plot.py (100%)
rename tests/{migration => migration-stress}/guestperf.py (100%)
rename tests/{migration => migration-stress}/guestperf/__init__.py (100%)
rename tests/{migration => migration-stress}/guestperf/comparison.py (100%)
rename tests/{migration => migration-stress}/guestperf/engine.py (100%)
rename tests/{migration => migration-stress}/guestperf/hardware.py (100%)
rename tests/{migration => migration-stress}/guestperf/plot.py (100%)
rename tests/{migration => migration-stress}/guestperf/progress.py (100%)
rename tests/{migration => migration-stress}/guestperf/report.py (100%)
rename tests/{migration => migration-stress}/guestperf/scenario.py (100%)
rename tests/{migration => migration-stress}/guestperf/shell.py (100%)
rename tests/{migration => migration-stress}/guestperf/timings.py (100%)
rename tests/{migration => migration-stress}/initrd-stress.sh (100%)
rename tests/{migration => migration-stress}/meson.build (100%)
rename tests/{migration => migration-stress}/stress.c (100%)
create mode 100644 tests/qtest/migration-test-smoke.c
rename tests/{ => qtest}/migration/Makefile (100%)
rename tests/{ => qtest}/migration/aarch64/Makefile (100%)
rename tests/{ => qtest}/migration/aarch64/a-b-kernel.S (100%)
rename tests/{ => qtest}/migration/aarch64/a-b-kernel.h (100%)
create mode 100644 tests/qtest/migration/bootfile.c
rename tests/{migration/migration-test.h => qtest/migration/bootfile.h} (85%)
create mode 100644 tests/qtest/migration/compression-tests.c
create mode 100644 tests/qtest/migration/cpr-tests.c
create mode 100644 tests/qtest/migration/file-tests.c
rename tests/{ => qtest}/migration/i386/Makefile (100%)
rename tests/{ => qtest}/migration/i386/a-b-bootblock.S (100%)
rename tests/{ => qtest}/migration/i386/a-b-bootblock.h (100%)
rename tests/qtest/{migration-helpers.c => migration/migration-qmp.c} (51%)
create mode 100644 tests/qtest/migration/migration-qmp.h
create mode 100644 tests/qtest/migration/migration-util.c
rename tests/qtest/{migration-helpers.h => migration/migration-util.h} (67%)
create mode 100644 tests/qtest/migration/misc-tests.c
create mode 100644 tests/qtest/migration/postcopy-tests.c
rename tests/{ => qtest}/migration/ppc64/Makefile (100%)
rename tests/{ => qtest}/migration/ppc64/a-b-kernel.S (100%)
rename tests/{ => qtest}/migration/ppc64/a-b-kernel.h (100%)
create mode 100644 tests/qtest/migration/precopy-tests.c
rename tests/{ => qtest}/migration/s390x/Makefile (100%)
rename tests/{ => qtest}/migration/s390x/a-b-bios.c (100%)
rename tests/{ => qtest}/migration/s390x/a-b-bios.h (100%)
create mode 100644 tests/qtest/migration/test-framework.c
create mode 100644 tests/qtest/migration/test-framework.h
create mode 100644 tests/qtest/migration/tls-tests.c
[PATCH v2 00/22] tests/qtest: migration-test refactoring
Posted by Fabiano Rosas 1 year, 2 months ago
v2:
changelog:
    - s/migration-common/test-framework/
    - call hooks migrate_hook_start|end_*
    - added migration-qmp.h
    - minor stuff

Refactor migration-test.c and migration-helpers.c into multiple
smaller files structured like so:

qtest/migration/
    test-framework.h
    test-framework.c - core tests infrastructure: migrate_start|end,
                       *_common, wait_for_*, check_guests_ram, etc.

    migration-util.h
    migration-util.c - general utilities, equivalent to
                       migration-helpers.c

    migration-qmp.h
    migration-qmp.c - utilities for querying information via QMP

    bootfile.h - formerly migration-test.h, the old name was confusing
    bootfile.c - the guest code

    # test code, without main()
    compression-tests.c
    cpr-tests.c
    file-tests.c
    misc-tests.c
    postcopy-tests.c
    precopy-tests.c
    tls-tests.c

qtest/
    migration/ - the directory above

    # actual glib tests, with main()
    migration-test.c - all tests
    migration-test-smoke.c - a subset of smoke tests from each test group

The 'smoke' test runs for every TCG target while the full test runs
only if KVM is available. This saves ~3 minutes with make -j1 in a
build with all 4 migration targets. This strategy keeps the full
coverage as long as someone is running the tests in a KVM host, which
I think is fair as migrating KVM guests is the main use for migration.

Developers can still force the full set to run on TCG by calling:
./migration-test -m thorough

$ arch
x86_64
$ make -j16 check-qtest-migration
...
1/8 qemu:qtest+qtest-x86_64+qtest-migration / qtest-x86_64/migration-test-smoke    SKIP  0.02s
2/8 qemu:qtest+qtest-ppc64+qtest-migration / qtest-ppc64/migration-test            SKIP  0.02s
3/8 qemu:qtest+qtest-aarch64+qtest-migration / qtest-aarch64/migration-test        SKIP  0.02s
4/8 qemu:qtest+qtest-s390x+qtest-migration / qtest-s390x/migration-test            SKIP  0.02s
5/8 qemu:qtest+qtest-s390x+qtest-migration / qtest-s390x/migration-test-smoke      OK   16.31s  14 subtests passed
6/8 qemu:qtest+qtest-ppc64+qtest-migration / qtest-ppc64/migration-test-smoke      OK   19.81s  14 subtests passed
7/8 qemu:qtest+qtest-aarch64+qtest-migration / qtest-aarch64/migration-test-smoke  OK   26.05s  14 subtests passed
8/8 qemu:qtest+qtest-x86_64+qtest-migration / qtest-x86_64/migration-test          OK   81.17s  53 subtests passed

CI run: https://gitlab.com/farosas/qemu/-/pipelines/1540922505

v1:
https://lore.kernel.org/r/20241105180837.5990-1-farosas@suse.de
v0:
https://lore.kernel.org/r/20241017143211.17771-1-farosas@suse.de

Fabiano Rosas (22):
  tests/qtest/migration: Fix indentations
  tests/qtest/migration: Standardize hook names
  tests/qtest/migration: Stop calling everything "test"
  tests/migration: Disambiguate guestperf vs. a-b
  tests/qtest/migration: Move bootfile code to its own file
  tests/qtest/migration: Move qmp helpers to a separate file
  tests/qtest/migration: Rename migration-helpers.c
  tests/qtest/migration: Move ufd_version_check to utils
  tests/qtest/migration: Move kvm_dirty_ring_supported to utils
  tests/qtest/migration: Isolate test initialization
  tests/qtest/migration: Move common test code
  tests/qtest/migration: Split TLS tests from migration-test.c
  tests/qtest/migration: Split compression tests from migration-test.c
  tests/qtest/migration: Split postcopy tests
  tests/qtest/migration: Split file tests
  tests/qtest/migration: Split precopy tests
  tests/qtest/migration: Split CPR tests
  tests/qtest/migration: Split validation tests + misc
  tests/qtest/migration: Add migration-test-smoke
  tests/qtest/migration: Pick smoke tests
  tests/qtest: Add support for check-qtest-<subsystem>
  docs: Add migration tests documentation

 MAINTAINERS                                   |    5 +-
 docs/devel/testing/index.rst                  |    1 +
 docs/devel/testing/main.rst                   |   12 +
 docs/devel/testing/migration.rst              |  261 ++
 docs/devel/testing/qtest.rst                  |    1 +
 tests/meson.build                             |    2 +-
 .../guestperf-batch.py                        |    0
 .../guestperf-plot.py                         |    0
 .../guestperf.py                              |    0
 .../guestperf/__init__.py                     |    0
 .../guestperf/comparison.py                   |    0
 .../guestperf/engine.py                       |    0
 .../guestperf/hardware.py                     |    0
 .../guestperf/plot.py                         |    0
 .../guestperf/progress.py                     |    0
 .../guestperf/report.py                       |    0
 .../guestperf/scenario.py                     |    0
 .../guestperf/shell.py                        |    0
 .../guestperf/timings.py                      |    0
 .../initrd-stress.sh                          |    0
 .../meson.build                               |    0
 .../{migration => migration-stress}/stress.c  |    0
 tests/qtest/meson.build                       |   46 +-
 tests/qtest/migration-test-smoke.c            |   39 +
 tests/qtest/migration-test.c                  | 4029 +----------------
 tests/{ => qtest}/migration/Makefile          |    0
 tests/{ => qtest}/migration/aarch64/Makefile  |    0
 .../migration/aarch64/a-b-kernel.S            |    0
 .../migration/aarch64/a-b-kernel.h            |    0
 tests/qtest/migration/bootfile.c              |   70 +
 .../migration/bootfile.h}                     |    9 +-
 tests/qtest/migration/compression-tests.c     |  244 +
 tests/qtest/migration/cpr-tests.c             |   65 +
 tests/qtest/migration/file-tests.c            |  338 ++
 tests/{ => qtest}/migration/i386/Makefile     |    0
 .../migration/i386/a-b-bootblock.S            |    0
 .../migration/i386/a-b-bootblock.h            |    0
 .../migration-qmp.c}                          |  567 ++-
 tests/qtest/migration/migration-qmp.h         |   46 +
 tests/qtest/migration/migration-util.c        |  362 ++
 .../migration-util.h}                         |   30 +-
 tests/qtest/migration/misc-tests.c            |  280 ++
 tests/qtest/migration/postcopy-tests.c        |  114 +
 tests/{ => qtest}/migration/ppc64/Makefile    |    0
 .../{ => qtest}/migration/ppc64/a-b-kernel.S  |    0
 .../{ => qtest}/migration/ppc64/a-b-kernel.h  |    0
 tests/qtest/migration/precopy-tests.c         | 1012 +++++
 tests/{ => qtest}/migration/s390x/Makefile    |    0
 tests/{ => qtest}/migration/s390x/a-b-bios.c  |    0
 tests/{ => qtest}/migration/s390x/a-b-bios.h  |    0
 tests/qtest/migration/test-framework.c        |  969 ++++
 tests/qtest/migration/test-framework.h        |  236 +
 tests/qtest/migration/tls-tests.c             |  797 ++++
 tests/qtest/virtio-net-failover.c             |    3 +-
 54 files changed, 5190 insertions(+), 4348 deletions(-)
 create mode 100644 docs/devel/testing/migration.rst
 rename tests/{migration => migration-stress}/guestperf-batch.py (100%)
 rename tests/{migration => migration-stress}/guestperf-plot.py (100%)
 rename tests/{migration => migration-stress}/guestperf.py (100%)
 rename tests/{migration => migration-stress}/guestperf/__init__.py (100%)
 rename tests/{migration => migration-stress}/guestperf/comparison.py (100%)
 rename tests/{migration => migration-stress}/guestperf/engine.py (100%)
 rename tests/{migration => migration-stress}/guestperf/hardware.py (100%)
 rename tests/{migration => migration-stress}/guestperf/plot.py (100%)
 rename tests/{migration => migration-stress}/guestperf/progress.py (100%)
 rename tests/{migration => migration-stress}/guestperf/report.py (100%)
 rename tests/{migration => migration-stress}/guestperf/scenario.py (100%)
 rename tests/{migration => migration-stress}/guestperf/shell.py (100%)
 rename tests/{migration => migration-stress}/guestperf/timings.py (100%)
 rename tests/{migration => migration-stress}/initrd-stress.sh (100%)
 rename tests/{migration => migration-stress}/meson.build (100%)
 rename tests/{migration => migration-stress}/stress.c (100%)
 create mode 100644 tests/qtest/migration-test-smoke.c
 rename tests/{ => qtest}/migration/Makefile (100%)
 rename tests/{ => qtest}/migration/aarch64/Makefile (100%)
 rename tests/{ => qtest}/migration/aarch64/a-b-kernel.S (100%)
 rename tests/{ => qtest}/migration/aarch64/a-b-kernel.h (100%)
 create mode 100644 tests/qtest/migration/bootfile.c
 rename tests/{migration/migration-test.h => qtest/migration/bootfile.h} (85%)
 create mode 100644 tests/qtest/migration/compression-tests.c
 create mode 100644 tests/qtest/migration/cpr-tests.c
 create mode 100644 tests/qtest/migration/file-tests.c
 rename tests/{ => qtest}/migration/i386/Makefile (100%)
 rename tests/{ => qtest}/migration/i386/a-b-bootblock.S (100%)
 rename tests/{ => qtest}/migration/i386/a-b-bootblock.h (100%)
 rename tests/qtest/{migration-helpers.c => migration/migration-qmp.c} (51%)
 create mode 100644 tests/qtest/migration/migration-qmp.h
 create mode 100644 tests/qtest/migration/migration-util.c
 rename tests/qtest/{migration-helpers.h => migration/migration-util.h} (67%)
 create mode 100644 tests/qtest/migration/misc-tests.c
 create mode 100644 tests/qtest/migration/postcopy-tests.c
 rename tests/{ => qtest}/migration/ppc64/Makefile (100%)
 rename tests/{ => qtest}/migration/ppc64/a-b-kernel.S (100%)
 rename tests/{ => qtest}/migration/ppc64/a-b-kernel.h (100%)
 create mode 100644 tests/qtest/migration/precopy-tests.c
 rename tests/{ => qtest}/migration/s390x/Makefile (100%)
 rename tests/{ => qtest}/migration/s390x/a-b-bios.c (100%)
 rename tests/{ => qtest}/migration/s390x/a-b-bios.h (100%)
 create mode 100644 tests/qtest/migration/test-framework.c
 create mode 100644 tests/qtest/migration/test-framework.h
 create mode 100644 tests/qtest/migration/tls-tests.c


base-commit: 134b443512825bed401b6e141447b8cdc22d2efe
-- 
2.35.3
Re: [PATCH v2 00/22] tests/qtest: migration-test refactoring
Posted by Peter Xu 1 year, 2 months ago
On Wed, Nov 13, 2024 at 04:46:08PM -0300, Fabiano Rosas wrote:
> Fabiano Rosas (22):
>   tests/qtest/migration: Fix indentations
>   tests/qtest/migration: Standardize hook names
>   tests/qtest/migration: Stop calling everything "test"
>   tests/migration: Disambiguate guestperf vs. a-b
>   tests/qtest/migration: Move bootfile code to its own file
>   tests/qtest/migration: Move qmp helpers to a separate file
>   tests/qtest/migration: Rename migration-helpers.c
>   tests/qtest/migration: Move ufd_version_check to utils
>   tests/qtest/migration: Move kvm_dirty_ring_supported to utils
>   tests/qtest/migration: Isolate test initialization
>   tests/qtest/migration: Move common test code
>   tests/qtest/migration: Split TLS tests from migration-test.c
>   tests/qtest/migration: Split compression tests from migration-test.c
>   tests/qtest/migration: Split postcopy tests
>   tests/qtest/migration: Split file tests
>   tests/qtest/migration: Split precopy tests
>   tests/qtest/migration: Split CPR tests
>   tests/qtest/migration: Split validation tests + misc

I'm not sure whether the above chunk could affect people reading the last
four, which is the real meat.

One thing we could do (but you can decide which you prefer..) is you can
respin with the initial 18 patches, then we may get it in in the 1st 10.0
pull.  It may conflict with some other series for sure, but it's
unavoidable with such changes one way or another..  then when it's there we
could repost the last four separately, so it can have a higher chance of
getting some comments.  So I'll leave that to you to decide.

I also wonder whether we could already move migration-test*.c into
tests/qtest/migration/ too.

>   tests/qtest/migration: Add migration-test-smoke
>   tests/qtest/migration: Pick smoke tests
>   tests/qtest: Add support for check-qtest-<subsystem>
>   docs: Add migration tests documentation

-- 
Peter Xu
Re: [PATCH v2 00/22] tests/qtest: migration-test refactoring
Posted by Fabiano Rosas 1 year, 2 months ago
Peter Xu <peterx@redhat.com> writes:

> On Wed, Nov 13, 2024 at 04:46:08PM -0300, Fabiano Rosas wrote:
>> Fabiano Rosas (22):
>>   tests/qtest/migration: Fix indentations
>>   tests/qtest/migration: Standardize hook names
>>   tests/qtest/migration: Stop calling everything "test"
>>   tests/migration: Disambiguate guestperf vs. a-b
>>   tests/qtest/migration: Move bootfile code to its own file
>>   tests/qtest/migration: Move qmp helpers to a separate file
>>   tests/qtest/migration: Rename migration-helpers.c
>>   tests/qtest/migration: Move ufd_version_check to utils
>>   tests/qtest/migration: Move kvm_dirty_ring_supported to utils
>>   tests/qtest/migration: Isolate test initialization
>>   tests/qtest/migration: Move common test code
>>   tests/qtest/migration: Split TLS tests from migration-test.c
>>   tests/qtest/migration: Split compression tests from migration-test.c
>>   tests/qtest/migration: Split postcopy tests
>>   tests/qtest/migration: Split file tests
>>   tests/qtest/migration: Split precopy tests
>>   tests/qtest/migration: Split CPR tests
>>   tests/qtest/migration: Split validation tests + misc
>
> I'm not sure whether the above chunk could affect people reading the last
> four, which is the real meat.
>
> One thing we could do (but you can decide which you prefer..) is you can
> respin with the initial 18 patches, then we may get it in in the 1st 10.0
> pull.  It may conflict with some other series for sure, but it's
> unavoidable with such changes one way or another..

I can put them on top of migration-next, sure. As I said previously,
just point me at any conflicting series and I can provide a rebase.

> then when it's there we could repost the last four separately, so it
> can have a higher chance of getting some comments.  So I'll leave that
> to you to decide.

That's fine.

>
> I also wonder whether we could already move migration-test*.c into
> tests/qtest/migration/ too.

I'll look into it.
Re: [PATCH v2 00/22] tests/qtest: migration-test refactoring
Posted by Peter Xu 1 year, 2 months ago
On Mon, Nov 25, 2024 at 06:18:15PM -0300, Fabiano Rosas wrote:
> > One thing we could do (but you can decide which you prefer..) is you can
> > respin with the initial 18 patches, then we may get it in in the 1st 10.0
> > pull.  It may conflict with some other series for sure, but it's
> > unavoidable with such changes one way or another..
> 
> I can put them on top of migration-next, sure. As I said previously,
> just point me at any conflicting series and I can provide a rebase.

I didn't queue anything yet for -next.  So far this series looks like the
closest to be queued first there.  So I suppose if you repost you can base
onto the master branch.

-- 
Peter Xu