[reprotest] 01/01: tests: fix, need to preserve env for su

Ximin Luo infinity0 at debian.org
Fri Oct 27 01:13:45 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 3fbc56928134675161f61075767b60c43e390684
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Oct 27 03:12:50 2017 +0200

    tests: fix, need to preserve env for su
---
 reprotest/__init__.py   | 5 ++++-
 tests/mock_build.py     | 2 +-
 tests/test_reprotest.py | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 7ac4ff0..f9ff72a 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -203,7 +203,10 @@ class BuildContext(collections.namedtuple('_BuildContext',
         logger.debug("#### END REPROTEST BUILD SCRIPT ################################################")
 
         if 'root-on-testbed' in testbed.caps:
-            build_argv = ['su', '-s', '/bin/sh', testbed.user, '-c', 'set -e; ' + build_script]
+            fix_path = 'export PATH=%s; ' % shlex.quote(build.env['PATH']) if 'PATH' in build.env else ''
+            build_argv = ['su', '-p', '-s', '/bin/sh', testbed.user,
+                '-c', 'set -e; ' + fix_path + build_script]
+            logger.info("su to user '%s' to run the build", testbed.user)
         else:
             build_argv = ['sh', '-ec', build_script]
 
diff --git a/tests/mock_build.py b/tests/mock_build.py
index 3acc837..d0ab4a3 100755
--- a/tests/mock_build.py
+++ b/tests/mock_build.py
@@ -66,4 +66,4 @@ if __name__ == '__main__':
     with open('artifact', 'w') as fp:
         for line in output:
             print(line, file=fp)
-            print(line, file=sys.stderr)
+            #print(line, file=sys.stderr)
diff --git a/tests/test_reprotest.py b/tests/test_reprotest.py
index c2062c8..a4ba48f 100644
--- a/tests/test_reprotest.py
+++ b/tests/test_reprotest.py
@@ -62,7 +62,7 @@ def test_simple_builds(virtual_server):
 def setup_logging(debug):
     logger = logging.getLogger()
     oldLevel = logger.getEffectiveLevel()
-    logger.setLevel(logging.DEBUG if debug else logging.WARNING)
+    logger.setLevel(logging.DEBUG if debug else logging.INFO)
 
     ch = logging.StreamHandler()
     ch.setLevel(logging.DEBUG)
@@ -86,7 +86,7 @@ def setup_logging(debug):
 @pytest.mark.parametrize('captures', list(VARIATIONS.keys()))
 def test_variations(virtual_server, captures):
     expected = captures not in TEST_VARIATIONS
-    with setup_logging(True):
+    with setup_logging(False):
         check_reproducibility('python3 mock_build.py ' + captures, virtual_server, expected)
 
 @pytest.mark.need_builddeps

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