Re: [yocto][PATCH] lib/oeqa/selftest/cases/reproducible.py : updated test to faketime in future when buiding the second test build.

2021-02-26 Thread Alexander Kanavin
Wait, this needs to be explained a bit better. What reproducibility issues
does this address that the existing test does not?

Alex

On Fri, 26 Feb 2021 at 15:27, Sangeeta Jain  wrote:

>
> This update will ensure that recipes are not including time stamps by
> creating an image with modified system
>
>  time. It uses libfaketime recipe to fake system time to advance by
> 34308122 seconds.
>
> Signed-off-by: sangeeta jain 
> ---
>  meta/lib/oeqa/selftest/cases/reproducible.py | 19 ---
>  1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py
> b/meta/lib/oeqa/selftest/cases/reproducible.py
> index 8849c95..831a304 100644
> --- a/meta/lib/oeqa/selftest/cases/reproducible.py
> +++ b/meta/lib/oeqa/selftest/cases/reproducible.py
> @@ -180,6 +180,7 @@ class ReproducibleTests(OESelftestTestCase):
>  # will test that and also make the test run faster. If your sstate is
> not
>  # reproducible, disable this in your derived test class
>  build_from_sstate = True
> +use_faketime = False
>
>  def setUpLocal(self):
>  super().setUpLocal()
> @@ -227,7 +228,7 @@ class ReproducibleTests(OESelftestTestCase):
>  bb.utils.mkdirhier(os.path.dirname(dest))
>  shutil.copyfile(source, dest)
>
> -def do_test_build(self, name, use_sstate):
> +def do_test_build(self, name, use_sstate, use_faketime):
>  capture_vars = ['DEPLOY_DIR_' + c.upper() for c in
> self.package_classes]
>
>  tmpdir = os.path.join(self.topdir, name, 'tmp') @@ -256,6 +257,18
> @@ class ReproducibleTests(OESelftestTestCase):
>  SSTATE_MIRRORS = ""
>  ''')
>
> +if use_faketime:  ##sangeeta
> +# This config fragment will enable to fake system time
> +# advance by 34308122 sec
> +bitbake("libfaketime")
> +find_binary = "find . -path '*/image/*/libfaketime.so.1"
> +full_path_to_binary = runCmd(find_binary)
> +binary_path = full_path_to_binary.split("./")
> +ld_preload_path = os.path.join(os.environ.get('BUILDDIR'),
> binary_path[1])
> +seconds_add_to_system_time = "+34308122"
> +cmd = 'LD_PRELOAD=%s FAKETIME=%s' %(ld_preload_path,
> seconds_add_to_system_time)
> +runCmd(cmd)
> +
>  self.logger.info("Building %s (sstate%s allowed)..." % (name, ''
> if use_sstate else ' NOT'))
>  self.write_config(config)
>  d = get_bb_vars(capture_vars)
> @@ -282,9 +295,9 @@ class ReproducibleTests(OESelftestTestCase):
>  os.chmod(save_dir, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP
> | stat.S_IROTH | stat.S_IXOTH)
>  self.logger.info('Non-reproducible packages will be copied
> to %s', save_dir)
>
> -vars_A = self.do_test_build('reproducibleA',
> self.build_from_sstate)
> +vars_A = self.do_test_build('reproducibleA',
> + self.build_from_sstate, self.use_faketime))
>
> -vars_B = self.do_test_build('reproducibleB', False)
> +vars_B = self.do_test_build('reproducibleB', False, True)
>
>  # NOTE: The temp directories from the reproducible build are
> purposely
>  # kept after the build so it can be diffed for debugging.
> --
> 2.7.4
>
>
> 
>
>

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#52491): https://lists.yoctoproject.org/g/yocto/message/52491
Mute This Topic: https://lists.yoctoproject.org/mt/80928011/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[yocto][PATCH] lib/oeqa/selftest/cases/reproducible.py : updated test to faketime in future when buiding the second test build.

2021-02-26 Thread Sangeeta Jain

This update will ensure that recipes are not including time stamps by creating 
an image with modified system

 time. It uses libfaketime recipe to fake system time to advance by 34308122 
seconds.

Signed-off-by: sangeeta jain 
---
 meta/lib/oeqa/selftest/cases/reproducible.py | 19 ---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py 
b/meta/lib/oeqa/selftest/cases/reproducible.py
index 8849c95..831a304 100644
--- a/meta/lib/oeqa/selftest/cases/reproducible.py
+++ b/meta/lib/oeqa/selftest/cases/reproducible.py
@@ -180,6 +180,7 @@ class ReproducibleTests(OESelftestTestCase):
 # will test that and also make the test run faster. If your sstate is not
 # reproducible, disable this in your derived test class
 build_from_sstate = True
+use_faketime = False
 
 def setUpLocal(self):
 super().setUpLocal()
@@ -227,7 +228,7 @@ class ReproducibleTests(OESelftestTestCase):
 bb.utils.mkdirhier(os.path.dirname(dest))
 shutil.copyfile(source, dest)
 
-def do_test_build(self, name, use_sstate):
+def do_test_build(self, name, use_sstate, use_faketime):
 capture_vars = ['DEPLOY_DIR_' + c.upper() for c in 
self.package_classes]
 
 tmpdir = os.path.join(self.topdir, name, 'tmp') @@ -256,6 +257,18 @@ 
class ReproducibleTests(OESelftestTestCase):
 SSTATE_MIRRORS = ""
 ''')
 
+if use_faketime:  ##sangeeta
+# This config fragment will enable to fake system time
+# advance by 34308122 sec
+bitbake("libfaketime")
+find_binary = "find . -path '*/image/*/libfaketime.so.1"
+full_path_to_binary = runCmd(find_binary)
+binary_path = full_path_to_binary.split("./")
+ld_preload_path = os.path.join(os.environ.get('BUILDDIR'), 
binary_path[1])
+seconds_add_to_system_time = "+34308122"
+cmd = 'LD_PRELOAD=%s FAKETIME=%s' %(ld_preload_path, 
seconds_add_to_system_time)
+runCmd(cmd)
+
 self.logger.info("Building %s (sstate%s allowed)..." % (name, '' if 
use_sstate else ' NOT'))
 self.write_config(config)
 d = get_bb_vars(capture_vars)
@@ -282,9 +295,9 @@ class ReproducibleTests(OESelftestTestCase):
 os.chmod(save_dir, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | 
stat.S_IROTH | stat.S_IXOTH)
 self.logger.info('Non-reproducible packages will be copied to %s', 
save_dir)
 
-vars_A = self.do_test_build('reproducibleA', self.build_from_sstate)
+vars_A = self.do_test_build('reproducibleA', 
+ self.build_from_sstate, self.use_faketime))
 
-vars_B = self.do_test_build('reproducibleB', False)
+vars_B = self.do_test_build('reproducibleB', False, True)
 
 # NOTE: The temp directories from the reproducible build are purposely
 # kept after the build so it can be diffed for debugging.
--
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#52490): https://lists.yoctoproject.org/g/yocto/message/52490
Mute This Topic: https://lists.yoctoproject.org/mt/80928011/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-