From patchwork Tue May 23 13:56:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Pyla X-Patchwork-Id: 13252333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43154C77B75 for ; Tue, 23 May 2023 13:56:20 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.153]) by mx.groups.io with SMTP id smtpd.web11.23353.1684850177380798518 for ; Tue, 23 May 2023 06:56:17 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.153, mailfrom: venkata.pyla@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1514) id 34NDuFhH004492; Tue, 23 May 2023 22:56:16 +0900 X-Iguazu-Qid: 34tr9ZSP7F8z6rNERc X-Iguazu-QSIG: v=2; s=0; t=1684850175; q=34tr9ZSP7F8z6rNERc; m=LcXM35kwCPOj8Yb+KQdosTv00R8tiD+ELknSsZ3u+hg= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1513) id 34NDuEgC003263 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 23 May 2023 22:56:15 +0900 From: venkata.pyla@toshiba-tsip.com To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: venkata pyla , dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core 1/2] scripts: Add script to test different artifacts in the image are bit identical Date: Tue, 23 May 2023 19:26:10 +0530 X-TSB-HOP2: ON Message-Id: <20230523135611.31234-2-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230523135611.31234-1-venkata.pyla@toshiba-tsip.com> References: <20230523135611.31234-1-venkata.pyla@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 23 May 2023 13:56:12.0763 (UTC) FILETIME=[55B792B0:01D98D7E] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 23 May 2023 13:56:20 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/11614 From: venkata pyla This script helps to check the reproducibility of different artifacts in the target build like vmlinuz, initrd, rootfs, squashfs, ext4, swu files. It uses diffoscope tool to check the artifacts are bit by bit identical. Signed-off-by: venkata pyla --- scripts/repro-tests.sh | 91 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 scripts/repro-tests.sh diff --git a/scripts/repro-tests.sh b/scripts/repro-tests.sh new file mode 100755 index 0000000..f767839 --- /dev/null +++ b/scripts/repro-tests.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# +# CIP Core, generic profile +# +# Copyright (c) Toshiba corp., 2023 +# +# Authors: +# Venkata Pyla +# +# SPDX-License-Identifier: MIT +# + +set -e + +usage() +{ + echo "usage: repro-tests.sh [--release RELEASE] [--target TARGET] artfacts1 artifacts2" + echo "" + echo " Optional arguments:" + echo " --release RELEASE: debian distro rleases e.g. buster, bullseye, etc. (default: buster)" + echo " --target TARGET: e.g. qemu-amd64, qemu-arm64, qemu-arm (default: qemu-amd64)" + echo "" + echo " Mandatory aguments:" + echo " artifcats1 and artifacts2 paths to test the artifacts reproducibility" + echo "" +} + +RED='\033[0;31m' +NC='\033[0m' +GREEN='\033[0;32m' +IMAGE_BASE="cip-core-image-cip-core" +RELEASE="bullseye" +TARGET="qemu-amd64" +DIFFOSCOPE="diffoscope" + +while [ "$1" != "" ]; do + case $1 in + -r | --release ) + RELEASE="$2" + shift 2 + ;; + -t | --target ) + TARGET="$2" + shift 2 + ;; + -h | --help ) + usage + exit + ;; + * ) + remaining_vars="$remaining_vars $1" + shift + ;; + esac +done + +set -- $remaining_vars +artifacts1="$1" +artifacts2="$2" +if [ -z "$artifacts1" ] || [ -z "$artifacts2" ]; then + echo "artifact folders are missing" + usage + exit 1 +fi + +# Define files in the artifacts for checking the reproducibility +set -- \ + "${IMAGE_BASE}-${RELEASE}-${TARGET}-vmlinuz" \ + "${IMAGE_BASE}-${RELEASE}-${TARGET}-vmlinux" \ + "${IMAGE_BASE}-${RELEASE}-${TARGET}-initrd.img" \ + "${IMAGE_BASE}-${RELEASE}-${TARGET}.tar.gz" \ + "linux.efi" \ + "${IMAGE_BASE}-${RELEASE}-${TARGET}.swu" \ + "${IMAGE_BASE}-${RELEASE}-${TARGET}.squashfs" \ + +# compare artifacts +res=0 +for file in "$@"; do + if [ -f "${artifacts1}/${file}" ] && [ -f "${artifacts1}/${file}" ]; then + if $DIFFOSCOPE --text "${file}.diffoscope_output.txt" \ + "${artifacts1}/${file}" \ + "${artifacts2}/${file}" > /dev/null 2>&1; then + echo "${file}: ${GREEN}Reproducible${NC}" | tee -a diffoscope_output.txt + else + echo "${file}: ${RED}Not-Reproducible${NC}" | tee -a diffoscope_output.txt + res=1 + fi + fi +done + +exit $res \ No newline at end of file From patchwork Tue May 23 13:56:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Pyla X-Patchwork-Id: 13252331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 416D3C7EE23 for ; Tue, 23 May 2023 13:56:20 +0000 (UTC) Received: from mo-csw.securemx.jp (mo-csw.securemx.jp [210.130.202.155]) by mx.groups.io with SMTP id smtpd.web10.23571.1684850178288749113 for ; Tue, 23 May 2023 06:56:19 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: toshiba-tsip.com, ip: 210.130.202.155, mailfrom: venkata.pyla@toshiba-tsip.com) Received: by mo-csw.securemx.jp (mx-mo-csw1516) id 34NDuGra007920; Tue, 23 May 2023 22:56:17 +0900 X-Iguazu-Qid: 34trKxHUsXucBThUSg X-Iguazu-QSIG: v=2; s=0; t=1684850175; q=34trKxHUsXucBThUSg; m=g9IhUKfNEusqJcZwV4V1i1tvbjSZbuJDgT7FQF2ikXU= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1512) id 34NDuFnb038648 (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 23 May 2023 22:56:15 +0900 From: venkata.pyla@toshiba-tsip.com To: cip-dev@lists.cip-project.org, jan.kiszka@siemens.com Cc: venkata pyla , dinesh.kumar@toshiba-tsip.com, kazuhiro3.hayashi@toshiba.co.jp Subject: [isar-cip-core 2/2] .reproducible-check-ci.yml: use repro-tests.sh in the CI check Date: Tue, 23 May 2023 19:26:11 +0530 X-TSB-HOP2: ON Message-Id: <20230523135611.31234-3-venkata.pyla@toshiba-tsip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230523135611.31234-1-venkata.pyla@toshiba-tsip.com> References: <20230523135611.31234-1-venkata.pyla@toshiba-tsip.com> MIME-Version: 1.0 X-OriginalArrivalTime: 23 May 2023 13:56:12.0841 (UTC) FILETIME=[55C37990:01D98D7E] List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 23 May 2023 13:56:20 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/11616 From: venkata pyla The repro-test in CI helps to check all different artifacts produced by the target build and gives the report. Signed-off-by: venkata pyla --- .reproducible-check-ci.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.reproducible-check-ci.yml b/.reproducible-check-ci.yml index d42359c..d8bfb40 100644 --- a/.reproducible-check-ci.yml +++ b/.reproducible-check-ci.yml @@ -28,16 +28,17 @@ - if [ -f kas/opt/reproducible.yml ]; then base_yaml="${base_yaml}:kas/opt/reproducible.yml"; fi # Build 1st time - !reference [.build_base, script] - - mv build/tmp/deploy/images/${target}/cip-core-image-cip-core-${release}-${target}${artifact_suffix} image1 + - mv build/tmp/deploy/images/${target} image1 # clean - sudo rm -rf build/tmp - sudo rm -rf build/sstate-cache # Build 2nd time - !reference [.build_base, script] - - mv build/tmp/deploy/images/${target}/cip-core-image-cip-core-${release}-${target}${artifact_suffix} image2 + - mv build/tmp/deploy/images/${target} image2 artifacts: expire_in: 1 day paths: + - scripts/repro-tests.sh - image1 - image2 @@ -54,12 +55,12 @@ before_script: - apt update && DEBIAN_FRONTEND=noninteractive apt install -y diffoscope script: - - diffoscope --text diffoscope_output.txt image1 image2 + - ./scripts/repro-tests.sh --release ${release} --target ${target} image1 image2 artifacts: when: always expire_in: 1 day paths: - - diffoscope_output.txt + - "./*diffoscope_output.txt" # repro build @@ -85,17 +86,23 @@ build:qemu-arm-base-repro-build: test:qemu-amd64-base-repro-test: extends: - .repro-test + variables: + target: qemu-amd64 dependencies: - build:qemu-amd64-base-repro-build test:qemu-arm64-base-repro-test: extends: - .repro-test + variables: + target: qemu-arm64 dependencies: - build:qemu-arm64-base-repro-build test:qemu-arm-base-repro-test: extends: - .repro-test + variables: + target: qemu-arm dependencies: - build:qemu-arm-base-repro-build