public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] CI: Add sstate-cache testcase
@ 2021-10-28 15:20 Anton Mikanovich
  2021-10-28 15:34 ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: Anton Mikanovich @ 2021-10-28 15:20 UTC (permalink / raw)
  To: isar-users; +Cc: Anton Mikanovich

Test rebuild time improve after cleanup to be sure sstate-cache works.

Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
 testsuite/build_test/build_test.py | 40 ++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/testsuite/build_test/build_test.py b/testsuite/build_test/build_test.py
index d39c10c0..244f6fc0 100644
--- a/testsuite/build_test/build_test.py
+++ b/testsuite/build_test/build_test.py
@@ -1,9 +1,9 @@
 #!/usr/bin/env python3
 
-import os
+import os, time
 
 from avocado import skipUnless
-from avocado.utils import path
+from avocado.utils import path, process
 from cibase import CIBaseTest
 
 UMOCI_AVAILABLE = True
@@ -206,3 +206,39 @@ class ContainerSdkTest(CIBaseTest):
         targets = ['mc:container-amd64-stretch:isar-image-base']
 
         self.perform_container_test(targets, 'do_populate_sdk')
+
+class SstateTest(CIBaseTest):
+
+    """
+    Test rebuild speed improve with sstate-cache
+
+    :avocado: tags=sstate
+    """
+    def test_sstate_rebuild(self):
+        speedup_k = 2.0
+
+        targets = [
+            'mc:qemuamd64-bullseye:isar-image-base'
+                  ]
+
+        # Cleanup everything before build
+        build_dir = self.params.get('build_dir',
+                    default=os.path.dirname(__file__) + '/../../build')
+        process.run('rm -rf ' + build_dir + '/sstate-cache', sudo=True)
+        self.deletetmp(build_dir)
+
+        start = time.time()
+        self.perform_build_test(targets, 1, None)
+        first_time = time.time() - start
+        self.log.info('Non-cached build:' + str(round(first_time, 2)))
+
+        # Cleanup everything but cache files
+        self.deletetmp(build_dir)
+
+        start = time.time()
+        self.perform_build_test(targets, 1, None)
+        second_time = time.time() - start
+        self.log.info('Cached build:' + str(round(second_time, 2)))
+
+        if first_time / second_time < speedup_k:
+            self.fail('No speedup after rebuild with sstate-cache')
-- 
2.20.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-02  7:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 15:20 [PATCH] CI: Add sstate-cache testcase Anton Mikanovich
2021-10-28 15:34 ` Jan Kiszka
2021-10-28 17:22   ` Anton Mikanovich
2021-10-28 18:21     ` Henning Schild
2021-11-02  5:57       ` Schmidt, Adriaan
2021-11-02  7:55         ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox