From: venkata.pyla@toshiba-tsip.com
To: isar-users@googlegroups.com
Cc: venkata pyla <venkata.pyla@toshiba-tsip.com>,
jan.kiszka@siemens.com, henning.schild@siemens.com,
kazuhiro3.hayashi@toshiba.co.jp, dinesh.kumar@toshiba-tsip.com
Subject: [PATCH] scripts/repro-test.sh: script to test reproducibility of Isar image
Date: Sun, 20 Nov 2022 13:23:36 +0530 [thread overview]
Message-ID: <20221120075336.16006-1-venkata.pyla@toshiba-tsip.com> (raw)
In-Reply-To: <20221110091226.4a3695f2@md1za8fc.ad001.siemens.net>
From: venkata pyla <venkata.pyla@toshiba-tsip.com>
This script helps to identify reproducible problems in isar image, it
uses 'diffoscope'[1] tool to check the difference between two
consecutive builds and copy the differeneces in html format.
[1] https://diffoscope.org/
Signed-off-by: venkata pyla <venkata.pyla@toshiba-tsip.com>
---
scripts/repro-test.sh | 105 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
create mode 100755 scripts/repro-test.sh
diff --git a/scripts/repro-test.sh b/scripts/repro-test.sh
new file mode 100755
index 0000000..0509f32
--- /dev/null
+++ b/scripts/repro-test.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+set -e
+
+DISTRO="debian-bullseye"
+MACHINE="qemuamd64"
+DISTRO_ARCH="amd64"
+IMAGE_TYPE="isar-image-base"
+
+clean(){
+ if [ $? -eq 0 ]; then
+ [ -d $tmpdir ] && sudo rm -rf $tmpdir
+ else
+ echo "Keep build artifacts at $tmpdir"
+ fi
+}
+
+build(){
+ build_id="$1"
+ echo "Build name: $build_id"
+ mkdir "$tmpdir/build"
+
+ cd "$isar_root_dir"
+ . isar-init-build-env "$tmpdir/build" && bitbake mc:${MACHINE}-${DISTRO#*-}:${IMAGE_TYPE}
+
+ mv "$tmpdir/build" "$tmpdir/$build_id"
+}
+
+repro_check(){
+ image1="$tmpdir/$1/tmp/deploy/images/${MACHINE}/${IMAGE_TYPE}-${DISTRO}-${MACHINE}.tar.gz"
+ image2="$tmpdir/$2/tmp/deploy/images/${MACHINE}/${IMAGE_TYPE}-${DISTRO}-${MACHINE}.tar.gz"
+
+ # Compare two build artifacts
+ if diffoscope --html-dir "$tmpdir/diffoscope_html_output" "$image1" "$image2"; then
+ echo "[Success] The build artifacts are reproduicible"
+ else
+ echo "[Fail] The build artifacts are not matching"
+ fi
+}
+
+usage() {
+ echo "This script verifies the reproducibility of the Isar images."
+ echo
+ echo "Usage:"
+ echo " $0 [params]"
+ echo
+ echo "Parameters:"
+ echo " -d, --distro DISTRO set DISTRO variable for the builds (e.g.: debian-buster, debian-bullseye)"
+ echo " -m, --machine MACHINE set MACHINE variable for the builds (e.g.: qemuamd64, qemuarm64, qemuarmhf)"
+ echo " -a, --arch DISTRO_ARCH set DISTRO_ARCH variable for the builds (e.g.: amd64, arm64, armhf)"
+ echo " -h, --help"
+ echo
+}
+
+while [ "$1" != "" ]; do
+ case $1 in
+ -d | --distro )
+ shift
+ DISTRO="$1"
+ ;;
+ -m | --mahcine )
+ shift
+ MACHINE="$1"
+ ;;
+ -a | --arch )
+ shift
+ DISTRO_ARCH="$1"
+ ;;
+ -h | --help )
+ usage
+ exit
+ ;;
+ * )
+ usage
+ exit 1
+ esac
+ shift
+done
+
+if ! command -v diffoscope &> /dev/null
+then
+ echo "diffoscope could not be found"
+ exit
+fi
+
+cd "$(dirname "$0")/.."
+isar_root_dir="$(pwd)"
+
+echo "Distro: $DISTRO"
+echo "MACHINE: $MACHINE"
+echo "DISTRO_ARCH: $DISTRO_ARCH"
+
+# export the variables for the build
+export DISTRO=${DISTRO}
+export MACHINE=${MACHINE}
+export DISTRO_ARCH=${DISTRO_ARCH}
+
+# Temorary directory for keeping build artifacts
+tmpdir=$(mktemp --directory --tmpdir /home/seshu/temp/isar.repro.test.XXXXXXXXXX)
+trap clean INT TERM EXIT
+
+build build1
+build build2
+
+repro_check build1 build2
--
2.20.1
next prev parent reply other threads:[~2022-11-20 7:50 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-07 8:25 [PATCH] image.bbclass: set file timestamps inside the rootfs and initramfs image venkata.pyla
2022-11-07 8:50 ` Moessbauer, Felix
2022-11-09 6:56 ` Venkata.Pyla
2022-11-07 8:53 ` Henning Schild
2022-11-09 9:27 ` Venkata.Pyla
2022-11-10 7:12 ` Henning Schild
2022-11-20 7:53 ` venkata.pyla [this message]
2022-11-22 7:28 ` [PATCH] scripts/repro-test.sh: script to test reproducibility of Isar image Anton Mikanovich
2022-11-22 8:49 ` Venkata.Pyla
2022-12-19 14:41 ` [PATCH 0/2] Test for verifiying reproducible images venkata.pyla
2022-12-28 8:40 ` Anton Mikanovich
2023-01-02 6:24 ` [PATCH] repro-build-test.py: Fix date_epoch time contains byte character b'' venkata.pyla
2023-01-11 5:42 ` Uladzimir Bely
2022-12-19 14:41 ` [PATCH 1/2] cibuilder.py: Add source_date_epoch to build configuration venkata.pyla
2022-12-19 14:41 ` [PATCH 2/2] repro-build-test.py: Test to check images are reproducible venkata.pyla
2023-01-07 0:01 ` Henning Schild
2022-11-21 5:16 ` [PATCH] image.bbclass: set file timestamps inside the rootfs and initramfs image Venkata.Pyla
2022-11-10 9:52 ` Balasubramanian Sundaram
2022-11-10 10:03 ` Anton Mikanovich
2022-11-10 10:17 ` Balasubramanian Sundaram
2022-11-10 10:19 ` Balasubramanian Sundaram
2022-11-10 10:27 ` Anton Mikanovich
2022-11-10 10:51 ` Balasubramanian Sundaram
2022-11-10 16:30 ` Henning Schild
2022-11-10 17:05 ` Henning Schild
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=20221120075336.16006-1-venkata.pyla@toshiba-tsip.com \
--to=venkata.pyla@toshiba-tsip.com \
--cc=dinesh.kumar@toshiba-tsip.com \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=kazuhiro3.hayashi@toshiba.co.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox