Patchwork [1,of,7,STABLE] run-tests.py: execute hghave with same env vars as ones for actual tests

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Jan. 21, 2015, 3:10 p.m.
Message ID <0e281842c40a177bfbf7.1421853048@juju>
Download mbox | patch
Permalink /patch/7527/
State Accepted
Commit 769027075e2183799e40bfad188df80cf4de40ae
Headers show

Comments

Katsunori FUJIWARA - Jan. 21, 2015, 3:10 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1421852638 -32400
#      Thu Jan 22 00:03:58 2015 +0900
# Branch stable
# Node ID 0e281842c40a177bfbf7d062dadc04e2febc5aad
# Parent  a43fdf33a6beb697945a3dbb7253f0436ea278a6
run-tests.py: execute hghave with same env vars as ones for actual tests

Before this patch, "run-tests.py" executes "hghave" process without
any modifications for environment variables, even though actual tests
are executed with LC_ALL, LANG and LANGUAGE explicitly assigned "C".

When "run-tests.py" is executed:

  - with non-"C" locale environment variables on any platforms, or

  - without any explicit locale environment setting on Windows
    (only for "outer-repo" feature using "hg root")

external commands indirectly executed by "hghave" may show translated
messages.

This causes incorrect "hghave" result and skipping tests, because some
regexp matching of "hghave" expect external commands to show
un-translated messages.

To prevent external commands from showing translated messages, this
patch makes "run-tests.py" execute "hghave" with same environment
variables as ones for actual tests.

This patch doesn't make "hghave" execute external commands forcibly
with LC_ALL, LANG and LANGUAGE explicitly assigned "C", because
changing "run-tests.py" is cheaper than changing "hghave":

  - "os.popen" should be replaced by "subprocess.Popen" or so, and
  - setting up environment variables should be newly added

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -786,7 +786,7 @@  class TTest(Test):
         tdir = self._testdir.replace('\\', '/')
         proc = Popen4('%s -c "%s/hghave %s"' %
                       (self._shell, tdir, ' '.join(reqs)),
-                      self._testtmp, 0)
+                      self._testtmp, 0, self._getenv())
         stdout, stderr = proc.communicate()
         ret = proc.wait()
         if wifexited(ret):