<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>249720</bug_id>
          
          <creation_ts>2022-12-21 09:13:15 -0800</creation_ts>
          <short_desc>import-w3c-tests appears to create a redundant *-expected.html file for each *-ref.html file</short_desc>
          <delta_ts>2022-12-21 12:57:34 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Tools / Tests</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>203784</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="David Kilzer (:ddkilzer)">ddkilzer</reporter>
          <assigned_to name="David Kilzer (:ddkilzer)">ddkilzer</assigned_to>
          <cc>cdumez</cc>
    
    <cc>gsnedders</cc>
    
    <cc>ntim</cc>
    
    <cc>rniwa</cc>
    
    <cc>ryanhaddad</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1921098</commentid>
    <comment_count>0</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2022-12-21 09:13:15 -0800</bug_when>
    <thetext>import-w3c-tests appears to create a redundant *-expected.html file for each *-ref.html file.

In Bug 249691, I imported one new WPT (dom/xslt/sort.html), but three files were added:

* LayoutTests/imported/w3c/web-platform-tests/dom/xslt/sort-expected.html: Add.
* LayoutTests/imported/w3c/web-platform-tests/dom/xslt/sort-ref.html: Add.
* LayoutTests/imported/w3c/web-platform-tests/dom/xslt/sort.html: Add.

The `sort-expected.html` file doesn&apos;t exist upstream, and appears to have been created by `import-w3c-tests` in Tools/Scripts/webkitpy/w3c/test_importer.py (I haven&apos;t debugged this--it&apos;s just a guess that this code is responsible):

```
                if &apos;reference&apos; in test_info.keys():
                    reftests += 1
                    total_tests += 1
                    test_basename = self.filesystem.basename(test_info[&apos;test&apos;])

                    # Add the ref file, following WebKit style.
                    # FIXME: Ideally we&apos;d support reading the metadata
                    # directly rather than relying  on a naming convention.
                    # Using a naming convention creates duplicate copies of the
                    # reference files.
                    ref_file = self.filesystem.splitext(test_basename)[0] + &apos;-expected&apos;
                    if &apos;type&apos; in test_info and test_info[&apos;type&apos;] == &apos;mismatch&apos;:
                        ref_file += &apos;-mismatch&apos;
                    ref_file += self.filesystem.splitext(test_info[&apos;reference&apos;])[1]

                    copy_list.append({&apos;src&apos;: test_info[&apos;reference&apos;], &apos;dest&apos;: ref_file, &apos;reference_support_info&apos;: test_info[&apos;reference_support_info&apos;]})
                    copy_list.append({&apos;src&apos;: test_info[&apos;test&apos;], &apos;dest&apos;: filename})
```

There are 293 `*-ref.html` files without corresponding `*-expected.html` files:

$ for F in `find LayoutTests/imported/w3c/web-platform-tests -name \*-ref.html`; do G=&quot;`echo $F | sed -e &apos;s/-ref.html/-expected.html/&apos;`&quot;; if [ ! -e $G ]; then ls -la $F; fi; done | wc -l
     293

While there are 1947 `*-ref.html` files with a `*-expected.html` file:

$ for F in `find LayoutTests/imported/w3c/web-platform-tests -name \*-ref.html`; do G=&quot;`echo $F | sed -e &apos;s/-ref.html/-expected.html/&apos;`&quot;; if [ -e $G ]; then ls -la $G; fi; done | wc -l
    1947

In most cases the `*-ref.html` and `*-expected.html` files are the same, but not always:

$ cksum LayoutTests/imported/w3c/web-platform-tests/quirks/body-fills-html-quirk-{expected,ref}.html
707962029 242 LayoutTests/imported/w3c/web-platform-tests/quirks/body-fills-html-quirk-expected.html
3896252966 153 LayoutTests/imported/w3c/web-platform-tests/quirks/body-fills-html-quirk-ref.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921099</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-12-21 09:14:32 -0800</bug_when>
    <thetext>&lt;rdar://problem/103600959&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921100</commentid>
    <comment_count>2</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2022-12-21 09:14:54 -0800</bug_when>
    <thetext>Anyone know what the &quot;expected&quot; (*pun*) behavior is when a `*-ref.html` file exists?

I&apos;m guessing the `*-expected.html` files can be deleted, and that the `import-w3c-tests` script shouldn&apos;t be creating them.  Is that correct?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921108</commentid>
    <comment_count>3</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2022-12-21 09:36:54 -0800</bug_when>
    <thetext>And for &quot;reference&quot; (*pun*), there are no `*-expected.html` files for `*-ref.html` files in the W3C web-platform-tests repository:

```
$ for F in `find WebKitBuild/w3c-tests/web-platform-tests -name \*-ref.html`; do G=&quot;`echo $F | sed -e &apos;s/-ref.html/-expected.html/&apos;`&quot;; if [ -e $G ]; then ls -la $G; fi; done | wc -l
       0
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921167</commentid>
    <comment_count>4</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2022-12-21 11:54:19 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/7971</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1921189</commentid>
    <comment_count>5</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2022-12-21 12:57:34 -0800</bug_when>
    <thetext>Dupe of this:

Bug 203784: Add support for finding test references via &lt;link rel=&quot;match&quot;&gt; and use that in WPT

*** This bug has been marked as a duplicate of bug 203784 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>