* qtest improvements (test for crash found with the fuzzer, increase

downtime in migration test, less verbose output when running w/o KVM)
 * Improve handling of acceptance tests in the Gitlab-CI
 * Run checkpatch.pl in the Gitlab-CI
 * Improve the gitlab-pipeline-status script
 * Misc patches (mark 'moxie' as deprecated, remove stale .gitignore files, ...)
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAl+FhiIRHHRodXRoQHJl
 ZGhhdC5jb20ACgkQLtnXdP5wLbXfcBAAkMc4eUbZ0Wkm7M7TdIRkn1vQEstgvyJN
 6t02MuqY0R01rdbIBAnCLSw9okxfCTf7Q33VmC7snLtPo6WmvYIPAXZAnUiz13K1
 hGhMJfEY0JSyPEXlENMC/SWcRfNuHud6OPp6KePvn6EQsVZ5CR9SeO5zMsCVj2SP
 bMaBYIAJsVCEHkR2lq9UXbjckjyO0GQnQ/oR3mNiqDLYBmrXUOxIFMBctgfbuUtm
 uPuvvknHVQa8foD18qVJ8QYZrpwrqN4edFjcoW3yvwfX6OOhTnx+pY43BG/of9YB
 OoRY7V4VN8aYmVR08sqyn6PRNpXW9WcSUn8D3JNeiAhLzO/8H197JhHwFVvbZc7t
 puLECIINy91wH2i3Onx7HWhss3XLUK3HsvWNLrvLui6vdbFHEtiW2/0GbwJzrcA0
 a9inH7bvI7BlPiIau/J7goaDv0fzZ7xVXlQcrM8hC9oCWH5gvmvcgTBWJn/5OxUZ
 fov3iFxcRWslFSQe+D66gBceIl/fScF+TUmPoWyeSlD/f1OR2WW+q8N1FvnbLflz
 oPutIoja8b6CobzAzp8Igc6/9uQvzCAFB92Y8q1Og7eguQybw7dDtbArjBmjUBVi
 slFWoY8/ri2+uyiPsyU13Yfu9N5myqdwIQeM7H8sQ7qS40QHp0z2tj18o951xH2w
 WJv3PlGcez4=
 =lCRK
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-10-13' into staging

* qtest improvements (test for crash found with the fuzzer, increase
  downtime in migration test, less verbose output when running w/o KVM)
* Improve handling of acceptance tests in the Gitlab-CI
* Run checkpatch.pl in the Gitlab-CI
* Improve the gitlab-pipeline-status script
* Misc patches (mark 'moxie' as deprecated, remove stale .gitignore files, ...)

# gpg: Signature made Tue 13 Oct 2020 11:49:06 BST
# gpg:                using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg:                issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg:                 aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg:                 aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg:                 aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3  EAB9 2ED9 D774 FE70 2DB5

* remotes/huth-gitlab/tags/pull-request-2020-10-13: (23 commits)
  scripts/ci/gitlab-pipeline-status: wait for pipeline creation
  scripts/ci/gitlab-pipeline-status: use more descriptive exceptions
  scripts/ci/gitlab-pipeline-status: handle keyboard interrupts
  scripts/ci/gitlab-pipeline-status: refactor parser creation
  scripts/ci/gitlab-pipeline-status: give early feedback on running pipelines
  scripts/ci/gitlab-pipeline-status: improve message regarding timeout
  scripts/ci/gitlab-pipeline-status: make branch name configurable
  gitlab: assign python helper files to GitLab maintainers section
  gitlab: add a CI job to validate the DCO sign off
  gitlab: add a CI job for running checkpatch.pl
  configure: fixes indent of $meson setup
  docs/system/deprecated: Mark the 'moxie' CPU as deprecated
  Remove superfluous .gitignore files
  MAINTAINERS: Ignore bios-tables-test in the qtest section
  Add a comment in bios-tables-test.c to clarify the reason behind approach
  softmmu/vl: Be less verbose about missing KVM when running the qtests
  tests/migration: Allow longer timeouts
  qtest: add fuzz test case
  Acceptance tests: show test report on GitLab CI
  Acceptance tests: do not show canceled test logs on GitLab CI
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-10-13 12:46:26 +01:00
commit b37da83763
23 changed files with 314 additions and 109 deletions

94
.gitlab-ci.d/check-dco.py Executable file
View File

@ -0,0 +1,94 @@
#!/usr/bin/env python3
#
# check-dco.py: validate all commits are signed off
#
# Copyright (C) 2020 Red Hat, Inc.
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os
import os.path
import sys
import subprocess
namespace = "qemu-project"
if len(sys.argv) >= 2:
namespace = sys.argv[1]
cwd = os.getcwd()
reponame = os.path.basename(cwd)
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
subprocess.check_call(["git", "remote", "add", "check-dco", repourl])
subprocess.check_call(["git", "fetch", "check-dco", "master"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
ancestor = subprocess.check_output(["git", "merge-base",
"check-dco/master", "HEAD"],
universal_newlines=True)
ancestor = ancestor.strip()
subprocess.check_call(["git", "remote", "rm", "check-dco"])
errors = False
print("\nChecking for 'Signed-off-by: NAME <EMAIL>' " +
"on all commits since %s...\n" % ancestor)
log = subprocess.check_output(["git", "log", "--format=%H %s",
ancestor + "..."],
universal_newlines=True)
if log == "":
commits = []
else:
commits = [[c[0:40], c[41:]] for c in log.strip().split("\n")]
for sha, subject in commits:
msg = subprocess.check_output(["git", "show", "-s", sha],
universal_newlines=True)
lines = msg.strip().split("\n")
print("🔍 %s %s" % (sha, subject))
sob = False
for line in lines:
if "Signed-off-by:" in line:
sob = True
if "localhost" in line:
print(" ❌ FAIL: bad email in %s" % line)
errors = True
if not sob:
print(" ❌ FAIL missing Signed-off-by tag")
errors = True
if errors:
print("""
ERROR: One or more commits are missing a valid Signed-off-By tag.
This project requires all contributors to assert that their contributions
are provided in compliance with the terms of the Developer's Certificate
of Origin 1.1 (DCO):
https://developercertificate.org/
To indicate acceptance of the DCO every commit must have a tag
Signed-off-by: REAL NAME <EMAIL>
This can be achieved by passing the "-s" flag to the "git commit" command.
To bulk update all commits on current branch "git rebase" can be used:
git rebase -i master -x 'git commit --amend --no-edit -s'
""")
sys.exit(1)
sys.exit(0)

48
.gitlab-ci.d/check-patch.py Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env python3
#
# check-patch.py: run checkpatch.pl across all commits in a branch
#
# Copyright (C) 2020 Red Hat, Inc.
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os
import os.path
import sys
import subprocess
namespace = "qemu-project"
if len(sys.argv) >= 2:
namespace = sys.argv[1]
cwd = os.getcwd()
reponame = os.path.basename(cwd)
repourl = "https://gitlab.com/%s/%s.git" % (namespace, reponame)
# GitLab CI environment does not give us any direct info about the
# base for the user's branch. We thus need to figure out a common
# ancestor between the user's branch and current git master.
subprocess.check_call(["git", "remote", "add", "check-patch", repourl])
subprocess.check_call(["git", "fetch", "check-patch", "master"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
ancestor = subprocess.check_output(["git", "merge-base",
"check-patch/master", "HEAD"],
universal_newlines=True)
ancestor = ancestor.strip()
subprocess.check_call(["git", "remote", "rm", "check-patch"])
errors = False
print("\nChecking all commits since %s...\n" % ancestor)
ret = subprocess.run(["scripts/checkpatch.pl", ancestor + "..."])
if ret.returncode != 0:
print(" ❌ FAIL one or more commits failed scripts/checkpatch.pl")
sys.exit(1)
sys.exit(0)

View File

@ -53,6 +53,11 @@ include:
paths: paths:
- ${CI_PROJECT_DIR}/avocado-cache - ${CI_PROJECT_DIR}/avocado-cache
policy: pull-push policy: pull-push
artifacts:
paths:
- build/tests/results/latest/results.xml
reports:
junit: build/tests/results/latest/results.xml
before_script: before_script:
- mkdir -p ~/.config/avocado - mkdir -p ~/.config/avocado
- echo "[datadir.paths]" > ~/.config/avocado/avocado.conf - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
@ -63,7 +68,7 @@ include:
fi fi
after_script: after_script:
- cd build - cd build
- python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP")]' | xargs cat - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP", "CANCEL")]' | xargs cat
- du -chs ${CI_PROJECT_DIR}/avocado-cache - du -chs ${CI_PROJECT_DIR}/avocado-cache
build-system-ubuntu: build-system-ubuntu:
@ -303,7 +308,7 @@ build-oss-fuzz:
| grep -v slirp); do | grep -v slirp); do
grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ; grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
echo Testing ${fuzzer} ... ; echo Testing ${fuzzer} ... ;
"${fuzzer}" -runs=1000 -seed=1 || exit 1 ; "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
done done
# Unrelated to fuzzer: run some tests with -fsanitize=address # Unrelated to fuzzer: run some tests with -fsanitize=address
- cd build-oss-fuzz && make check-qtest-i386 check-unit - cd build-oss-fuzz && make check-qtest-i386 check-unit
@ -394,3 +399,25 @@ check-crypto-only-gnutls:
variables: variables:
IMAGE: centos7 IMAGE: centos7
MAKE_CHECK_ARGS: check MAKE_CHECK_ARGS: check
check-patch:
stage: build
image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
script: .gitlab-ci.d/check-patch.py
except:
variables:
- $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
variables:
GIT_DEPTH: 1000
allow_failure: true
check-dco:
stage: build
image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
script: .gitlab-ci.d/check-dco.py
except:
variables:
- $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
variables:
GIT_DEPTH: 1000

View File

@ -2497,7 +2497,7 @@ S: Maintained
F: softmmu/qtest.c F: softmmu/qtest.c
F: accel/qtest/ F: accel/qtest/
F: tests/qtest/ F: tests/qtest/
X: tests/qtest/bios-tables-test-allowed-diff.h X: tests/qtest/bios-tables-test*
Device Fuzzing Device Fuzzing
M: Alexander Bulekov <alxndr@bu.edu> M: Alexander Bulekov <alxndr@bu.edu>
@ -3128,6 +3128,7 @@ R: Wainer dos Santos Moschetta <wainersm@redhat.com>
S: Maintained S: Maintained
F: .gitlab-ci.yml F: .gitlab-ci.yml
F: .gitlab-ci.d/crossbuilds.yml F: .gitlab-ci.d/crossbuilds.yml
F: .gitlab-ci.d/*py
Guest Test Compilation Support Guest Test Compilation Support
M: Alex Bennée <alex.bennee@linaro.org> M: Alex Bennée <alex.bennee@linaro.org>

14
configure vendored
View File

@ -7211,13 +7211,13 @@ NINJA=${ninja:-$PWD/ninjatool} $meson setup \
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \ -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \ -Db_staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \ -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
-Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \ -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
-Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \ -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
-Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \ -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \ -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
$cross_arg \ $cross_arg \
"$PWD" "$source_path" "$PWD" "$source_path"

View File

@ -283,6 +283,14 @@ for VNC should be performed using the pluggable QAuthZ objects.
System emulator CPUS System emulator CPUS
-------------------- --------------------
``moxie`` CPU (since 5.2.0)
'''''''''''''''''''''''''''
The ``moxie`` guest CPU support is deprecated and will be removed in
a future version of QEMU. It's unclear whether anybody is still using
CPU emulation in QEMU, and there are no test images available to make
sure that the code is still working.
``compat`` property of server class POWER CPUs (since 5.0) ``compat`` property of server class POWER CPUs (since 5.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

View File

@ -1 +0,0 @@
/*.stamp

2
plugins/.gitignore vendored
View File

@ -1,2 +0,0 @@
qemu-plugins-ld.symbols
qemu-plugins-ld64.symbols

View File

@ -23,20 +23,28 @@ import time
import sys import sys
def get_local_staging_branch_commit(): class CommunicationFailure(Exception):
"""Failed to communicate to gitlab.com APIs."""
class NoPipelineFound(Exception):
"""Communication is successfull but pipeline is not found."""
def get_local_branch_commit(branch='staging'):
""" """
Returns the commit sha1 for the *local* branch named "staging" Returns the commit sha1 for the *local* branch named "staging"
""" """
result = subprocess.run(['git', 'rev-parse', 'staging'], result = subprocess.run(['git', 'rev-parse', branch],
stdin=subprocess.DEVNULL, stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
cwd=os.path.dirname(__file__), cwd=os.path.dirname(__file__),
universal_newlines=True).stdout.strip() universal_newlines=True).stdout.strip()
if result == 'staging': if result == branch:
raise ValueError("There's no local branch named 'staging'") raise ValueError("There's no local branch named '%s'" % branch)
if len(result) != 40: if len(result) != 40:
raise ValueError("Branch staging HEAD doesn't look like a sha1") raise ValueError("Branch '%s' HEAD doesn't look like a sha1" % branch)
return result return result
@ -50,14 +58,14 @@ def get_pipeline_status(project_id, commit_sha1):
connection.request('GET', url=url) connection.request('GET', url=url)
response = connection.getresponse() response = connection.getresponse()
if response.code != http.HTTPStatus.OK: if response.code != http.HTTPStatus.OK:
raise ValueError("Failed to receive a successful response") raise CommunicationFailure("Failed to receive a successful response")
json_response = json.loads(response.read()) json_response = json.loads(response.read())
# As far as I can tell, there should be only one pipeline for the same # As far as I can tell, there should be only one pipeline for the same
# project + commit. If this assumption is false, we can add further # project + commit. If this assumption is false, we can add further
# filters to the url, such as username, and order_by. # filters to the url, such as username, and order_by.
if not json_response: if not json_response:
raise ValueError("No pipeline found") raise NoPipelineFound("No pipeline found")
return json_response[0] return json_response[0]
@ -69,16 +77,28 @@ def wait_on_pipeline_success(timeout, interval,
start = time.time() start = time.time()
while True: while True:
if time.time() >= (start + timeout): if time.time() >= (start + timeout):
print("Waiting on the pipeline timed out") msg = ("Timeout (-t/--timeout) of %i seconds reached, "
"won't wait any longer for the pipeline to complete")
msg %= timeout
print(msg)
return False return False
status = get_pipeline_status(project_id, commit_sha) try:
if status['status'] == 'running': status = get_pipeline_status(project_id, commit_sha)
time.sleep(interval) except NoPipelineFound:
print('running...') print('Pipeline has not been found, it may not have been created yet.')
time.sleep(1)
continue continue
if status['status'] == 'success': pipeline_status = status['status']
status_to_wait = ('created', 'waiting_for_resource', 'preparing',
'pending', 'running')
if pipeline_status in status_to_wait:
print('%s...' % pipeline_status)
time.sleep(interval)
continue
if pipeline_status == 'success':
return True return True
msg = "Pipeline failed, check: %s" % status['web_url'] msg = "Pipeline failed, check: %s" % status['web_url']
@ -86,10 +106,7 @@ def wait_on_pipeline_success(timeout, interval,
return False return False
def main(): def create_parser():
"""
Script entry point
"""
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='pipeline-status', prog='pipeline-status',
description='check or wait on a pipeline status') description='check or wait on a pipeline status')
@ -110,7 +127,7 @@ def main():
'for https://gitlab.com/qemu-project/qemu, that ' 'for https://gitlab.com/qemu-project/qemu, that '
'is, "%(default)s"')) 'is, "%(default)s"'))
try: try:
default_commit = get_local_staging_branch_commit() default_commit = get_local_branch_commit()
commit_required = False commit_required = False
except ValueError: except ValueError:
default_commit = '' default_commit = ''
@ -124,9 +141,15 @@ def main():
parser.add_argument('--verbose', action='store_true', default=False, parser.add_argument('--verbose', action='store_true', default=False,
help=('A minimal verbosity level that prints the ' help=('A minimal verbosity level that prints the '
'overall result of the check/wait')) 'overall result of the check/wait'))
return parser
def main():
"""
Script entry point
"""
parser = create_parser()
args = parser.parse_args() args = parser.parse_args()
success = False
try: try:
if args.wait: if args.wait:
success = wait_on_pipeline_success( success = wait_on_pipeline_success(
@ -139,9 +162,11 @@ def main():
args.commit) args.commit)
success = status['status'] == 'success' success = status['status'] == 'success'
except Exception as error: # pylint: disable=W0703 except Exception as error: # pylint: disable=W0703
success = False
if args.verbose: if args.verbose:
print("ERROR: %s" % error.args[0]) print("ERROR: %s" % error.args[0])
except KeyboardInterrupt:
if args.verbose:
print("Exiting on user's request")
if success: if success:
if args.verbose: if args.verbose:

View File

@ -165,8 +165,9 @@ bool boot_strict;
uint8_t *boot_splash_filedata; uint8_t *boot_splash_filedata;
int only_migratable; /* turn it off unless user states otherwise */ int only_migratable; /* turn it off unless user states otherwise */
bool wakeup_suspend_enabled; bool wakeup_suspend_enabled;
int icount_align_option; int icount_align_option;
static const char *qtest_chrdev;
static const char *qtest_log;
/* The bytes in qemu_uuid are in the order specified by RFC4122, _not_ in the /* The bytes in qemu_uuid are in the order specified by RFC4122, _not_ in the
* little-endian "wire format" described in the SMBIOS 2.6 specification. * little-endian "wire format" described in the SMBIOS 2.6 specification.
@ -2713,10 +2714,15 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
AccelClass *ac = accel_find(acc); AccelClass *ac = accel_find(acc);
AccelState *accel; AccelState *accel;
int ret; int ret;
bool qtest_with_kvm;
qtest_with_kvm = g_str_equal(acc, "kvm") && qtest_chrdev != NULL;
if (!ac) { if (!ac) {
*p_init_failed = true; *p_init_failed = true;
error_report("invalid accelerator %s", acc); if (!qtest_with_kvm) {
error_report("invalid accelerator %s", acc);
}
return 0; return 0;
} }
accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac))); accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
@ -2728,8 +2734,9 @@ static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
ret = accel_init_machine(accel, current_machine); ret = accel_init_machine(accel, current_machine);
if (ret < 0) { if (ret < 0) {
*p_init_failed = true; *p_init_failed = true;
error_report("failed to initialize %s: %s", if (!qtest_with_kvm || ret != -ENOENT) {
acc, strerror(-ret)); error_report("failed to initialize %s: %s", acc, strerror(-ret));
}
return 0; return 0;
} }
@ -2800,7 +2807,7 @@ static void configure_accelerators(const char *progname)
exit(1); exit(1);
} }
if (init_failed) { if (init_failed && !qtest_chrdev) {
AccelClass *ac = ACCEL_GET_CLASS(current_accel()); AccelClass *ac = ACCEL_GET_CLASS(current_accel());
error_report("falling back to %s", ac->name); error_report("falling back to %s", ac->name);
} }
@ -2870,8 +2877,6 @@ void qemu_init(int argc, char **argv, char **envp)
MachineClass *machine_class; MachineClass *machine_class;
const char *cpu_option; const char *cpu_option;
const char *vga_model = NULL; const char *vga_model = NULL;
const char *qtest_chrdev = NULL;
const char *qtest_log = NULL;
const char *incoming = NULL; const char *incoming = NULL;
bool userconfig = true; bool userconfig = true;
bool nographic = false; bool nographic = false;

32
tests/.gitignore vendored
View File

@ -1,32 +0,0 @@
atomic_add-bench
benchmark-crypto-cipher
benchmark-crypto-hash
benchmark-crypto-hmac
check-*
!check-*.c
!check-*.sh
fp/*.out
qht-bench
rcutorture
test-*
!test-*.c
!test-*.py
!docker/test-*
test-qapi-commands.[ch]
test-qapi-init-commands.[ch]
include/test-qapi-commands-sub-module.[ch]
test-qapi-commands-sub-sub-module.[ch]
test-qapi-emit-events.[ch]
test-qapi-events.[ch]
include/test-qapi-events-sub-module.[ch]
test-qapi-events-sub-sub-module.[ch]
test-qapi-types.[ch]
include/test-qapi-types-sub-module.[ch]
test-qapi-types-sub-sub-module.[ch]
test-qapi-visit.[ch]
include/test-qapi-visit-sub-module.[ch]
test-qapi-visit-sub-sub-module.[ch]
test-qapi-introspect.[ch]
*-test
qapi-schema/*.test.*
vm/*.img

2
tests/fp/.gitignore vendored
View File

@ -1,2 +0,0 @@
fp-test
fp-bench

View File

@ -1,2 +0,0 @@
initrd-stress.img
stress

View File

@ -1,3 +0,0 @@
*.bin
*.elf
test.out

View File

@ -1,9 +0,0 @@
check.log
check.time*
common.env
*.out.bad
*.notrun
socket_scm_helper
# ignore everything in the scratch directory
scratch/

View File

@ -11,7 +11,7 @@
*/ */
/* /*
* How to add or update the tests: * How to add or update the tests or commit changes that affect ACPI tables:
* Contributor: * Contributor:
* 1. add empty files for new tables, if any, under tests/data/acpi * 1. add empty files for new tables, if any, under tests/data/acpi
* 2. list any changed files in tests/qtest/bios-tables-test-allowed-diff.h * 2. list any changed files in tests/qtest/bios-tables-test-allowed-diff.h
@ -38,6 +38,11 @@
* $(SRC_PATH)/tests/data/acpi/rebuild-expected-aml.sh * $(SRC_PATH)/tests/data/acpi/rebuild-expected-aml.sh
* 6. Now commit any changes to the expected binary, include diff from step 4 * 6. Now commit any changes to the expected binary, include diff from step 4
* in commit log. * in commit log.
* Expected binary updates needs to be a separate patch from the code that
* introduces changes to ACPI tables. It lets the maintainer drop
* and regenerate binary updates in case of merge conflicts. Further, a code
* change is easily reviewable but a binary blob is not (without doing a
* disassembly).
* 7. Before sending patches to the list (Contributor) * 7. Before sending patches to the list (Contributor)
* or before doing a pull request (Maintainer), make sure * or before doing a pull request (Maintainer), make sure
* tests/qtest/bios-tables-test-allowed-diff.h is empty - this will ensure * tests/qtest/bios-tables-test-allowed-diff.h is empty - this will ensure

49
tests/qtest/fuzz-test.c Normal file
View File

@ -0,0 +1,49 @@
/*
* QTest testcase for fuzz case
*
* Copyright (c) 2020 Li Qiang <liq3ea@gmail.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "libqos/libqtest.h"
/*
* This used to trigger the assert in scsi_dma_complete
* https://bugs.launchpad.net/qemu/+bug/1878263
*/
static void test_lp1878263_megasas_zero_iov_cnt(void)
{
QTestState *s;
s = qtest_init("-nographic -monitor none -serial none "
"-M q35 -device megasas -device scsi-cd,drive=null0 "
"-blockdev driver=null-co,read-zeroes=on,node-name=null0");
qtest_outl(s, 0xcf8, 0x80001818);
qtest_outl(s, 0xcfc, 0xc101);
qtest_outl(s, 0xcf8, 0x8000181c);
qtest_outl(s, 0xcf8, 0x80001804);
qtest_outw(s, 0xcfc, 0x7);
qtest_outl(s, 0xcf8, 0x8000186a);
qtest_writeb(s, 0x14, 0xfe);
qtest_writeb(s, 0x0, 0x02);
qtest_outb(s, 0xc1c0, 0x17);
qtest_quit(s);
}
int main(int argc, char **argv)
{
const char *arch = qtest_get_arch();
g_test_init(&argc, &argv, NULL);
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt",
test_lp1878263_megasas_zero_iov_cnt);
}
return g_test_run();
}

View File

@ -54,6 +54,7 @@ qtests_i386 = \
'bios-tables-test', 'bios-tables-test',
'rtc-test', 'rtc-test',
'i440fx-test', 'i440fx-test',
'fuzz-test',
'fw_cfg-test', 'fw_cfg-test',
'device-plug-test', 'device-plug-test',
'drive_del-test', 'drive_del-test',

View File

@ -34,6 +34,9 @@ unsigned start_address;
unsigned end_address; unsigned end_address;
static bool uffd_feature_thread_id; static bool uffd_feature_thread_id;
/* A downtime where the test really should converge */
#define CONVERGE_DOWNTIME 1000
#if defined(__linux__) #if defined(__linux__)
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/vfs.h> #include <sys/vfs.h>
@ -864,8 +867,7 @@ static void test_precopy_unix(void)
wait_for_migration_pass(from); wait_for_migration_pass(from);
/* 300 ms should converge */ migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME);
migrate_set_parameter_int(from, "downtime-limit", 300);
if (!got_stop) { if (!got_stop) {
qtest_qmp_eventwait(from, "STOP"); qtest_qmp_eventwait(from, "STOP");
@ -946,10 +948,12 @@ static void test_xbzrle(const char *uri)
migrate_qmp(from, uri, "{}"); migrate_qmp(from, uri, "{}");
wait_for_migration_pass(from);
/* Make sure we have 2 passes, so the xbzrle cache gets a workout */
wait_for_migration_pass(from); wait_for_migration_pass(from);
/* 300ms should converge */ /* 1000ms should converge */
migrate_set_parameter_int(from, "downtime-limit", 300); migrate_set_parameter_int(from, "downtime-limit", 1000);
if (!got_stop) { if (!got_stop) {
qtest_qmp_eventwait(from, "STOP"); qtest_qmp_eventwait(from, "STOP");
@ -999,8 +1003,7 @@ static void test_precopy_tcp(void)
wait_for_migration_pass(from); wait_for_migration_pass(from);
/* 300ms should converge */ migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME);
migrate_set_parameter_int(from, "downtime-limit", 300);
if (!got_stop) { if (!got_stop) {
qtest_qmp_eventwait(from, "STOP"); qtest_qmp_eventwait(from, "STOP");
@ -1068,8 +1071,7 @@ static void test_migrate_fd_proto(void)
wait_for_migration_pass(from); wait_for_migration_pass(from);
/* 300ms should converge */ migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME);
migrate_set_parameter_int(from, "downtime-limit", 300);
if (!got_stop) { if (!got_stop) {
qtest_qmp_eventwait(from, "STOP"); qtest_qmp_eventwait(from, "STOP");
@ -1304,8 +1306,7 @@ static void test_multifd_tcp(const char *method)
wait_for_migration_pass(from); wait_for_migration_pass(from);
/* 300ms it should converge */ migrate_set_parameter_int(from, "downtime-limit", CONVERGE_DOWNTIME);
migrate_set_parameter_int(from, "downtime-limit", 300);
if (!got_stop) { if (!got_stop) {
qtest_qmp_eventwait(from, "STOP"); qtest_qmp_eventwait(from, "STOP");

View File

@ -292,7 +292,7 @@ static void alarm_time(void)
break; break;
} }
clock_step(1000000000); clock_step(NANOSECONDS_PER_SECOND);
} }
g_assert(get_irq(RTC_ISA_IRQ)); g_assert(get_irq(RTC_ISA_IRQ));

View File

@ -2,4 +2,4 @@
# in the tests/venv Python virtual environment. For more info, # in the tests/venv Python virtual environment. For more info,
# refer to: https://pip.pypa.io/en/stable/user_guide/#id1 # refer to: https://pip.pypa.io/en/stable/user_guide/#id1
avocado-framework==81.0 avocado-framework==81.0
pycdlib==1.9.0 pycdlib==1.11.0

View File

@ -1,5 +0,0 @@
# These are build artefacts which only appear when you are doing
# builds directly in the source tree.
config-*.mak
*-softmmu/
*-linux-user/

View File

@ -1,3 +0,0 @@
Build
Conf
log