mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
* 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:
commit
b37da83763
23 changed files with 314 additions and 109 deletions
|
@ -23,20 +23,28 @@ import time
|
|||
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"
|
||||
"""
|
||||
result = subprocess.run(['git', 'rev-parse', 'staging'],
|
||||
result = subprocess.run(['git', 'rev-parse', branch],
|
||||
stdin=subprocess.DEVNULL,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL,
|
||||
cwd=os.path.dirname(__file__),
|
||||
universal_newlines=True).stdout.strip()
|
||||
if result == 'staging':
|
||||
raise ValueError("There's no local branch named 'staging'")
|
||||
if result == branch:
|
||||
raise ValueError("There's no local branch named '%s'" % branch)
|
||||
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
|
||||
|
||||
|
||||
|
@ -50,14 +58,14 @@ def get_pipeline_status(project_id, commit_sha1):
|
|||
connection.request('GET', url=url)
|
||||
response = connection.getresponse()
|
||||
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())
|
||||
|
||||
# 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
|
||||
# filters to the url, such as username, and order_by.
|
||||
if not json_response:
|
||||
raise ValueError("No pipeline found")
|
||||
raise NoPipelineFound("No pipeline found")
|
||||
return json_response[0]
|
||||
|
||||
|
||||
|
@ -69,16 +77,28 @@ def wait_on_pipeline_success(timeout, interval,
|
|||
start = time.time()
|
||||
while True:
|
||||
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
|
||||
|
||||
status = get_pipeline_status(project_id, commit_sha)
|
||||
if status['status'] == 'running':
|
||||
time.sleep(interval)
|
||||
print('running...')
|
||||
try:
|
||||
status = get_pipeline_status(project_id, commit_sha)
|
||||
except NoPipelineFound:
|
||||
print('Pipeline has not been found, it may not have been created yet.')
|
||||
time.sleep(1)
|
||||
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
|
||||
|
||||
msg = "Pipeline failed, check: %s" % status['web_url']
|
||||
|
@ -86,10 +106,7 @@ def wait_on_pipeline_success(timeout, interval,
|
|||
return False
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Script entry point
|
||||
"""
|
||||
def create_parser():
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='pipeline-status',
|
||||
description='check or wait on a pipeline status')
|
||||
|
@ -110,7 +127,7 @@ def main():
|
|||
'for https://gitlab.com/qemu-project/qemu, that '
|
||||
'is, "%(default)s"'))
|
||||
try:
|
||||
default_commit = get_local_staging_branch_commit()
|
||||
default_commit = get_local_branch_commit()
|
||||
commit_required = False
|
||||
except ValueError:
|
||||
default_commit = ''
|
||||
|
@ -124,9 +141,15 @@ def main():
|
|||
parser.add_argument('--verbose', action='store_true', default=False,
|
||||
help=('A minimal verbosity level that prints the '
|
||||
'overall result of the check/wait'))
|
||||
return parser
|
||||
|
||||
def main():
|
||||
"""
|
||||
Script entry point
|
||||
"""
|
||||
parser = create_parser()
|
||||
args = parser.parse_args()
|
||||
|
||||
success = False
|
||||
try:
|
||||
if args.wait:
|
||||
success = wait_on_pipeline_success(
|
||||
|
@ -139,9 +162,11 @@ def main():
|
|||
args.commit)
|
||||
success = status['status'] == 'success'
|
||||
except Exception as error: # pylint: disable=W0703
|
||||
success = False
|
||||
if args.verbose:
|
||||
print("ERROR: %s" % error.args[0])
|
||||
except KeyboardInterrupt:
|
||||
if args.verbose:
|
||||
print("Exiting on user's request")
|
||||
|
||||
if success:
|
||||
if args.verbose:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue