aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/archive-source.sh2
-rwxr-xr-xscripts/checkpatch.pl3
-rwxr-xr-xscripts/ci/gitlab-failure-analysis117
-rwxr-xr-xscripts/make-release2
4 files changed, 121 insertions, 3 deletions
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 035828c..476a996 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -27,7 +27,7 @@ sub_file="${sub_tdir}/submodule.tar"
# in their checkout, because the build environment is completely
# different to the host OS.
subprojects="keycodemapdb libvfio-user berkeley-softfloat-3
- berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs
+ berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs attrs-0.2-rs bilge-0.2-rs
bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
libc-0.2-rs proc-macro2-1-rs
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 91616c9..40b6955 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1816,7 +1816,8 @@ sub process {
}
# Check SPDX-License-Identifier references a permitted license
- if ($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) {
+ if (($rawline =~ m,SPDX-License-Identifier: (.*?)(\*/)?\s*$,) &&
+ $rawline !~ /^-/) {
$fileinfo->{facts}->{sawspdx} = 1;
&checkspdx($realfile, $1);
}
diff --git a/scripts/ci/gitlab-failure-analysis b/scripts/ci/gitlab-failure-analysis
new file mode 100755
index 0000000..906725b
--- /dev/null
+++ b/scripts/ci/gitlab-failure-analysis
@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+#
+# A script to analyse failures in the gitlab pipelines. It requires an
+# API key from gitlab with the following permissions:
+# - api
+# - read_repository
+# - read_user
+#
+
+import argparse
+import gitlab
+import os
+
+#
+# Arguments
+#
+class NoneForEmptyStringAction(argparse.Action):
+ def __call__(self, parser, namespace, value, option_string=None):
+ if value == '':
+ setattr(namespace, self.dest, None)
+ else:
+ setattr(namespace, self.dest, value)
+
+
+parser = argparse.ArgumentParser(description="Analyse failed GitLab CI runs.")
+
+parser.add_argument("--gitlab",
+ default="https://gitlab.com",
+ help="GitLab instance URL (default: https://gitlab.com).")
+parser.add_argument("--id", default=11167699,
+ type=int,
+ help="GitLab project id (default: 11167699 for qemu-project/qemu)")
+parser.add_argument("--token",
+ default=os.getenv("GITLAB_TOKEN"),
+ help="Your personal access token with 'api' scope.")
+parser.add_argument("--branch",
+ type=str,
+ default="staging",
+ action=NoneForEmptyStringAction,
+ help="The name of the branch (default: 'staging')")
+parser.add_argument("--status",
+ type=str,
+ action=NoneForEmptyStringAction,
+ default="failed",
+ help="Filter by branch status (default: 'failed')")
+parser.add_argument("--count", type=int,
+ default=3,
+ help="The number of failed runs to fetch.")
+parser.add_argument("--skip-jobs",
+ default=False,
+ action='store_true',
+ help="Skip dumping the job info")
+parser.add_argument("--pipeline", type=int,
+ nargs="+",
+ default=None,
+ help="Explicit pipeline ID(s) to fetch.")
+
+
+if __name__ == "__main__":
+ args = parser.parse_args()
+
+ gl = gitlab.Gitlab(url=args.gitlab, private_token=args.token)
+ project = gl.projects.get(args.id)
+
+
+ pipelines_to_process = []
+
+ # Use explicit pipeline IDs if provided, otherwise fetch a list
+ if args.pipeline:
+ args.count = len(args.pipeline)
+ for p_id in args.pipeline:
+ pipelines_to_process.append(project.pipelines.get(p_id))
+ else:
+ # Use an iterator to fetch the pipelines
+ pipe_iter = project.pipelines.list(iterator=True,
+ status=args.status,
+ ref=args.branch)
+ # Check each failed pipeline
+ pipelines_to_process = [next(pipe_iter) for _ in range(args.count)]
+
+ # Check each pipeline
+ for p in pipelines_to_process:
+
+ jobs = p.jobs.list(get_all=True)
+ failed_jobs = [j for j in jobs if j.status == "failed"]
+ skipped_jobs = [j for j in jobs if j.status == "skipped"]
+ manual_jobs = [j for j in jobs if j.status == "manual"]
+
+ trs = p.test_report_summary.get()
+ total = trs.total["count"]
+ skipped = trs.total["skipped"]
+ failed = trs.total["failed"]
+
+ print(f"{p.status} pipeline {p.id}, total jobs {len(jobs)}, "
+ f"skipped {len(skipped_jobs)}, "
+ f"failed {len(failed_jobs)}, ",
+ f"{total} tests, "
+ f"{skipped} skipped tests, "
+ f"{failed} failed tests")
+
+ if not args.skip_jobs:
+ for j in failed_jobs:
+ print(f" Failed job {j.id}, {j.name}, {j.web_url}")
+
+ # It seems we can only extract failing tests from the full
+ # test report, maybe there is some way to filter it.
+
+ if failed > 0:
+ ftr = p.test_report.get()
+ failed_suites = [s for s in ftr.test_suites if
+ s["failed_count"] > 0]
+ for fs in failed_suites:
+ name = fs["name"]
+ tests = fs["test_cases"]
+ failed_tests = [t for t in tests if t["status"] == 'failed']
+ for t in failed_tests:
+ print(f" Failed test {t["classname"]}, {name}, {t["name"]}")
diff --git a/scripts/make-release b/scripts/make-release
index 87f563e..bc1b43c 100755
--- a/scripts/make-release
+++ b/scripts/make-release
@@ -40,7 +40,7 @@ fi
# Only include wraps that are invoked with subproject()
SUBPROJECTS="libvfio-user keycodemapdb berkeley-softfloat-3
- berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs bilge-0.2-rs
+ berkeley-testfloat-3 anyhow-1-rs arbitrary-int-1-rs attrs-0.2-rs bilge-0.2-rs
bilge-impl-0.2-rs either-1-rs foreign-0.3-rs itertools-0.11-rs
libc-0.2-rs proc-macro2-1-rs
proc-macro-error-1-rs proc-macro-error-attr-1-rs quote-1-rs