[Reproducible-commits] [reprotest] 01/01: Add xenv argument to adt_testbed.Testbed.check_exec() and replace execute() call in build with check_exec()

Ceridwen ceridwen-guest at moszumanska.debian.org
Fri Jul 15 18:03:42 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 5190d41b9908acc02c2b8ffe9530959efb49e4bc
Author: Ceridwen <ceridwenv at gmail.com>
Date:   Fri Jul 15 14:03:35 2016 -0400

    Add xenv argument to adt_testbed.Testbed.check_exec() and replace execute() call in build with check_exec()
---
 reprotest/__init__.py        | 11 ++++-------
 reprotest/lib/adt_testbed.py |  7 ++++++-
 tests/tests.py               |  6 +++---
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/reprotest/__init__.py b/reprotest/__init__.py
index 91db95c..d2627a8 100644
--- a/reprotest/__init__.py
+++ b/reprotest/__init__.py
@@ -21,7 +21,7 @@ from reprotest.lib import adt_testbed
 from reprotest import _shell_ast
 
 
-adtlog.verbosity = 1
+adtlog.verbosity = 2
 
 
 # chroot is the only form of OS virtualization that's available on
@@ -198,13 +198,10 @@ def build(script, source_root, built_artifact, testbed, artifact_store, env):
     cd = _shell_ast.SimpleCommand('', 'cd', _shell_ast.CmdSuffix([source_root]))
     new_script = (_shell_ast.List([_shell_ast.Term(cd, ';')]) + script)
     print(new_script)
-    exit_code, stdout, stderr = testbed.execute(['sh', '-ec', str(new_script)], xenv=[str(k) + '=' + str(v) for k, v in env.items()], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    print(exit_code, stdout, stderr)
+    # exit_code, stdout, stderr = testbed.execute(['sh', '-ec', str(new_script)], xenv=[str(k) + '=' + str(v) for k, v in env.items()], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    testbed.check_exec(['sh', '-ec', str(new_script)], xenv=[str(k) + '=' + str(v) for k, v in env.items()])
+    # print(exit_code, stdout, stderr)
     testbed.execute(['ls', '-l', source_root])
-    # subprocess.check_call(script, cwd=source_root, **kws)
-    # with open(built_artifact, 'rb') as artifact:
-    #     artifact_store.write(artifact.read())
-    #     artifact_store.flush()
     testbed.command('copyup', (built_artifact, artifact_store))
 
 
diff --git a/reprotest/lib/adt_testbed.py b/reprotest/lib/adt_testbed.py
index 3799a63..aaf25e9 100644
--- a/reprotest/lib/adt_testbed.py
+++ b/reprotest/lib/adt_testbed.py
@@ -450,7 +450,7 @@ class Testbed:
 
         return (proc.returncode, out, err)
 
-    def check_exec(self, argv, stdout=False, kind='short'):
+    def check_exec(self, argv, stdout=False, kind='short', xenv=[]):
         '''Run argv in testbed.
 
         If stdout is True, capture stdout and return it. Otherwise, don't
@@ -459,12 +459,17 @@ class Testbed:
         argv must succeed and not print any stderr.
         '''
         (code, out, err) = self.execute(argv,
+                                        xenv=xenv,
                                         stdout=(stdout and subprocess.PIPE or None),
                                         stderr=subprocess.PIPE, kind=kind)
+        print('CHECK_EXEC')
+        print(code, out, err)
         if err:
             self.bomb('"%s" failed with stderr "%s"' % (' '.join(argv), err),
                       adtlog.AutopkgtestError)
         if code != 0:
+            print('SHOULD RAISE HERE')
+            import pdb; pdb.set_trace()
             self.bomb('"%s" failed with status %i' % (' '.join(argv), code),
                       adtlog.AutopkgtestError)
         return out
diff --git a/tests/tests.py b/tests/tests.py
index 8473733..5727cca 100755
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -26,9 +26,9 @@ def virtual_server(request):
         raise ValueError(request.param)
 
 def test_simple_builds(virtual_server):
-    check_return_code('python3 mock_build.py', virtual_server, 0)
-    # check_return_code('python3 mock_failure.py', virtual_server, 2)
-    check_return_code('python3 mock_build.py irreproducible', virtual_server, 1)
+    # check_return_code('python3 mock_build.py', virtual_server, 0)
+    check_return_code('python3 mock_failure.py', virtual_server, 2)
+    # check_return_code('python3 mock_build.py irreproducible', virtual_server, 1)
 
 @pytest.mark.parametrize('variation', ['fileordering', 'home', 'kernel', 'locales', 'path', 'timezone']) #, 'umask'
 def test_variations(virtual_server, variation):

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