From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7024486976540639232 X-Received: by 2002:a05:6512:3089:: with SMTP id z9mr3578045lfd.386.1635515831375; Fri, 29 Oct 2021 06:57:11 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:651c:a0f:: with SMTP id k15ls1268312ljq.5.gmail; Fri, 29 Oct 2021 06:57:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziwgB9bnx0OLUQSMIBb6N4jL/Ug3dmqpuosyMlIuJ/wvwQ+VBr7Lsm4ijY3xXmDWBVpM7h X-Received: by 2002:a05:651c:20c:: with SMTP id y12mr12186091ljn.68.1635515830214; Fri, 29 Oct 2021 06:57:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635515830; cv=none; d=google.com; s=arc-20160816; b=fzHP7usAlVTP5hAJjLgSRf5GZg8mxTeyon3gnRpkec5ODEYgJShA1jA3o18nEL4wzc MpMKH/vxyB9oKpA39WFZOoIKVPMgPIf++nFRjOw5xKNH8VhsdKQwuwhVw1RTGowirZiH KFRkuKxK4s1DwiAU5RVzv5nFp7HXhnDTnhwySU+b67nIA3ORPsGMUW2ypzRJphKx8B+n IRbvHZPV2DGq3oCyf82mHrBGUJQR+kj7mjuMNVq4yE6swPloatLOZf9j9nSUb7opH6q5 TcdkXaLXCkfhcU/hqxWWv4J7Uh8UHEpkTzT2YI49w+17kW8n9TYFMyQTk76PvEJk3Wde KxOQ== 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=FnktKBVYzvKzeZk8evPOEKzIFFL+Nj9JJb2JatNsksA=; b=ar2TuFaUQBduGOpkr33LJ7rpDEE9uo07tBmuP1MNzXPYIpT/4UgaadBum67L5nsX2H 2ugsksV0A8m6QwfrOJ/bU6WSze4mCdr9m0QQN8V29EEG5lWLjCPpF5YldpCO+p2jJc9C uuebfVsco0D8pWd5r6NHos9XRx90ikshPzG21f2g5sPsgxQDXqQvZ9IwiqMmrBC/y/7i wnM9sXaXDdIMR7EIjYySxjxSiwXDOCFVvuLzkSGFXmYQcSUay31bd9YXhxkrf4dEsMzW 9cMUTClaIgg41LOFdbPUykRoVSgoQnQ5wpKz9FKT4gLoRvyyhfPAY4BSmaqHOSUOH4DY J2qA== 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 e11si324243lji.5.2021.10.29.06.57.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Oct 2021 06:57:10 -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 19TDv0m6022514 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 29 Oct 2021 15:57:07 +0200 From: Uladzimir Bely To: isar-users@googlegroups.com Subject: [PATCH v3 3/3] ci: Add test for ccache Date: Fri, 29 Oct 2021 15:57:00 +0200 Message-Id: <20211029135700.27885-4-ubely@ilbers.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211029135700.27885-1-ubely@ilbers.de> References: <20211029135700.27885-1-ubely@ilbers.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: rm2acU/aKw47 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..05db4b78 100644 --- a/testsuite/build_test/build_test.py +++ b/testsuite/build_test/build_test.py @@ -206,3 +206,14 @@ class ContainerSdkTest(CIBaseTest): targets = ['mc:container-amd64-stretch:isar-image-base'] self.perform_container_test(targets, 'do_populate_sdk') + +class CcacheTest(CIBaseTest): + + """ + Test rebuild speed improve with ccache + + :avocado: tags=ccache,full + """ + def test_ccache_rebuild(self): + targets = ['mc:de0-nano-soc-buster:isar-image-base'] + self.perform_ccache_test(targets) 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