Skip to contentSkip to conversation

scripts/autobuild-run: add support for --branch option

PATCH New James Hilliard 1 participant 1 message May 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/autobuild-run: add support for --branch option

In some cases it only makes sense to run tests against a specific branch, such as when testing new genrandconfig flags.

Add a config option to override the branch selection.

---
 scripts/autobuild-run | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
scripts/autobuild-run +10 -1
index c375f7b..29272d2 100755
@@ -202,7 +202,7 @@ class SystemInfo:
 class Builder:
     def __init__(self, instance, njobs, sysinfo,
                  http_url, http_login, http_password,
-                 submitter, make_opts, nice, toolchains_csv,
+                 submitter, make_opts, branch, nice, toolchains_csv,
                  repo, upload, buildpid, debug, hung_build_timeout):
         self.instance = instance
         self.njobs = njobs
@@ -212,6 +212,7 @@ class Builder:
         self.http_password = http_password
         self.submitter = submitter
         self.make_opts = make_opts
+        self.branch = branch
         self.nice = nice
         self.toolchains_csv = toolchains_csv
         self.repo = repo
@@ -260,6 +261,8 @@ class Builder:
         list. This way, branches with a higher weight are more likely to
         be selected.
         """
+        if self.branch:
+            return self.branch
         csv_branches = []
         with urlopen_closing(urlparse.urljoin(self.http_url, 'branches')) as r:
             for l in r.readlines():
@@ -782,6 +785,11 @@ def main():
                         help="string of extra options to pass to Buildroot "
                              "make, such as specific command wrappers",
                         type=str)
+    parser.add_argument("--branch",
+                        help="Restrict builds to a specific branch. "
+                             "Useful for situations where it only makes sense "
+                             "to run tests on a specific branch.",
+                        type=str)
     parser.add_argument("--pid-file",
                         help="path to a file where to store the PID",
                         type=pathlib.Path, default=pathlib.Path("/tmp/buildroot-autobuild.pid"))
@@ -875,6 +883,7 @@ def main():
             http_password = args.http_password,
             submitter = args.submitter,
             make_opts = (args.make_opts or ''),
+            branch = args.branch,
             nice = (args.nice or 0),
             toolchains_csv = args.toolchains_csv,
             repo = args.repo,
Signature · 6 lines
2.53.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot