comparison tests/test-bad-extension.t @ 40996:6f2510b581a0

extensions: use ui.log() interface to provide detailed loading information The output format changes and the messages will be sent to stderr instead of stdout, but I don't think that matters.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Dec 2018 16:28:29 +0900
parents 09a37a5d8f5d
children 5ed1abd0ea26
comparison
equal deleted inserted replaced
40995:19178aeb9b43 40996:6f2510b581a0
1 $ filterlog () {
2 > sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!'
3 > }
4
1 ensure that failing ui.atexit handlers report sensibly 5 ensure that failing ui.atexit handlers report sensibly
2 6
3 $ cat > $TESTTMP/bailatexit.py <<EOF 7 $ cat > $TESTTMP/bailatexit.py <<EOF
4 > from mercurial import util 8 > from mercurial import util
5 > def bail(): 9 > def bail():
80 #if no-extraextensions 84 #if no-extraextensions
81 show traceback for ImportError of hgext.name if devel.debug.extensions is set 85 show traceback for ImportError of hgext.name if devel.debug.extensions is set
82 86
83 $ (hg help help --traceback --debug --config devel.debug.extensions=yes 2>&1) \ 87 $ (hg help help --traceback --debug --config devel.debug.extensions=yes 2>&1) \
84 > | grep -v '^ ' \ 88 > | grep -v '^ ' \
85 > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not import|ModuleNotFound' 89 > | filterlog \
86 debug.extensions: loading extensions 90 > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|^YYYY|not import|ModuleNotFound'
87 debug.extensions: - processing 5 entries 91 YYYY/MM/DD HH:MM:SS (PID)> loading extensions
88 debug.extensions: - loading extension: gpg 92 YYYY/MM/DD HH:MM:SS (PID)> - processing 5 entries
89 debug.extensions: > gpg extension loaded in * (glob) 93 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: gpg
90 debug.extensions: - validating extension tables: gpg 94 YYYY/MM/DD HH:MM:SS (PID)> > gpg extension loaded in * (glob)
91 debug.extensions: - invoking registered callbacks: gpg 95 YYYY/MM/DD HH:MM:SS (PID)> - validating extension tables: gpg
92 debug.extensions: > callbacks completed in * (glob) 96 YYYY/MM/DD HH:MM:SS (PID)> - invoking registered callbacks: gpg
93 debug.extensions: - loading extension: badext 97 YYYY/MM/DD HH:MM:SS (PID)> > callbacks completed in * (glob)
98 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: badext
94 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow 99 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
95 Traceback (most recent call last): 100 Traceback (most recent call last):
96 Exception: bit bucket overflow 101 Exception: bit bucket overflow
97 debug.extensions: - loading extension: baddocext 102 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: baddocext
98 debug.extensions: > baddocext extension loaded in * (glob) 103 YYYY/MM/DD HH:MM:SS (PID)> > baddocext extension loaded in * (glob)
99 debug.extensions: - validating extension tables: baddocext 104 YYYY/MM/DD HH:MM:SS (PID)> - validating extension tables: baddocext
100 debug.extensions: - invoking registered callbacks: baddocext 105 YYYY/MM/DD HH:MM:SS (PID)> - invoking registered callbacks: baddocext
101 debug.extensions: > callbacks completed in * (glob) 106 YYYY/MM/DD HH:MM:SS (PID)> > callbacks completed in * (glob)
102 debug.extensions: - loading extension: badext2 107 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: badext2
103 debug.extensions: - could not import hgext.badext2 (No module named *badext2*): trying hgext3rd.badext2 (glob) 108 YYYY/MM/DD HH:MM:SS (PID)> - could not import hgext.badext2 (No module named *badext2*): trying hgext3rd.badext2 (glob)
104 Traceback (most recent call last): 109 Traceback (most recent call last):
105 ImportError: No module named badext2 (no-py3 !) 110 ImportError: No module named badext2 (no-py3 !)
106 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !) 111 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
107 debug.extensions: - could not import hgext3rd.badext2 (No module named *badext2*): trying badext2 (glob) 112 YYYY/MM/DD HH:MM:SS (PID)> - could not import hgext3rd.badext2 (No module named *badext2*): trying badext2 (glob)
108 Traceback (most recent call last): 113 Traceback (most recent call last):
109 ImportError: No module named badext2 (no-py3 !) 114 ImportError: No module named badext2 (no-py3 !)
110 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !) 115 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
111 Traceback (most recent call last): (py3 !) 116 Traceback (most recent call last): (py3 !)
112 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !) 117 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
116 Traceback (most recent call last): (py3 !) 121 Traceback (most recent call last): (py3 !)
117 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !) 122 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
118 Traceback (most recent call last): (py3 !) 123 Traceback (most recent call last): (py3 !)
119 ModuleNotFoundError: No module named 'badext2' (py3 !) 124 ModuleNotFoundError: No module named 'badext2' (py3 !)
120 ImportError: No module named badext2 (no-py3 !) 125 ImportError: No module named badext2 (no-py3 !)
121 debug.extensions: > loaded 2 extensions, total time * (glob) 126 YYYY/MM/DD HH:MM:SS (PID)> > loaded 2 extensions, total time * (glob)
122 debug.extensions: - loading configtable attributes 127 YYYY/MM/DD HH:MM:SS (PID)> - loading configtable attributes
123 debug.extensions: - executing uisetup hooks 128 YYYY/MM/DD HH:MM:SS (PID)> - executing uisetup hooks
124 debug.extensions: - running uisetup for gpg 129 YYYY/MM/DD HH:MM:SS (PID)> - running uisetup for gpg
125 debug.extensions: > uisetup for gpg took * (glob) 130 YYYY/MM/DD HH:MM:SS (PID)> > uisetup for gpg took * (glob)
126 debug.extensions: - running uisetup for baddocext 131 YYYY/MM/DD HH:MM:SS (PID)> - running uisetup for baddocext
127 debug.extensions: > uisetup for baddocext took * (glob) 132 YYYY/MM/DD HH:MM:SS (PID)> > uisetup for baddocext took * (glob)
128 debug.extensions: > all uisetup took * (glob) 133 YYYY/MM/DD HH:MM:SS (PID)> > all uisetup took * (glob)
129 debug.extensions: - executing extsetup hooks 134 YYYY/MM/DD HH:MM:SS (PID)> - executing extsetup hooks
130 debug.extensions: - running extsetup for gpg 135 YYYY/MM/DD HH:MM:SS (PID)> - running extsetup for gpg
131 debug.extensions: > extsetup for gpg took * (glob) 136 YYYY/MM/DD HH:MM:SS (PID)> > extsetup for gpg took * (glob)
132 debug.extensions: - running extsetup for baddocext 137 YYYY/MM/DD HH:MM:SS (PID)> - running extsetup for baddocext
133 debug.extensions: > extsetup for baddocext took * (glob) 138 YYYY/MM/DD HH:MM:SS (PID)> > extsetup for baddocext took * (glob)
134 debug.extensions: > all extsetup took * (glob) 139 YYYY/MM/DD HH:MM:SS (PID)> > all extsetup took * (glob)
135 debug.extensions: - executing remaining aftercallbacks 140 YYYY/MM/DD HH:MM:SS (PID)> - executing remaining aftercallbacks
136 debug.extensions: > remaining aftercallbacks completed in * (glob) 141 YYYY/MM/DD HH:MM:SS (PID)> > remaining aftercallbacks completed in * (glob)
137 debug.extensions: - loading extension registration objects 142 YYYY/MM/DD HH:MM:SS (PID)> - loading extension registration objects
138 debug.extensions: > extension registration object loading took * (glob) 143 YYYY/MM/DD HH:MM:SS (PID)> > extension registration object loading took * (glob)
139 debug.extensions: > extension baddocext take a total of * to load (glob) 144 YYYY/MM/DD HH:MM:SS (PID)> > extension baddocext take a total of * to load (glob)
140 debug.extensions: > extension gpg take a total of * to load (glob) 145 YYYY/MM/DD HH:MM:SS (PID)> > extension gpg take a total of * to load (glob)
141 debug.extensions: extension loading complete 146 YYYY/MM/DD HH:MM:SS (PID)> extension loading complete
142 #endif 147 #endif
143 148
144 confirm that there's no crash when an extension's documentation is bad 149 confirm that there's no crash when an extension's documentation is bad
145 150
146 $ hg help --keyword baddocext 151 $ hg help --keyword baddocext