GRIT's XmbUnittest fails at TOT |
||
Issue description
GRIT's XmbUnittest fails at TOT with a clean checkout.
Probably has been the case for a while. However, these are run as presubmits whenever making any changes to grit, so it forces to bypass presubmits when uploading a CL.
I'll take a look when I have a chance, since I seem to be the only person touching GRIT currently.
Example output:
ERROR: testLeadingTrailingWhitespace (__main__.XmbUnittest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tools/grit/grit/tool/xmb_unittest.py", line 102, in testLeadingTrailingWhitespace
File "tools/grit/grit/tool/../../grit/tool/xmb.py", line 297, in Process
File "tools/grit/grit/tool/../../grit/tool/xmb.py", line 128, in WriteXmbFile
File "tools/grit/grit/tool/../../grit/tool/xmb.py", line 73, in _WriteMessage
File "tools/grit/grit/tool/../../grit/tool/xmb.py", line 61, in _WriteAttribute
File "tools/grit/grit/tool/../../grit/tool/xmb.py", line 45, in _XmlEscape
File "tools/grit/grit/tool/../../grit/lazy_re.py", line 36, in __getattribute__
File "tools/grit/grit/tool/../../grit/lazy_re.py", line 30, in _LazyInit
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 194, in compile
return _compile(pattern, flags)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 251, in _compile
raise error, v # invalid expression
error: bad character range
,
Feb 16 2017
RE in question:
_XML_BAD_CHAR_REGEX = lazy_re.compile(u'[^\u0009\u000A\u000D'
u'\u0020-\uD7FF\uE000-\uFFFD'
u'\U00010000-\U0010FFFF]')
,
Feb 16 2017
Also fails for me on Windows.
,
Feb 16 2017
Windows has Python 2.7.3, Mac has Python 2.7.10 and Linux has Python 2.7.6. Very strange it would related to Python version since it would mean it was something that errors in 2.7.6 but not in 2.7.3 or 2.7.10...
,
Feb 16 2017
So it's this part that's causing the issue: re.compile(u'[\U00010000-\U0010FFFF]')
,
Feb 16 2017
Looks like it's related to this: http://stackoverflow.com/questions/31603075/how-can-i-represent-this-regex-to-not-get-a-bad-character-range-error So it depends if its a "wide" or "narrow" Python build.
,
Feb 16 2017
Looks it was added by newt@ here: https://codereview.chromium.org/1440313003 ... who no longer appears to work on Chrome.
,
Feb 16 2017
However, this error isn't hit presumably during Chrome build process. Is a different version of Python used there than system Python. Nico, do you know? (Or is this code not executed during Chrome build?)
,
Feb 16 2017
I don't think we run grit tests as part of the build, only on presubmit. I think we don' tuse system python but depot_tools python on windows (?)
,
Feb 16 2017
This repros for me with using depot_tools\python.bat
,
Feb 16 2017
.. on Windows which is Python version 2.7.6.
,
Feb 16 2017
Yeah, I'd guess newt ran the presubmit on linux :-/
,
Feb 16 2017
I guess we just don't run the XMB codepath during the build process then? I didn't know what it was, but looking a bit - I guess it's the format used to deliver to translators? Maybe that workflow is only done on Linux?
,
Feb 17 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/56dfab6710187ab2f41a917c1ce99529836bd6e7 commit 56dfab6710187ab2f41a917c1ce99529836bd6e7 Author: asvitkine <asvitkine@chromium.org> Date: Fri Feb 17 20:23:30 2017 Fix xmb_unittest.py in GRIT. It was broken on systems with a "narrow" build of Python, see: http://stackoverflow.com/questions/31603075/how-can-i-represent-this-regex-to-not-get-a-bad-character-range-error It turns out the regex was not needed at all - as invalid characters do not even reach that point. This removes the check and adds a unit test to verify that the tool produces an error when characters outside the valid range are specified. BUG= 693086 Review-Url: https://codereview.chromium.org/2697383002 Cr-Commit-Position: refs/heads/master@{#451370} [modify] https://crrev.com/56dfab6710187ab2f41a917c1ce99529836bd6e7/tools/grit/grit/tool/xmb.py [modify] https://crrev.com/56dfab6710187ab2f41a917c1ce99529836bd6e7/tools/grit/grit/tool/xmb_unittest.py
,
Feb 17 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by asvitk...@chromium.org
, Feb 16 2017