From patchwork Thu Mar 24 20:16:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v3] run-tests: try to provide a test.env file RFC From: timeless@mozdev.org X-Patchwork-Id: 14060 Message-Id: <1187c2c232ee7f23711d.1458850587@waste.org> To: mercurial-devel@mercurial-scm.org Date: Thu, 24 Mar 2016 15:16:27 -0500 # HG changeset patch # User timeless # Date 1450782416 0 # Tue Dec 22 11:06:56 2015 +0000 # Node ID 1187c2c232ee7f23711dc3c0857ea2e1cc92a42d # Parent 1a1e4350b560cf2f49fe235d2e5168471877462d run-tests: try to provide a test.env file RFC This is a step to providing an environment file that people can use to reproduce a failing test environment. --- The Windows side isn't tested. Long term, it'd be helpful if this included code or instructions to empty the environment too... diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -730,6 +730,16 @@ log('\nKeeping testtmp dir: %s\nKeeping threadtmp dir: %s' % (self._testtmp.decode('utf-8'), self._threadtmp.decode('utf-8'))) + env = self._getenv() + def format(k, v): + return 'export %s="%s"\n' % (k, v.replace('"', r'\"')) + if os.name == 'nt': + def format(k, v): + return 'set %s=%s\r\n' % (k, v.replace('&', '^&')) + f = open(os.path.join(self._threadtmp, 'test.env'), 'wb') + for k, v in env.iteritems(): + f.write(format(k, v)) + f.close() else: shutil.rmtree(self._testtmp, True) shutil.rmtree(self._threadtmp, True) diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -465,6 +465,18 @@ . # Ran 1 tests, 0 skipped, 0 warned, 0 failed. + $ egrep 'HGEDITOR|HGPORT|PYTHONHASHSEED|PYTHON|HGPORT|DAEMON_PIDS|EMAIL' \ + > keep/child1/test.env | sort + export DAEMON_PIDS="$TESTTMP/keep/child1/daemon.pids" (glob) + export EMAIL="Foo Bar " + export HGEDITOR="* -c \"import sys; sys.exit(0)\"" (glob) + export HGPORT1="*" (glob) + export HGPORT2="*" (glob) + export HGPORT="*" (glob) + export PYTHON="*" (glob) + export PYTHONHASHSEED="*" (glob) + export PYTHONPATH="*:$TESTTMP:*" (glob) + timeouts ======== $ cat > test-timeout.t <