[Reproducible-commits] [reprotest] 02/04: Clean up mock_build.py
Ceridwen
ceridwen-guest at moszumanska.debian.org
Wed Jul 13 21:26:38 UTC 2016
This is an automated email from the git hooks/post-receive script.
ceridwen-guest pushed a commit to branch virtualization
in repository reprotest.
commit 3a1a9d76020af9fede79f9aeef7bdb19e509c848
Author: Ceridwen <ceridwenv at gmail.com>
Date: Tue Jul 12 15:27:29 2016 -0400
Clean up mock_build.py
---
tests/mock_build.py | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/tests/mock_build.py b/tests/mock_build.py
index 8c11f28..5b43a1e 100755
--- a/tests/mock_build.py
+++ b/tests/mock_build.py
@@ -7,7 +7,6 @@ import os
import pathlib
import stat
import subprocess
-# import tarfile
import tempfile
import time
@@ -16,18 +15,18 @@ if __name__ == '__main__':
arg_parser = argparse.ArgumentParser(
description='Create binaries for testing reproducibility.',
formatter_class=argparse.RawDescriptionHelpFormatter)
- arg_parser.add_argument('commands', nargs='*',
+ arg_parser.add_argument('variations', nargs='*',
help='Reproducibility properties.')
- args = set(arg_parser.parse_args().commands)
+ variations = set(arg_parser.parse_args().variations)
output = [b'']
# This test can theoretically fail by producing the same
# random bits in both runs, but it is extremely unlikely.
- if 'irreproducible' in args:
+ if 'irreproducible' in variations:
output.append(os.urandom(1024))
# Like the above test, this test can theoretically fail by
# producing the same file order, but this is unlikely, if not
# as unlikely as in the above test.
- if 'fileordering' in args:
+ if 'fileordering' in variations:
# Ensure this temporary directory is created in the disorders
# mount point by passing the dir argument.
with tempfile.TemporaryDirectory(dir=str(pathlib.Path.cwd())) as temp:
@@ -35,17 +34,17 @@ if __name__ == '__main__':
for i in range(20):
str((test_file_order/str(i)).touch())
output.extend(p.name.encode('ascii') for p in test_file_order.iterdir())
- if 'home' in args:
+ if 'home' in variations:
output.append(os.path.expanduser('~').encode('ascii'))
- if 'kernel' in args:
+ if 'kernel' in variations:
output.append(subprocess.check_output(['uname', '-r']))
- if 'locales' in args:
+ if 'locales' in variations:
output.extend(l.encode('ascii') for l in locale.getlocale())
- if 'path' in args:
+ if 'path' in variations:
output.extend(p.encode('ascii') for p in os.get_exec_path())
- if 'timezone' in args:
+ if 'timezone' in variations:
output.append(str(time.timezone).encode('ascii'))
- if 'umask' in args:
+ if 'umask' in variations:
with tempfile.TemporaryDirectory(dir=str(pathlib.Path.cwd())) as temp:
test_permissions = pathlib.Path(temp)/'test_permissions'
test_permissions.touch()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reprotest.git
More information about the Reproducible-commits
mailing list