[reprotest] 04/04: ENH: reprotest: Add support for a host toolchain

Ximin Luo infinity0 at debian.org
Thu Aug 17 18:05:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository reprotest.

commit 80d39fd23532919a8c4babb70958be16865a42f3
Author: Santiago Torres <torresariass at gmail.com>
Date:   Wed Jul 12 11:57:12 2017 -0400

    ENH: reprotest: Add support for a host toolchain
    
    Reprotest wasn't aware of the host toolchain settings for the
    adt_testbed module. Add a command-line argument and propagate it to
    start_testbed so users can choose a specific toolchain for their
    distribution. Ideally, in the future, this host-toolchain could be
    guessed on runtime.
---
 reprotest/__init__.py | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index b4dc300..45dd553 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -54,14 +54,15 @@ def get_all_servers():
 # approaches.
 
 @_contextlib.contextmanager
-def start_testbed(args, temp_dir, no_clean_on_error=False):
+def start_testbed(args, temp_dir, no_clean_on_error=False, host_distro='debian'):
     '''This is a simple wrapper around adt_testbed that automates the
     initialization and cleanup.'''
     # Find the location of reprotest using setuptools and then get the
     # path for the correct virt-server script.
     server_path = get_server_path(args[0])
     logging.info('STARTING VIRTUAL SERVER %r', [server_path] + args[1:])
-    testbed = adt_testbed.Testbed([server_path] + args[1:], temp_dir, None)
+    testbed = adt_testbed.Testbed([server_path] + args[1:], temp_dir, None,
+            host_distro=host_distro)
     testbed.start()
     testbed.open()
     should_clean = True
@@ -404,7 +405,7 @@ def run_or_tee(progargs, filename, store_dir, *args, **kwargs):
 def check(build_command, artifact_pattern, virtual_server_args, source_root,
           no_clean_on_error=False, variations=VARIATIONS,
           store_dir=None, diffoscope_args=[],
-          testbed_pre=None, testbed_init=None):
+          testbed_pre=None, testbed_init=None, host_distro='debian'):
     # default argument [] is safe here because we never mutate it.
     if not source_root:
         raise ValueError("invalid source root: %s" % source_root)
@@ -436,7 +437,8 @@ def check(build_command, artifact_pattern, virtual_server_args, source_root,
 
         # TODO: an alternative strategy is to run the testbed twice; not sure
         # if it's worth implementing at this stage, but perhaps in the future.
-        with start_testbed(virtual_server_args, temp_dir, no_clean_on_error) as testbed:
+        with start_testbed(virtual_server_args, temp_dir, no_clean_on_error,
+                host_distro=host_distro) as testbed:
             # directories need explicit '/' appended for VirtSubproc
             tree = Pair(testbed.scratch + '/control/', testbed.scratch + '/experiment/')
             dist = Pair(testbed.scratch + '/control-dist/', testbed.scratch + '/experiment-dist/')
@@ -534,6 +536,9 @@ COMMAND_LINE_OPTIONS = types.MappingProxyType(collections.OrderedDict([
     ('--config-file', types.MappingProxyType({
         'type': str, 'default': '.reprotestrc',
         'help': 'File to load configuration from. (Default: %(default)s)'})),
+    ('--host-distro', types.MappingProxyType({
+        'type': str, 'default': 'debian',
+        'help': 'The distribution that will run the tests (Default: %(default)s)'})),
     ('--source-root', types.MappingProxyType({
         'dest': 'source_root', 'type': pathlib.Path,
         'help': 'Root of the source tree, if not the '
@@ -667,6 +672,9 @@ def main():
     virtual_server_args = command_line_options.get(
         'virtual_server_args',
         config_options.get('virtual_server_args'))
+
+    host_distro = command_line_options.get('host_distro', 'debian')
+
     # Reprotest will copy this tree and then run the build command.
     # If a source root isn't provided, assume it's the current working
     # directory.
@@ -726,4 +734,4 @@ def main():
     # print(build_command, artifact, virtual_server_args)
     return check(build_command, artifact, virtual_server_args, source_root,
                  no_clean_on_error, variations, store_dir, diffoscope_args,
-                 testbed_pre, testbed_init)
+                 testbed_pre, testbed_init, host_distro)

-- 
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