Compare commits

...

2 Commits

Author SHA1 Message Date
Fabiano Rosas
71b4afac84 tests/qtest: Pass migration tests individually to meson
Having glib tests (qtest) all defined in a single test file makes it
hard to know which test has failed when running CI. Create a new
'migration' test suite and move the migration tests individually to
meson.

For now, use the global migration-test timeout value, but we could set
a per-subtest timeout in the future.

Sample output:

$ ../configure --target-list=x86_64-softmmu,aarch64-softmmu ...
$ make check-migration
...
36/469 qemu:migration / /x86_64/migration/precopy/unix/plain                       OK    34.25s   1 subtests passed
37/469 qemu:migration / /x86_64/migration/multifd/tcp/tls/x509/default-host        OK     7.33s   1 subtests passed
39/469 qemu:migration / /x86_64/migration/multifd/tcp/tls/x509/allow-anon-client   OK     7.32s   1 subtests passed
40/469 qemu:migration / /aarch64/migration/postcopy/compress/plain                 SKIP   0.04s
41/469 qemu:migration / /aarch64/migration/postcopy/recovery/compress/plain        SKIP   0.04s
42/469 qemu:migration / /aarch64/migration/bad_dest                                OK     0.65s   1 subtests passed

Signed-off-by: Fabiano Rosas <farosas@suse.de>
2023-06-30 11:33:21 -03:00
Fabiano Rosas
36466cab88 tests/qtest: Add a script to gather migration tests list
This is a workaround for limitations with meson.

We'd like to have each migration (sub)test registered with meson's
test() function, but since they are all inside the single
migration-test.c there's no way for meson to see the tests. We need an
external way to generate the list of tests and pass it to meson.

We cannot call 'migration-test -l' because we'd need to build the
migration-test binary first and while that is possible, there's no
subsequent way to get the generated list into a meson variable for
consumption. None of meson's routines support retrieving an arbitrary
list of strings from a command at build (vs. configure) time.

We also cannot use generators to have 'migration-test' write to a file
because that would happen at build time and meson does not support
reading from a file in the build directory.

So the only approach left is to either have the list of tests
committed into the source code or to grep the source code for the
list. Committing the file would be harder to maintain and the test
registration in migration-test.c is pretty static, so this patch uses
the grep approach. But using python because it is more portable.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
2023-06-30 11:32:54 -03:00
2 changed files with 43 additions and 9 deletions

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env python3
import re
import sys
file_path = sys.argv[1]
with open(file_path, 'r') as f:
for line in f.readlines():
match = re.search('\"(/migration/.*)\"', line)
if match:
print(match.groups()[0])

View File

@@ -369,14 +369,36 @@ foreach dir : target_dirs
test: executable(test, src, dependencies: deps)
}
endif
test('qtest-@0@/@1@'.format(target_base, test),
qtest_executables[test],
depends: [test_deps, qtest_emulator, emulator_modules],
env: qtest_env,
args: ['--tap', '-k'],
protocol: 'tap',
timeout: slow_qtests.get(test, 30),
priority: slow_qtests.get(test, 30),
suite: ['qtest', 'qtest-' + target_base])
migtest = 'migration-test'
if test == migtest
migtests = run_command(python, files('gen_migration_tests_list.py'),
meson.current_source_dir() / 'migration-test.c',
check: true)
foreach item : migtests.stdout().strip().split('\n')
testname = '/@0@@1@'.format(target_base, item)
test(testname,
qtest_executables['migration-test'],
depends: [test_deps, qtest_emulator, emulator_modules],
env: qtest_env,
args: ['-k', '-p', testname],
protocol: 'tap',
timeout: slow_qtests.get(migtest),
priority: slow_qtests.get(migtest),
suite: ['migration'])
endforeach
else
test('qtest-@0@/@1@'.format(target_base, test),
qtest_executables[test],
depends: [test_deps, qtest_emulator, emulator_modules],
env: qtest_env,
args: ['--tap', '-k'],
protocol: 'tap',
timeout: slow_qtests.get(test, 30),
priority: slow_qtests.get(test, 30),
suite: ['qtest', 'qtest-' + target_base])
endif
endforeach
endforeach