annotate tests/test-extdata.t @ 35428:71427ff1dff8

workers: handling exceptions in windows workers This adds handling of exceptions from worker threads and resurfaces them as if the function ran without workers. If any of the threads throws, the main thread kills all running threads giving them 5 sec to handle the interruption and raises the first exception received. We don't have to join threads if is_alive() is false Test Plan: Ran multiple updates/enable/disable sparse profile and things worked well Ran test on CentOS- all tests passing on @ passed here Added a forged exception into the worker code and got it properly resurfaced and the rest of workers killed: P58642088 PS C:\open\<repo>> ..\facebook-hg-rpms\build\hg\hg.exe --config extensions.fsmonitor=! sparse --enable-profile <profile> updating [==> ] 1300/39166 1m57sException in thread Thread-3: Traceback (most recent call last): File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\threading.py", line 801, in __bootstrap_inner self.run() File "C:\open\facebook-hg-rpms\build\hg\mercurial\worker.py", line 244, in run raise e Exception: Forged exception Exception in thread Thread-2: Traceback (most recent call last): File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\threading.py", line 801, in __bootstrap_inner self.run() File "C:\open\facebook-hg-rpms\build\hg\mercurial\worker.py", line 244, in run raise e Exception: Forged exception <...> Traceback (most recent call last): File "C:\open\facebook-hg-rpms\build\hg\hgexe.py", line 41, in <module> dispatch.run() File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 85, in run status = (dispatch(req) or 0) & 255 File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 173, in dispatch ret = _runcatch(req) File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 324, in _runcatch return _callcatch(ui, _runcatchfunc) File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 332, in _callcatch return scmutil.callcatch(ui, func) File "C:\open\facebook-hg-rpms\build\hg\mercurial\scmutil.py", line 154, in callcatch return func() File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 314, in _runcatchfunc return _dispatch(req) File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 951, in _dispatch cmdpats, cmdoptions) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\remotefilelog\__init__.py", line 415, in runcommand return orig(lui, repo, *args, **kwargs) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\undo.py", line 118, in _runcommandwrapper result = orig(lui, repo, cmd, fullargs, *args) File "C:\open\facebook-hg-rpms\build\hg\hgext\journal.py", line 84, in runcommand return orig(lui, repo, cmd, fullargs, *args) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\perftweaks.py", line 268, in _tracksparseprofiles res = runcommand(lui, repo, *args) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\perftweaks.py", line 256, in _trackdirstatesizes res = runcommand(lui, repo, *args) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\copytrace.py", line 144, in _runcommand return orig(lui, repo, cmd, fullargs, ui, *args, **kwargs) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\fbamend\hiddenoverride.py", line 119, in runcommand result = orig(lui, repo, cmd, fullargs, *args) File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 712, in runcommand ret = _runcommand(ui, options, cmd, d) File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 959, in _runcommand return cmdfunc() File "C:\open\facebook-hg-rpms\build\hg\mercurial\dispatch.py", line 948, in <lambda> d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "C:\open\facebook-hg-rpms\build\hg\mercurial\util.py", line 1183, in check return func(*args, **kwargs) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\fbsparse.py", line 860, in sparse disableprofile=disableprofile, force=force) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\fbsparse.py", line 949, in _config len, _refresh(ui, repo, oldstatus, oldsparsematch, force)) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\hgext3rd\fbsparse.py", line 1116, in _refresh mergemod.applyupdates(repo, typeactions, repo[None], repo['.'], False) File "C:\open\facebook-hg-rpms\build\hg\hg-python\lib\site-packages\remotefilelog\__init__.py", line 311, in applyupdates return orig(repo, actions, wctx, mctx, overwrite, labels=labels) File "C:\open\facebook-hg-rpms\build\hg\mercurial\merge.py", line 1464, in applyupdates for i, item in prog: File "C:\open\facebook-hg-rpms\build\hg\mercurial\worker.py", line 286, in _windowsworker raise t.exception Exception: Forged exception PS C:\open\ovrsource> Differential Revision: https://phab.mercurial-scm.org/D1459
author Wojciech Lis <wlis@fb.com>
date Mon, 20 Nov 2017 10:27:41 -0800
parents b1959391a088
children faa41fd282d1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
1 $ hg init repo
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
2 $ cd repo
34459
d5c5cc767b7e extdata: ignore ambiguous identifier as well
Yuya Nishihara <yuya@tcha.org>
parents: 34458
diff changeset
3 $ for n in 0 1 2 3 4 5 6 7 8 9 10 11; do
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
4 > echo $n > $n
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
5 > hg ci -qAm $n
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
6 > done
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
7
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
8 test revset support
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
9
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
10 $ cat <<'EOF' >> .hg/hgrc
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
11 > [extdata]
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
12 > filedata = file:extdata.txt
34458
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
13 > notes = notes.txt
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
14 > shelldata = shell:cat extdata.txt | grep 2
34542
153e4e05e9b3 extdata: show debug message if external command exits with non-zero status
Yuya Nishihara <yuya@tcha.org>
parents: 34459
diff changeset
15 > emptygrep = shell:cat extdata.txt | grep empty
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
16 > EOF
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
17 $ cat <<'EOF' > extdata.txt
34458
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
18 > 2 another comment on 2
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
19 > 3
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
20 > EOF
34458
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
21 $ cat <<'EOF' > notes.txt
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
22 > f6ed this change is great!
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
23 > e834 this is buggy :(
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
24 > 0625 first post
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
25 > bogusnode gives no error
34459
d5c5cc767b7e extdata: ignore ambiguous identifier as well
Yuya Nishihara <yuya@tcha.org>
parents: 34458
diff changeset
26 > a ambiguous node gives no error
34458
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
27 > EOF
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
28
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
29 $ hg log -qr "extdata(filedata)"
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
30 2:f6ed99a58333
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
31 3:9de260b1e88e
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
32 $ hg log -qr "extdata(shelldata)"
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
33 2:f6ed99a58333
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
34
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
35 test weight of extdata() revset
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
36
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
37 $ hg debugrevspec -p optimized "extdata(filedata) & 3"
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
38 * optimized:
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
39 (andsmally
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
40 (func
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
41 (symbol 'extdata')
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
42 (symbol 'filedata'))
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
43 (symbol '3'))
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
44 3
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
45
34542
153e4e05e9b3 extdata: show debug message if external command exits with non-zero status
Yuya Nishihara <yuya@tcha.org>
parents: 34459
diff changeset
46 test non-zero exit of shell command
153e4e05e9b3 extdata: show debug message if external command exits with non-zero status
Yuya Nishihara <yuya@tcha.org>
parents: 34459
diff changeset
47
153e4e05e9b3 extdata: show debug message if external command exits with non-zero status
Yuya Nishihara <yuya@tcha.org>
parents: 34459
diff changeset
48 $ hg log -qr "extdata(emptygrep)"
35412
b1959391a088 extdata: abort if external command exits with non-zero status (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 35230
diff changeset
49 abort: extdata command 'cat extdata.txt | grep empty' failed: exited with status 1
b1959391a088 extdata: abort if external command exits with non-zero status (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 35230
diff changeset
50 [255]
34542
153e4e05e9b3 extdata: show debug message if external command exits with non-zero status
Yuya Nishihara <yuya@tcha.org>
parents: 34459
diff changeset
51
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
52 test bad extdata() revset source
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
53
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
54 $ hg log -qr "extdata()"
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
55 hg: parse error: extdata takes at least 1 string argument
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
56 [255]
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
57 $ hg log -qr "extdata(unknown)"
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
58 abort: unknown extdata source 'unknown'
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
59 [255]
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
60
34458
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
61 test template support:
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
62
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
63 $ hg log -r:3 -T "{node|short}{if(extdata('notes'), ' # {extdata('notes')}')}\n"
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
64 06254b906311 # first post
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
65 e8342c9a2ed1 # this is buggy :(
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
66 f6ed99a58333 # this change is great!
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
67 9de260b1e88e
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
68
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
69 test template cache:
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
70
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
71 $ hg log -r:3 -T '{rev} "{extdata("notes")}" "{extdata("shelldata")}"\n'
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
72 0 "first post" ""
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
73 1 "this is buggy :(" ""
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
74 2 "this change is great!" "another comment on 2"
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
75 3 "" ""
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
76
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
77 test bad extdata() template source
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
78
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
79 $ hg log -T "{extdata()}\n"
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
80 hg: parse error: extdata expects one argument
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
81 [255]
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
82 $ hg log -T "{extdata('unknown')}\n"
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
83 abort: unknown extdata source 'unknown'
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
84 [255]
a1b89c8ad32d templater: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents: 34457
diff changeset
85
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
86 we don't fix up relative file URLs, but we do run shell commands in repo root
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
87
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
88 $ mkdir sub
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
89 $ cd sub
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
90 $ hg log -qr "extdata(filedata)"
35230
feecfefeba25 tests: add a substitution for ENOENT/ERROR_FILE_NOT_FOUND messages
Matt Harbison <matt_harbison@yahoo.com>
parents: 34690
diff changeset
91 abort: error: $ENOENT$
34457
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
92 [255]
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
93 $ hg log -qr "extdata(shelldata)"
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
94 2:f6ed99a58333
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
95
2c3b8fa3211b revset: add experimental support for extdata
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
96 $ cd ..