Patchwork tests: fix test-profile to not depend on HGPROF environment variable

login
register
mail settings
Submitter Durham Goode
Date March 12, 2013, 5:39 p.m.
Message ID <549e74b13d1a8fd27668.1363109944@dev350.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1113/
State Superseded
Commit cd2c82510aa230585fa50736a9e05f169c812dad
Headers show

Comments

Durham Goode - March 12, 2013, 5:39 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1363109868 25200
#      Tue Mar 12 10:37:48 2013 -0700
# Node ID 549e74b13d1a8fd276685be136d795ba49f7fab3
# Parent  018d68a30fe19e2d2c73d765306ba3156bb4957c
tests: fix test-profile to not depend on HGPROF environment variable

The test-profile test would fail if the user had HGPROF set to another
profiler in their environment.  This fix makes the test independent of
that environment variable.
Bryan O'Sullivan - March 12, 2013, 5:44 p.m.
On Tue, Mar 12, 2013 at 10:39 AM, Durham Goode <durham@fb.com> wrote:

> tests: fix test-profile to not depend on HGPROF environment variable
>

Applied, thanks.
Mads Kiilerich - March 12, 2013, 5:50 p.m.
On 03/12/2013 06:39 PM, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1363109868 25200
> #      Tue Mar 12 10:37:48 2013 -0700
> # Node ID 549e74b13d1a8fd276685be136d795ba49f7fab3
> # Parent  018d68a30fe19e2d2c73d765306ba3156bb4957c
> tests: fix test-profile to not depend on HGPROF environment variable
>
> The test-profile test would fail if the user had HGPROF set to another
> profiler in their environment.  This fix makes the test independent of
> that environment variable.
>
> diff --git a/tests/test-profile.t b/tests/test-profile.t
> --- a/tests/test-profile.t
> +++ b/tests/test-profile.t
> @@ -8,6 +8,8 @@
>   
>   test --profile
>   
> +  $ export -n HGPROF

$ dash -c 'export -n HGPROF'
dash: 1: export: Illegal option -n

But this kind of stuff is usually done in run-tests.py main().

Actually it would have been reset automatically if HGPROF had followed 
the apparent convention and called HG_PROF. The variable is undocumented 
and could perhaps be considered an internal(?) implementation detail and 
renamed.

/Mads
Durham Goode - March 12, 2013, 5:58 p.m.
>
>Actually it would have been reset automatically if HGPROF had followed
>the apparent convention and called HG_PROF. The variable is undocumented
>and could perhaps be considered an internal(?) implementation detail and
>renamed.
>
>/Mads

I like this idea.  Resending.

Patch

diff --git a/tests/test-profile.t b/tests/test-profile.t
--- a/tests/test-profile.t
+++ b/tests/test-profile.t
@@ -8,6 +8,8 @@ 
 
 test --profile
 
+  $ export -n HGPROF
+
   $ hg --profile st 2>../out
   $ grep CallCount ../out > /dev/null || cat ../out