aboutsummaryrefslogtreecommitdiff
path: root/utils/br-reproduce-build
diff options
context:
space:
mode:
authorGravatar Atharva Lele <itsatharva@gmail.com>2019-08-25 23:06:35 +0530
committerGravatar Thomas Petazzoni <thomas.petazzoni@bootlin.com>2019-12-26 21:57:23 +0100
commitb2ae6556af6cad8ecf01c64c5cb40cf7b64c2814 (patch)
treea7575788704c3a793d0efb038550115b6750237c /utils/br-reproduce-build
parent2e780031fcd27fe6b583fb0d3d2dc4fed4ac4784 (diff)
downloadbuildroot-test-b2ae6556af6cad8ecf01c64c5cb40cf7b64c2814.tar.gz
buildroot-test-b2ae6556af6cad8ecf01c64c5cb40cf7b64c2814.tar.bz2
utils/br-reproduce-build: handle reproducibility failures
Add a condition to check if the config has BR2_REPRODUCIBLE enabled and if it does, run the build in two output directories - output-1, output-2 - and then run diffoscope on the generated images. NOTE: You should have diffoscope installed in order to test reproducibility failures. Signed-off-by: Atharva Lele <itsatharva@gmail.com> [Thomas: - Do an olddefconfig on each configuration, like is done in the non-reproducible case - Store the logs into separate log files - Exit if the build has failed instead of continuing with the call to diffoscope] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'utils/br-reproduce-build')
-rwxr-xr-xutils/br-reproduce-build28
1 files changed, 24 insertions, 4 deletions
diff --git a/utils/br-reproduce-build b/utils/br-reproduce-build
index 592edc2..7073d7b 100755
--- a/utils/br-reproduce-build
+++ b/utils/br-reproduce-build
@@ -76,7 +76,27 @@ if [ $? -ne 0 ] ; then
exit 1
fi
-mkdir ../output
-cp "${BUILD_DIR}/config" ../output/.config
-make olddefconfig O=../output/
-make 2>&1 O=../output | tee logfile
+# Handle cases of testing reproducibility failures.
+# Run the build in different output directories if BR2_REPRODUCIBLE=y
+# and run diffoscope on the generated images. Output of diffoscope is
+# saved in the "output-1" directory.
+# NOTE: You should have diffoscope installed in order to test
+# reproducibility failures.
+if grep -Fxq "BR2_REPRODUCIBLE=y" "${BUILD_DIR}/config"; then
+ mkdir ../output-1 ../output-2
+ cp "${BUILD_DIR}/config" ../output-1/.config
+ cp "${BUILD_DIR}/config" ../output-2/.config
+ make olddefconfig O=../output-1
+ make olddefconfig O=../output-2
+ make 2>&1 O=../output-1 | tee logfile-1 && make 2>&1 O=../output-2 | tee logfile-2
+ if test $? -ne 0 ; then exit 1 ; fi
+ PREFIX=$(make --no-print-directory O=../output-1 printvars VARS=TARGET_CROSS | cut -c 14- | head -c -1)
+ IMAGE_1="../output-1/images/rootfs.tar"
+ IMAGE_2="../output-2/images/rootfs.tar"
+ diffoscope ${IMAGE_1} ${IMAGE_2} --tool-prefix-binutils ${PREFIX} --text ../output-1/diffoscope_results.txt
+else
+ mkdir ../output
+ cp "${BUILD_DIR}/config" ../output/.config
+ make olddefconfig O=../output/
+ make 2>&1 O=../output | tee logfile
+fi