Bug 221855

Summary: _W3CTestConverter tests don't run on Windows
Product: WebKit Reporter: Don Olmstead <don.olmstead>
Component: Tools / TestsAssignee: Don Olmstead <don.olmstead>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, glenn, jbedard, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 221815    
Attachments:
Description Flags
WIP Patch
none
Patch none

Description Don Olmstead 2021-02-12 16:06:15 PST
When running Tools/Scripts/test-webkitpy on Windows saw the following when running the webkitpy.w3c.test_converter_unittest.W3CTestConverterTest test suite.

  Traceback (most recent call last):
    File "C:\tools\python3\lib\sre_parse.py", line 1039, in parse_template
      this = chr(ESCAPES[this][1])
  KeyError: '\\L'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "C:\webkit\Tools\Scripts\webkitpy\w3c\test_converter_unittest.py", line 89, in 
test_convert_for_webkit_nothing_to_convert
      converter.feed(test_html)
    File "C:\tools\python3\lib\html\parser.py", line 110, in feed
      self.goahead(0)
    File "C:\tools\python3\lib\html\parser.py", line 170, in goahead
      k = self.parse_starttag(i)
    File "C:\tools\python3\lib\html\parser.py", line 342, in parse_starttag
      self.handle_startendtag(tag, attrs)
    File "C:\webkit\Tools\Scripts\webkitpy\w3c\test_converter.py", line 258, in handle_startendtag
      self.convert_attributes_if_needed(tag, attrs)
    File "C:\webkit\Tools\Scripts\webkitpy\w3c\test_converter.py", line 214, in convert_attributes_if_needed
      new_path = re.sub(self.test_harness_re, self.new_test_harness_path + '/testharness', attr[1])
    File "C:\tools\python3\lib\re.py", line 210, in sub
      return _compile(pattern, flags).sub(repl, string, count)

    File "C:\tools\python3\lib\re.py", line 327, in _subx
      template = _compile_repl(template, pattern)
    File "C:\tools\python3\lib\re.py", line 318, in _compile_repl
      return sre_parse.parse_template(repl, pattern)
    File "C:\tools\python3\lib\sre_parse.py", line 1042, in parse_template

      raise s.error('bad escape %s' % this, len(this))
  re.error: bad escape \L at position 8

The issue stems from Window's path separator being '\' which gets used when creating a regex.
Comment 1 Don Olmstead 2021-02-12 16:08:46 PST
Created attachment 420188 [details]
WIP Patch

This fixes the issue on Windows.

I'm not entirely sure the workflow so I'd like to run the whole thing through Windows to make sure this actually works works.
Comment 2 youenn fablet 2021-02-17 00:28:29 PST
LGTM, not sure why webkitpy is unhappy though.
Let's try rerunning it.
Comment 3 Don Olmstead 2021-02-17 16:06:53 PST
Created attachment 420747 [details]
Patch
Comment 4 EWS 2021-02-17 18:33:57 PST
Committed r273057: <https://commits.webkit.org/r273057>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 420747 [details].
Comment 5 Radar WebKit Bug Importer 2021-02-17 18:34:16 PST
<rdar://problem/74459518>