##// END OF EJS Templates
chg: set CHGHG before connecting to command server...
chg: set CHGHG before connecting to command server cf4d2f31 (!523) changed chg to set `CHGHG` itself when spawning a new command server, in order to ensure that the path to the `hg` executable would be checked during server validation. (This is useful when chg is built with `HGPATHREL`). However, that change broke chg because it failed to set `CHGHG` before trying to connect to an existing command server. This means that if `CHGHG` is not present in the environment, chg will always spawn a new command server, entirely negating the point of chg. This breakage wasn't initially caught because of the difficulty of writing automated tests with the `HGPATHREL` feature enabled, which meant the change was only tested manually to make sure that it fixed the problem with `HGPATHREL` that prompted the change. In practice, this functionality is only really useful when chg is built with `HGPATHREL`, so I considered wrapping it in an `#ifdef` to preserve the old behavior by default. However, this makes it hard to write tests since one would have to explicitly set `HGPATHREL=1` when running `run-tests.py` (which is why the original change lacked tests). It would be great if there were a way of testing features that are gated behind conditional compilation.

File last commit:

r51327:c2a1f866 stable
r51327:c2a1f866 stable
Show More
test-chg.t
572 lines | 15.5 KiB | text/troff | Tads3Lexer
Yuya Nishihara
test-chg: run only with chg...
r29274 #require chg
chg: scale the timeout in test with the rest...
r50679 Scale the timeout for the chg-server to the test timeout scaling.
This is done to reduce the flakiness of this test on heavy load.
$ CHGTIMEOUT=`expr $HGTEST_TIMEOUT / 6`
$ export CHGTIMEOUT
Yuya Nishihara
commandserver: add config knob for various logging options...
r40862 $ mkdir log
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035 $ cp $HGRCPATH $HGRCPATH.unconfigured
Yuya Nishihara
commandserver: expand log path for convenience...
r40861 $ cat <<'EOF' >> $HGRCPATH
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860 > [cmdserver]
Yuya Nishihara
commandserver: add config knob for various logging options...
r40862 > log = $TESTTMP/log/server.log
> max-log-files = 1
> max-log-size = 10 kB
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860 > EOF
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275 $ cp $HGRCPATH $HGRCPATH.orig
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860 $ filterlog () {
> sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!' \
> -e 's!\(setprocname\|received fds\|setenv\): .*!\1: ...!' \
> -e 's!\(confighash\|mtimehash\) = [0-9a-f]*!\1 = ...!g' \
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035 > -e 's!\(in \)[0-9.]*s\b!\1 ...s!g' \
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860 > -e 's!\(pid\)=[0-9]*!\1=...!g' \
> -e 's!\(/server-\)[0-9a-f]*!\1...!g'
> }
Jun Wu
chgserver: handle ParseError during validate...
r28516 init repo
Yuya Nishihara
test-chg: run only with chg...
r29274 $ chg init foo
Jun Wu
chgserver: handle ParseError during validate...
r28516 $ cd foo
ill-formed config
Yuya Nishihara
test-chg: run only with chg...
r29274 $ chg status
Jun Wu
chgserver: handle ParseError during validate...
r28516 $ echo '=brokenconfig' >> $HGRCPATH
Yuya Nishihara
test-chg: run only with chg...
r29274 $ chg status
Pulkit Goyal
tests: update test-chg.t with output change...
r46603 config error at * =brokenconfig (glob)
Pulkit Goyal
chgserver: respect detailed exit code in case of ConfigError...
r46761 [30]
Jun Wu
chgserver: remove _clearenvaliases...
r29088
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275 $ cp $HGRCPATH.orig $HGRCPATH
Jun Wu
chg: support long socket path...
r30677
long socket path
$ sockpath=$TESTTMP/this/path/should/be/longer/than/one-hundred-and-seven/characters/where/107/is/the/typical/size/limit/of/unix-domain-socket
$ mkdir -p $sockpath
$ bakchgsockname=$CHGSOCKNAME
$ CHGSOCKNAME=$sockpath/server
$ export CHGSOCKNAME
$ chg root
$TESTTMP/foo
$ rm -rf $sockpath
$ CHGSOCKNAME=$bakchgsockname
$ export CHGSOCKNAME
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275 $ cd ..
Yuya Nishihara
chg: refactor ui.system() to be partly overridden...
r31107 editor
------
$ cat >> pushbuffer.py <<EOF
> def reposetup(ui, repo):
> repo.ui.pushbuffer(subproc=True)
> EOF
$ chg init editor
$ cd editor
by default, system() should be redirected to the client:
$ touch foo
$ CHGDEBUG= HGEDITOR=cat chg ci -Am channeled --edit 2>&1 \
> | egrep "HG:|run 'cat"
Jun Wu
chg: show timestamp with debug messages...
r34310 chg: debug: * run 'cat "*"' at '$TESTTMP/editor' (glob)
Yuya Nishihara
chg: refactor ui.system() to be partly overridden...
r31107 HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'default'
HG: added foo
but no redirection should be made if output is captured:
$ touch bar
$ CHGDEBUG= HGEDITOR=cat chg ci -Am bufferred --edit \
> --config extensions.pushbuffer="$TESTTMP/pushbuffer.py" 2>&1 \
> | egrep "HG:|run 'cat"
[1]
check that commit commands succeeded:
$ hg log -T '{rev}:{desc}\n'
1:bufferred
0:channeled
$ cd ..
Yuya Nishihara
pager: wrap _runcommand() no matter if stdout is redirected...
r30847 pager
-----
$ cat >> fakepager.py <<EOF
> import sys
> for line in sys.stdin:
> sys.stdout.write('paged! %r\n' % line)
> EOF
enable pager extension globally, but spawns the master server with no tty:
$ chg init pager
$ cd pager
$ cat >> $HGRCPATH <<EOF
> [extensions]
> pager =
> [pager]
Matt Harbison
tests: quote PYTHON usage...
r39743 > pager = "$PYTHON" $TESTTMP/fakepager.py
Yuya Nishihara
pager: wrap _runcommand() no matter if stdout is redirected...
r30847 > EOF
$ chg version > /dev/null
$ touch foo
$ chg ci -qAm foo
pager should be enabled if the attached client has a tty:
$ chg log -l1 -q --config ui.formatted=True
paged! '0:1f7b0de80e11\n'
$ chg log -l1 -q --config ui.formatted=False
0:1f7b0de80e11
Jun Wu
chg: always wait for pager...
r31890 chg waits for pager if runcommand raises
$ cat > $TESTTMP/crash.py <<EOF
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > from mercurial import registrar
Jun Wu
chg: always wait for pager...
r31890 > cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > command = registrar.command(cmdtable)
Pulkit Goyal
py3: make sure commands name are bytes in tests
r33097 > @command(b'crash')
Jun Wu
chg: always wait for pager...
r31890 > def pagercrash(ui, repo, *pats, **opts):
Martin von Zweigbergk
py3: add a missing b'' prefix in test extension for chg...
r43424 > ui.write(b'going to crash\n')
Jun Wu
chg: always wait for pager...
r31890 > raise Exception('.')
> EOF
$ cat > $TESTTMP/fakepager.py <<EOF
Augie Fackler
tests: update test-chg to pass our import checker
r33951 > import sys
> import time
Jun Wu
chg: always wait for pager...
r31890 > for line in iter(sys.stdin.readline, ''):
> if 'crash' in line: # only interested in lines containing 'crash'
> # if chg exits when pager is sleeping (incorrectly), the output
> # will be captured by the next test case
> time.sleep(1)
> sys.stdout.write('crash-pager: %s' % line)
> EOF
$ cat >> .hg/hgrc <<EOF
> [extensions]
> crash = $TESTTMP/crash.py
> EOF
$ chg crash --pager=on --config ui.formatted=True 2>/dev/null
crash-pager: going to crash
[255]
Yuya Nishihara
chgserver: discard buffered output before restoring fds (issue6207)...
r45745 no stdout data should be printed after pager quits, and the buffered data
should never persist (issue6207)
"killed!" may be printed if terminated by SIGPIPE, which isn't important
in this test.
$ cat > $TESTTMP/bulkwrite.py <<'EOF'
> import time
> from mercurial import error, registrar
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command(b'bulkwrite')
> def bulkwrite(ui, repo, *pats, **opts):
> ui.write(b'going to write massive data\n')
> ui.flush()
> t = time.time()
> while time.time() - t < 2:
> ui.write(b'x' * 1023 + b'\n') # will be interrupted by SIGPIPE
> raise error.Abort(b"write() doesn't block")
> EOF
$ cat > $TESTTMP/fakepager.py <<'EOF'
> import sys
> import time
> sys.stdout.write('paged! %r\n' % sys.stdin.readline())
> time.sleep(1) # new data will be written
> EOF
$ cat >> .hg/hgrc <<EOF
> [extensions]
> bulkwrite = $TESTTMP/bulkwrite.py
> EOF
$ chg bulkwrite --pager=on --color no --config ui.formatted=True
paged! 'going to write massive data\n'
killed! (?)
[255]
$ chg bulkwrite --pager=on --color no --config ui.formatted=True
paged! 'going to write massive data\n'
killed! (?)
[255]
Yuya Nishihara
pager: wrap _runcommand() no matter if stdout is redirected...
r30847 $ cd ..
Jun Wu
chg: fallback to original hg if stdio fds are missing...
r46093 missing stdio
-------------
$ CHGDEBUG=1 chg version -q 0<&-
chg: debug: * stdio fds are missing (glob)
chg: debug: * execute original hg (glob)
Mercurial Distributed SCM * (glob)
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275 server lifecycle
----------------
chg server should be restarted on code change, and old server will shut down
automatically. In this test, we use the following time parameters:
- "sleep 1" to make mtime different
- "sleep 2" to notice mtime change (polling interval is 1 sec)
set up repository with an extension:
$ chg init extreload
$ cd extreload
$ touch dummyext.py
$ cat <<EOF >> .hg/hgrc
> [extensions]
> dummyext = dummyext.py
> EOF
isolate socket directory for stable result:
$ OLDCHGSOCKNAME=$CHGSOCKNAME
$ mkdir chgsock
$ CHGSOCKNAME=`pwd`/chgsock/server
warm up server:
$ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
Jun Wu
chg: show timestamp with debug messages...
r34310 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275
new server should be started if extension modified:
$ sleep 1
$ touch dummyext.py
$ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
Jun Wu
chg: show timestamp with debug messages...
r34310 chg: debug: * instruction: unlink $TESTTMP/extreload/chgsock/server-* (glob)
chg: debug: * instruction: reconnect (glob)
chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275
old server will shut down, while new server should still be reachable:
$ sleep 2
$ CHGDEBUG= chg log 2>&1 | (egrep 'instruction|start' || true)
socket file should never be unlinked by old server:
(simulates unowned socket by updating mtime, which makes sure server exits
at polling cycle)
$ ls chgsock/server-*
chgsock/server-* (glob)
$ touch chgsock/server-*
$ sleep 2
$ ls chgsock/server-*
chgsock/server-* (glob)
since no server is reachable from socket file, new server should be started:
(this test makes sure that old server shut down automatically)
$ CHGDEBUG= chg log 2>&1 | egrep 'instruction|start'
Jun Wu
chg: show timestamp with debug messages...
r34310 chg: debug: * start cmdserver at $TESTTMP/extreload/chgsock/server.* (glob)
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275
shut down servers and restore environment:
$ rm -R chgsock
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860 $ sleep 2
Yuya Nishihara
test-chg: add basic tests for server lifecycle...
r29275 $ CHGSOCKNAME=$OLDCHGSOCKNAME
$ cd ..
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860
check that server events are recorded:
Yuya Nishihara
commandserver: add config knob for various logging options...
r40862 $ ls log
server.log
server.log.1
print only the last 10 lines, since we aren't sure how many records are
Pulkit Goyal
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it...
r45523 preserved (since setprocname isn't available on py3 and pure version,
the 10th-most-recent line is different when using py3):
Yuya Nishihara
commandserver: add config knob for various logging options...
r40862
$ cat log/server.log.1 log/server.log | tail -10 | filterlog
Pulkit Goyal
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it...
r45523 YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ... (no-setprocname !)
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035 YYYY/MM/DD HH:MM:SS (PID)> forked worker process (pid=...)
Pulkit Goyal
tests: add hghave rule 'setprocname' to check if osutil.setprocname and use it...
r45523 YYYY/MM/DD HH:MM:SS (PID)> setprocname: ... (setprocname !)
Yuya Nishihara
commandserver: switch logging facility to ui.log() interface...
r40860 YYYY/MM/DD HH:MM:SS (PID)> received fds: ...
YYYY/MM/DD HH:MM:SS (PID)> chdir to '$TESTTMP/extreload'
YYYY/MM/DD HH:MM:SS (PID)> setumask 18
YYYY/MM/DD HH:MM:SS (PID)> setenv: ...
YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ...
YYYY/MM/DD HH:MM:SS (PID)> validate: []
Yuya Nishihara
commandserver: turn server debug messages into logs...
r40863 YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
YYYY/MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not owned, exiting.
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035
Yuya Nishihara
chgserver: spawn new process if schemes change...
r44832 global data mutated by schems
-----------------------------
$ hg init schemes
$ cd schemes
initial state
$ cat > .hg/hgrc <<'EOF'
> [extensions]
> schemes =
> [schemes]
> foo = https://foo.example.org/
> EOF
$ hg debugexpandscheme foo://expanded
https://foo.example.org/expanded
$ hg debugexpandscheme bar://unexpanded
bar://unexpanded
add bar
$ cat > .hg/hgrc <<'EOF'
> [extensions]
> schemes =
> [schemes]
> foo = https://foo.example.org/
> bar = https://bar.example.org/
> EOF
$ hg debugexpandscheme foo://expanded
https://foo.example.org/expanded
$ hg debugexpandscheme bar://expanded
https://bar.example.org/expanded
remove foo
$ cat > .hg/hgrc <<'EOF'
> [extensions]
> schemes =
> [schemes]
> bar = https://bar.example.org/
> EOF
$ hg debugexpandscheme foo://unexpanded
foo://unexpanded
$ hg debugexpandscheme bar://expanded
https://bar.example.org/expanded
$ cd ..
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035 repository cache
----------------
$ cp $HGRCPATH.unconfigured $HGRCPATH
$ cat <<'EOF' >> $HGRCPATH
> [cmdserver]
test-chg: use a different log to avoid flakyness...
r50993 > log = $TESTTMP/log/server-cached.log
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035 > max-repo-cache = 1
> track-log = command, repocache
> EOF
isolate socket directory for stable result:
$ OLDCHGSOCKNAME=$CHGSOCKNAME
$ mkdir chgsock
$ CHGSOCKNAME=`pwd`/chgsock/server
create empty repo and cache it:
$ hg init cached
$ hg id -R cached
000000000000 tip
$ sleep 1
modify repo (and cache will be invalidated):
$ touch cached/a
$ hg ci -R cached -Am 'add a'
adding a
$ sleep 1
read cached repo:
$ hg log -R cached
changeset: 0:ac82d8b1f7c4
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
$ sleep 1
discard cached from LRU cache:
$ hg clone cached cached2
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg id -R cached2
ac82d8b1f7c4 tip
$ sleep 1
read uncached repo:
$ hg log -R cached
changeset: 0:ac82d8b1f7c4
tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: add a
$ sleep 1
shut down servers and restore environment:
$ rm -R chgsock
$ sleep 2
$ CHGSOCKNAME=$OLDCHGSOCKNAME
check server log:
test-chg: use a different log to avoid flakyness...
r50993 $ cat log/server-cached.log | filterlog
Yuya Nishihara
commandserver: preload repository in master server and reuse its file cache...
r41035 YYYY/MM/DD HH:MM:SS (PID)> init cached
YYYY/MM/DD HH:MM:SS (PID)> id -R cached
YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached
YYYY/MM/DD HH:MM:SS (PID)> ci -R cached -Am 'add a'
YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
YYYY/MM/DD HH:MM:SS (PID)> repo from cache: $TESTTMP/cached
YYYY/MM/DD HH:MM:SS (PID)> log -R cached
YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
YYYY/MM/DD HH:MM:SS (PID)> clone cached cached2
YYYY/MM/DD HH:MM:SS (PID)> id -R cached2
YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached2 (in ...s)
YYYY/MM/DD HH:MM:SS (PID)> log -R cached
YYYY/MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in ...s)
Kyle Lippincott
chg: fix chg to work with py3.7+ "coercing" the locale...
r44312
Arun Kulshreshtha
dispatch: change cwd when loading local config...
r50317 Test that -R is interpreted relative to --cwd.
$ hg init repo1
$ mkdir -p a/b
$ hg init a/b/repo2
$ printf "[alias]\ntest=repo1\n" >> repo1/.hg/hgrc
$ printf "[alias]\ntest=repo2\n" >> a/b/repo2/.hg/hgrc
$ cd a
$ chg --cwd .. -R repo1 show alias.test
repo1
$ chg --cwd . -R b/repo2 show alias.test
repo2
$ cd ..
Kyle Lippincott
chg: force-set LC_CTYPE on server start to actual value from the environment...
r44733 Test that chg works (sets to the user's actual LC_CTYPE) even when python
"coerces" the locale (py3.7+)
Kyle Lippincott
chg: fix chg to work with py3.7+ "coercing" the locale...
r44312
$ cat > $TESTTMP/debugenv.py <<EOF
> from mercurial import encoding
> from mercurial import registrar
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command(b'debugenv', [], b'', norepo=True)
> def debugenv(ui):
> for k in [b'LC_ALL', b'LC_CTYPE', b'LANG']:
> v = encoding.environ.get(k)
> if v is not None:
> ui.write(b'%s=%s\n' % (k, encoding.environ[k]))
> EOF
Kyle Lippincott
chg: force-set LC_CTYPE on server start to actual value from the environment...
r44733 (hg keeps python's modified LC_CTYPE, chg doesn't)
$ (unset LC_ALL; unset LANG; LC_CTYPE= "$CHGHG" \
> --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
LC_CTYPE=C.UTF-8 (py37 !)
LC_CTYPE= (no-py37 !)
$ (unset LC_ALL; unset LANG; LC_CTYPE= chg \
> --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
LC_CTYPE=
$ (unset LC_ALL; unset LANG; LC_CTYPE=unsupported_value chg \
> --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
Kyle Lippincott
tests: fix test-chg to ignore a warning about being unable to set locale...
r47786 *cannot change locale* (glob) (?)
Kyle Lippincott
chg: force-set LC_CTYPE on server start to actual value from the environment...
r44733 LC_CTYPE=unsupported_value
$ (unset LC_ALL; unset LANG; LC_CTYPE= chg \
> --config extensions.debugenv=$TESTTMP/debugenv.py debugenv)
LC_CTYPE=
Kyle Lippincott
chg: fix chg to work with py3.7+ "coercing" the locale...
r44312 $ LANG= LC_ALL= LC_CTYPE= chg \
> --config extensions.debugenv=$TESTTMP/debugenv.py debugenv
LC_ALL=
Kyle Lippincott
chg: force-set LC_CTYPE on server start to actual value from the environment...
r44733 LC_CTYPE=
Kyle Lippincott
chg: fix chg to work with py3.7+ "coercing" the locale...
r44312 LANG=
Kyle Lippincott
profiling: add --no-profile to disable profiling enabled via config...
r47787
Profiling isn't permanently enabled or carried over between chg invocations that
share the same server
$ cp $HGRCPATH.orig $HGRCPATH
$ hg init $TESTTMP/profiling
$ cd $TESTTMP/profiling
$ filteredchg() {
Arseniy Alekseyev
tests: better determinism in test-chg.t...
r49096 > CHGDEBUG=1 chg "$@" 2>&1 | sed -rn 's_^No samples recorded.*$_Sample count: 0_; /Sample count/p; /start cmdserver/p'
Kyle Lippincott
profiling: add --no-profile to disable profiling enabled via config...
r47787 > }
$ newchg() {
> chg --kill-chg-daemon
> filteredchg "$@" | egrep -v 'start cmdserver' || true
> }
(--profile isn't permanently on just because it was specified when chg was
started)
$ newchg log -r . --profile
Sample count: * (glob)
$ filteredchg log -r .
(enabling profiling via config works, even on the first chg command that starts
a cmdserver)
$ cat >> $HGRCPATH <<EOF
> [profiling]
> type=stat
> enabled=1
> EOF
$ newchg log -r .
Sample count: * (glob)
$ filteredchg log -r .
Sample count: * (glob)
(test that we aren't accumulating more and more samples each run)
$ cat > $TESTTMP/debugsleep.py <<EOF
> import time
> from mercurial import registrar
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command(b'debugsleep', [], b'', norepo=True)
> def debugsleep(ui):
> start = time.time()
> x = 0
> while time.time() < start + 0.5:
> time.sleep(.1)
> x += 1
> ui.status(b'%d debugsleep iterations in %.03fs\n' % (x, time.time() - start))
> EOF
$ cat >> $HGRCPATH <<EOF
> [extensions]
> debugsleep = $TESTTMP/debugsleep.py
> EOF
$ newchg debugsleep > run_1
$ filteredchg debugsleep > run_2
$ filteredchg debugsleep > run_3
$ filteredchg debugsleep > run_4
FIXME: Run 4 should not be >3x Run 1's number of samples.
$ "$PYTHON" <<EOF
> r1 = int(open("run_1", "r").read().split()[-1])
> r4 = int(open("run_4", "r").read().split()[-1])
> print("Run 1: %d samples\nRun 4: %d samples\nRun 4 > 3 * Run 1: %s" %
> (r1, r4, r4 > (r1 * 3)))
> EOF
Run 1: * samples (glob)
Run 4: * samples (glob)
Kyle Lippincott
chg: pass --no-profile to disable profiling when starting hg serve...
r47798 Run 4 > 3 * Run 1: False
Kyle Lippincott
profiling: add --no-profile to disable profiling enabled via config...
r47787 (Disabling with --no-profile on the commandline still works, but isn't permanent)
$ newchg log -r . --no-profile
$ filteredchg log -r .
Sample count: * (glob)
$ filteredchg log -r . --no-profile
$ filteredchg log -r .
Sample count: * (glob)
Arun Kulshreshtha
chg: set CHGHG before connecting to command server...
r51327
chg setting CHGHG itself
------------------------
If CHGHG is not set, chg will set it before spawning the command server.
$ hg --kill-chg-daemon
$ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \
> 'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \
> | egrep 'CHGHG|start'
chg: debug: * start cmdserver at * (glob)
CHGHG=/*/install/bin/hg (glob)
Running the same command a second time shouldn't spawn a new command server.
$ HG=$CHGHG CHGHG= CHGDEBUG= hg debugshell -c \
> 'ui.write(b"CHGHG=%s\n" % ui.environ.get(b"CHGHG"))' 2>&1 \
> | egrep 'CHGHG|start'
CHGHG=/*/install/bin/hg (glob)