From: Atharva Lele <itsatharva@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v5 3/4] autobuild-run: initial implementation of do_reproducible_build()
Date: Mon, 17 Jun 2019 15:04:55 +0530 [thread overview]
Message-ID: <20190617093456.6110-3-itsatharva@gmail.com> (raw)
In-Reply-To: <20190617093456.6110-1-itsatharva@gmail.com>
This new function will call do_build() twice to produce two builds
and then check their reproducibility.
Signed-off-by: Atharva Lele <itsatharva@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
Changes v3 -> v4:
- Remove spaces on empty lines (suggested by Yann)
Changes v2 -> v3:
- make clean outputs to logfile, similar to other make calls (suggested by y_morin)
- Output dir needs abspath (suggested by y_morin)
- Directly use make clean as arguments rather than putting it into a variable
- Added missing period at end of commit message (suggested by arnout)
Changes v1 -> v2:
- make clean outputs to devnull (suggested by arnout)
- remove unnecessary arguments to make clean (suggested by arnout)
---
scripts/autobuild-run | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index 3f5af65..339fbde 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -492,6 +492,43 @@ def do_build(**kwargs):
log_write(log, "INFO: build successful")
return 0
+def do_reproducible_build(**kwargs):
+ """Run the builds for reproducibility testing
+
+ Build twice with the same configuration. Calls do_build() to
+ perform the actual build.
+ """
+
+ idir = "instance-%d" % kwargs['instance']
+ outputdir = os.path.abspath(os.path.join(idir, "output"))
+ srcdir = os.path.join(idir, "buildroot")
+ log = kwargs['log']
+
+ # Start the first build
+ log_write(log, "INFO: Reproducible Build Test, starting build 1")
+ ret = do_build(**kwargs)
+ if ret != 0:
+ log_write(log, "INFO: build 1 failed, skipping build 2")
+ return ret
+
+ # First build has been built, move files and start build 2
+ os.rename(os.path.join(outputdir, "images"), os.path.join(outputdir, "images-1"))
+
+ # Clean up build 1
+ f = open(os.path.join(outputdir, "logfile"), "w+")
+ subprocess.call(["make", "O=%s" % outputdir, "-C", srcdir, "clean"], stdout=f, stderr=f)
+
+ # Start the second build
+ log_write(log, "INFO: Reproducible Build Test, starting build 2")
+ ret = do_build(**kwargs)
+ if ret != 0:
+ log_write(log, "INFO: build 2 failed")
+ return ret
+
+ # Assuming both have built successfully
+ ret = check_reproducibility(**kwargs)
+ return ret
+
def send_results(result, **kwargs):
"""Prepare and store/send tarball with results
--
2.20.1
next prev parent reply other threads:[~2019-06-17 9:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 9:34 [Buildroot] [PATCH v5 1/4] autobuild-run: move creation of result directory to run_instance() Atharva Lele
2019-06-17 9:34 ` [Buildroot] [PATCH v5 2/4] autobuild-run: initial implementation of check_reproducibility() Atharva Lele
2019-06-17 9:34 ` Atharva Lele [this message]
2019-06-17 9:34 ` [Buildroot] [PATCH v5 4/4] autobuild-run: do reproducible builds tests if BR2_REPRODUCIBLE=y Atharva Lele
2019-06-17 18:06 ` [Buildroot] [PATCH v5 1/4] autobuild-run: move creation of result directory to run_instance() Thomas Petazzoni
2019-06-18 7:14 ` Thomas Petazzoni
2019-06-18 7:34 ` Arnout Vandecappelle
2019-06-18 7:45 ` Thomas Petazzoni
2019-06-18 8:25 ` Atharva Lele
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190617093456.6110-3-itsatharva@gmail.com \
--to=itsatharva@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.