[reprotest] 01/01: main: suppress min-cpu warnings in tests

Ximin Luo infinity0 at debian.org
Mon Nov 27 10:49:04 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 4245a2af372d0668e5547b7dcee14c295a62c711
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Nov 27 11:48:35 2017 +0100

    main: suppress min-cpu warnings in tests
---
 reprotest/__init__.py   | 9 ++++++---
 reprotest/build.py      | 2 --
 tests/test_reprotest.py | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 3a165ea..0065e18 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -581,8 +581,8 @@ def cli_parser():
         'whitelist and blacklist. You probably want to set --vary=-all as well '
         'when setting this flag; see the man page for details. Conflicts with '
         '--extra-build and --auto-build.')
-    group1_0.add_argument('--min-cpus', default=1, type=int, metavar='NUM',
-        help='Minimum CPUs to use when fixing num_cpus. Default: %(default)s')
+    group1_0.add_argument('--min-cpus', default=None, type=int, metavar='NUM',
+        help='Minimum CPUs to use when fixing num_cpus. Default: 1.')
     # TODO: remove after reprotest 0.8
     group1.add_argument('--dont-vary', default=[], action='append', help=argparse.SUPPRESS)
 
@@ -769,7 +769,10 @@ def run(argv, dry_run=None):
         for extra_build in parsed_args.extra_build:
             specs.append(spec.extend(extra_build))
         check_func = check
-    build_variations = Variations.of(*specs, verbosity=verbosity, min_cpus=parsed_args.min_cpus)
+    if parsed_args.min_cpus is None:
+        logger.warn("The control build runs on 1 CPU by default, give --min-cpus to increase this.")
+    min_cpus = parsed_args.min_cpus or 1
+    build_variations = Variations.of(*specs, verbosity=verbosity, min_cpus=min_cpus)
 
     # Warn about missing programs
     if virtual_server_args[0] == "null" and not dry_run:
diff --git a/reprotest/build.py b/reprotest/build.py
index b9a53b1..6a87b48 100644
--- a/reprotest/build.py
+++ b/reprotest/build.py
@@ -307,8 +307,6 @@ def num_cpus(ctx, build, vary):
     if ctx.min_cpus <= 0:
         raise ValueError("--min-cpus must be a positive integer: " % ctx.min_cpus)
     if not vary:
-        if ctx.min_cpus == 1:
-            logger.warn("The control build runs on 1 CPU by default, give --min-cpus to increase this.")
         _ = _.append_setup_exec_raw('CPU_NUM=$CPU_MIN')
     else:
         # random number between min_cpus and $(nproc --all)
diff --git a/tests/test_reprotest.py b/tests/test_reprotest.py
index a4ba48f..604cc5f 100644
--- a/tests/test_reprotest.py
+++ b/tests/test_reprotest.py
@@ -11,7 +11,7 @@ import pytest
 import reprotest
 from reprotest.build import VariationSpec, Variations, VARIATIONS
 
-REPROTEST = [sys.executable, "-m", "reprotest", "--no-diffoscope"]
+REPROTEST = [sys.executable, "-m", "reprotest", "--no-diffoscope", "--min-cpus", "1"]
 REPROTEST_TEST_SERVERS = os.getenv("REPROTEST_TEST_SERVERS", "null").split(",")
 REPROTEST_TEST_DONTVARY = os.getenv("REPROTEST_TEST_DONTVARY", "").split(",")
 

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