From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7024486976540639232 X-Received: by 2002:a05:6402:270b:: with SMTP id y11mr40568616edd.116.1635761391706; Mon, 01 Nov 2021 03:09:51 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:aa7:cc15:: with SMTP id q21ls6970834edt.0.gmail; Mon, 01 Nov 2021 03:09:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzadJoiHPkBcQGFZupaEPz9FF+ZG1jSBSVU/ddpcCpBdNbBektaiq4vC+3HM819+oduM9Yn X-Received: by 2002:a05:6402:31eb:: with SMTP id dy11mr10681413edb.20.1635761390626; Mon, 01 Nov 2021 03:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635761390; cv=none; d=google.com; s=arc-20160816; b=V6eUtGqGYyGPaJ0tOvFUsqSji4Re7T4s8W8sj27aazWE5N5TQQ7Su1co78J6tsdN+X zy6tdRAUhsQxCN7Y6yQw1Z92BNCC9zs8CrxGWJjulnWBLKFthveA0wSJ36Y192WxteCb S9RBYNVF/MT0yHIXO97a/37DJ8SSm/c/lp7qzq+63gvgQ1HlR4twnffv5Ccvc8VT/sB3 YBn4TRe/BMh3CpzRMAf5Yg49JgUi9DREZOWKjw7TQL19WxqAc8+8KI+VvLQ6UbqxEc1r FNFV0VLj1FcdZsFTq4hcavQrsFO/2PFe3YAo+XbgXKuvXcZRk8XhxqFPLBvmA+W3L1cj q0ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=WmW/7wBeUv5/6hVwiAQ29uL0dM7k5ghScteVpTM6/1U=; b=HilaCkjWyTKFH7g987FVeAtkaRsAlLTnnRdA4uJAfcHUngOvhh5MojMN+JJuFu9CSX M3hgimT6QpaidQK99DhgCFtsYL2Af964jjcZtapb1kvjKFipZ7yzydUSE/SAOpJGcHg5 3Fa3yXj+//t4dawlbnsKwQrRihy9XTSMzZ1VDa8u+MD6EGQWRgqetAPnTzJqNAAHuDIJ 1j/4m8s6FuZvEuP/Q8NkeymtYLjrLhLcj9E62MXLqomV7Gypz0Y4yKKkUxrE7FG+0wEi oF2sGSCOv4RL/hKfs4EYbscfZOV+85OMFbLQst0XiEsEt6yL6eEoKBJVilldjCiSzqrC ZkHQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Return-Path: Received: from shymkent.ilbers.de (shymkent.ilbers.de. [85.214.156.166]) by gmr-mx.google.com with ESMTPS id cc18si938425edb.2.2021.11.01.03.09.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 01 Nov 2021 03:09:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) client-ip=85.214.156.166; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of ubely@ilbers.de designates 85.214.156.166 as permitted sender) smtp.mailfrom=ubely@ilbers.de Received: from baighyz.m.ilbers.de (host-80-81-17-52.static.customer.m-online.net [80.81.17.52]) (authenticated bits=0) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8) with ESMTPSA id 1A1A9fgM004135 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 1 Nov 2021 11:09:48 +0100 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v4 3/3] ci: Add test for ccache Date: Mon, 1 Nov 2021 11:09:41 +0100 Message-Id: <20211101100941.23823-4-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211101100941.23823-1-ubely@ilbers.de> References: <20211101100941.23823-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: 20L38pk9uVs/ The test runs bitbake target twice. First run with ccache enabled makes CCACHE_DIR be populated and the second run reuses it to speedup build process. Signed-off-by: Uladzimir Bely --- testsuite/build_test/build_test.py | 11 ++++++++++ testsuite/build_test/cibase.py | 33 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/testsuite/build_test/build_test.py b/testsuite/build_test/build_test.py index d39c10c0..ce84b5e2 100644 --- a/testsuite/build_test/build_test.py +++ b/testsuite/build_test/build_test.py @@ -40,6 +40,17 @@ class ReproTest(CIBaseTest): self.perform_repro_test(targets, 0) +class CcacheTest(CIBaseTest): + + """ + Test rebuild speed improve with ccache + + :avocado: tags=ccache + """ + def test_ccache_rebuild(self): + targets = ['mc:de0-nano-soc-buster:isar-image-base'] + self.perform_ccache_test(targets) + class CrossTest(CIBaseTest): """ diff --git a/testsuite/build_test/cibase.py b/testsuite/build_test/cibase.py index 78d7bdb7..0b053aa5 100644 --- a/testsuite/build_test/cibase.py +++ b/testsuite/build_test/cibase.py @@ -3,6 +3,7 @@ import os import re import tempfile +import time from cibuilder import CIBuilder from avocado.utils import process @@ -114,3 +115,35 @@ class CIBaseTest(CIBuilder): self.bitbake(build_dir, targets, bitbake_cmd, bb_args) + + def perform_ccache_test(self, targets): + build_dir, bb_args = self.prep('Isar ccache build', targets, 0, 0) + + self.deletetmp(build_dir) + process.run('rm -rf ' + build_dir + '/ccache', sudo=True) + + with open(build_dir + '/conf/ci_build.conf', 'a') as file: + file.write('USE_CCACHE = "1"\n') + file.write('CCACHE_TOP_DIR = "${TOPDIR}/ccache"') + + self.log.info('Starting build and filling ccache dir...') + start = time.time() + self.bitbake(build_dir, targets, None, bb_args) + first_time = time.time() - start + self.log.info('Non-cached build: ' + str(round(first_time)) + 's') + + self.deletetmp(build_dir) + + self.log.info('Starting build and using ccache dir...') + start = time.time() + self.bitbake(build_dir, targets, None, bb_args) + second_time = time.time() - start + self.log.info('Cached build: ' + str(round(second_time)) + 's') + + speedup_k = 1.1 + if first_time / second_time < speedup_k: + self.fail('No speedup after rebuild with ccache') + + # Cleanup + self.deletetmp(build_dir) + process.run('rm -rf ' + build_dir + '/ccache', sudo=True) -- 2.20.1