New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 764662 link

Starred by 3 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 757374



Sign in to add a comment

Build system should warn when there are duplicated-basename files

Project Member Reported by hajimehoshi@chromium.org, Sep 13 2017

Issue description

I found my CL https://chromium-review.googlesource.com/c/chromium/src/+/647050 always fail on Mac and Linux release bots due to the following error:

(https://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/544555)

Traceback (most recent call last):
  File "/b/c/b/mac/src/third_party/WebKit/Tools/Scripts/merge-layout-test-results", line 221, in <module>
    main(sys.argv[1:])
  File "/b/c/b/mac/src/third_party/WebKit/Tools/Scripts/merge-layout-test-results", line 203, in main
    merger.merge(args.output_directory, args.input_directories)
  File "/b/c/b/mac/src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/merge_results.py", line 498, in merge
    merge_func(out_path, to_merge)
  File "/b/c/b/mac/src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/merge_results.py", line 291, in __call__
    to_merge)
webkitpy.layout_tests.merge_results.MergeFailure: Failure merging /b/rr/tmpIBBOOq/w/layout-test-results/external/wpt/cssom/MediaList-stderr.txt:  File contents don't match:
/private/var/folders/p4/py6nlvcx4fs5s3fg51_pzqmc0000gm/T/tmpmBeoTU/9/layout-test-results/external/wpt/cssom/MediaList-stderr.txt
Trying to merge ['/private/var/folders/p4/py6nlvcx4fs5s3fg51_pzqmc0000gm/T/tmpmBeoTU/7/layout-test-results/external/wpt/cssom/MediaList-stderr.txt', '/private/var/folders/p4/py6nlvcx4fs5s3fg51_pzqmc0000gm/T/tmpmBeoTU/9/layout-test-results/external/wpt/cssom/MediaList-stderr.txt'].
WARNING:root:merge_cmd had non-zero return code: 1
step returned non-zero exit code: 1


IIUC the error says that stderrs by the sharding tests must be same. The strange part was that my CL doesn't have anything to do with MediaList tests. I found the outdir_json included UKM warning with datetimes introduced by my CL. A part of the output JSON is:


  "1/layout-test-results/external/wpt/cssom/CSSKeyframeRule-stderr.txt": "[1167:38659:0913/025058.234445:1073252138281:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n[1167:38659:0913/025058.312370:1073330062433:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n",
  "1/layout-test-results/external/wpt/cssom/GetBoundingRect-stderr.txt": "[1167:38659:0913/025058.451861:1073469553100:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n[1167:38659:0913/025058.538580:1073556271972:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n",
  "1/layout-test-results/external/wpt/cssom/computed-style-001-stderr.txt": "[1167:38659:0913/025057.994317:1073012038107:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n[1167:38659:0913/025058.194992:1073212712337:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n",
  "1/layout-test-results/external/wpt/cssom/insertRule-charset-no-index-stderr.txt": "[1167:38659:0913/025058.566007:1073583699206:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n[1167:38659:0913/025058.650166:1073667855833:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n",
  "1/layout-test-results/external/wpt/cssom/medialist-interfaces-003-stderr.txt": "[1167:38659:0913/025058.339861:1073357552659:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n[1167:38659:0913/025058.417905:1073435595551:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n",
  "1/layout-test-results/external/wpt/cssom/ttwf-cssom-doc-ext-load-count-stderr.txt": "[1167:38659:0913/025057.874674:1072892394784:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n[1167:38659:0913/025057.967920:1072985639705:ERROR:service_manager.cc(156)] Connection InterfaceProviderSpec prevented service: content_renderer from binding interface: ukm::mojom::UkmRecorderInterface exposed by: content_browser\n",
 

Actually UKM usage adds warnings:

https://cs.chromium.org/chromium/src/services/service_manager/service_manager.cc?q=service_manager.cc:156&sq=package:chromium&l=153


I guessed that merging is failed because the log includes datetime and MergeFilesMatchingContents in merge_results.py tries to compare  test results binary-exactly. Is that correct? Could we fix MergeFilesMatchingContents looser?
 
Blocking: 757374
Cc: -tasak@chromium.org tasak@google.com
Cc: qyears...@chromium.org jeffcarp@chromium.org
Somehow my comment got eaten;
-------------------------
Hi hajimehoshi@,

Firstly, I want to apologize, the *actual* problem you are hitting should be detected much earlier rather than this failing all the way at the merge step.

The problem here is that a test is somehow ending up being run on two different shards. This is *not* suppose to happen.

There are a couple of possible causes of this;
 (a) The test is defined somewhere twice.
 (b) The test somehow shares a common name with another tests.

I thought both these issues should be detected these days. IIRC jeffcarp@ or qyearsley@ was working this?

In all these cases when this happens you will effectively get random behaviour when run locally as the test will end up running twice and will silently overwrite the output of the first run.

I think https://bugs.chromium.org/p/chromium/issues/detail?id=730250 is the bug?
-------------------------
Hi tansell@, thank you for taking a look. What is the current status?

> I think https://bugs.chromium.org/p/chromium/issues/detail?id=730250 is the bug?

Maybe, but the problem is found after that bug was fixed.

Thanks,
ping tansell@,

I'm afraid this is a blocker of crbug/757374

Apologies for the delay, just getting back from being OOO. I haven't dug into this very far but here's a guess:

In cssom/ there are two files that share the same name but have different extensions: MediaList.html and MediaList.xhtml.[1]

In TestResultWriter[2], the output files are stripped of their extensions. This means both of the above files would be written to the same filename: cssom/MediaList-stderr.txt.

To confirm this we could try renaming MediaList.xhtml to MediaList2.xhtml in your CL and seeing if the same error occurs.

[1] https://github.com/w3c/web-platform-tests/tree/master/cssom
[2] https://cs.chromium.org/chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/test_result_writer.py?l=134
Thank you for responding. So, I was wondering if you think this is still a problem and are going to fix this.
Hi hajimehoshi,

Please see jeffcarp's comment. You CL *does* actually contain a bug as he identified. 

The build system *should* give you a better error message when you do something like this, but it *is* something that we should be stopping you from submitting.

Thanks!

Tim 'mithro' Ansell
Ah OK, I'll try renaming the file MediaList.xhtml to MediaList2.xhtml in the next time. Thank you for elaborating.
Hm, WPTManifest.generate_manifest in the presubmit fails with renaming the filename without any messages...

Instead of renaming, how about including the extension in TestResultWriter?

Fixing WPT_BASE_MANIFEST.json solved the presubmit error, but I am not sure that is allowed.
Cc: dpranke@chromium.org
As discussed at the CL (#12), it seems not feasible to fix Chromium tools and output files because a lot of tools and output files depend on the fact that there is not duplicated basename files.

Instead, I'm trying to fix filename of wpt upstream https://github.com/w3c/web-platform-tests/pull/7569
Cc: robertma@chromium.org
Thanks Hajime!
Labels: -Pri-1 Pri-2
Summary: Build system should warn when there are duplicated-basename files (was: MergeFilesMatchingContents in merge_results.py is too strict)
Blocking: -757374
Blocking: 757374
Suspicious tests that have duplicated base names:

fast/dom/createElement-with-column
external/wpt/dom/nodes/ParentNode-querySelector-All-content
external/wpt/dom/nodes/Document-createElement-namespace-tests/bare_svg
external/wpt/dom/nodes/Document-createElement-namespace-tests/bare_mathml
external/wpt/dom/nodes/Document-createElement-namespace-tests/minimal_html
external/wpt/dom/nodes/Document-createElement-namespace-tests/xhtml_ns_changed
external/wpt/dom/nodes/Document-createElement-namespace-tests/svg
external/wpt/dom/nodes/Document-createElement-namespace-tests/empty
external/wpt/dom/nodes/Document-createElement-namespace-tests/xhtml_ns_removed
external/wpt/dom/nodes/Document-createElement-namespace-tests/xhtml
external/wpt/dom/nodes/Document-createElement-namespace-tests/bare_xhtml
external/wpt/dom/nodes/Document-createElement-namespace-tests/mathml
external/wpt/dom/nodes/Document-contentType/resources/blob
external/wpt/common/dummy
external/wpt/encoding/resources/utf-32-big-endian-bom
external/wpt/encoding/resources/utf-32-big-endian-nobom
external/wpt/encoding/resources/utf-32-little-endian-nobom
external/wpt/encoding/resources/utf-32-little-endian-bom
external/wpt/resource-timing/resources/resource_timing_test0

At least, createElement-with-column is now problematic in https://chromium-review.googlesource.com/c/chromium/src/+/722301. Not sure the others.
Project Member

Comment 19 by bugdroid1@chromium.org, Oct 18 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3b3e16e84077fec37dd1381b18bad5be154d14d2

commit 3b3e16e84077fec37dd1381b18bad5be154d14d2
Author: Hajime Hoshi <hajimehoshi@chromium.org>
Date: Wed Oct 18 19:13:15 2017

Rename createElement-with-column.xml -> createElement-with-column2.xml

Now there are files that have same basenames (
createElement-with-column.html and createElement-with-column.xml), and
this makes some Chromium test tools confused (See the build log at
https://chromium-review.googlesource.com/c/chromium/src/+/722301).

This CL avoids this problem by just renaming the file as workaround. We
should fix some tools to detect such duplication in the future anyway.

Bug: 764662
Change-Id: I0493bb43d074527950558f81104776706e6df427
Reviewed-on: https://chromium-review.googlesource.com/725580
Reviewed-by: Quinten Yearsley <qyearsley@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509830}
[add] https://crrev.com/3b3e16e84077fec37dd1381b18bad5be154d14d2/third_party/WebKit/LayoutTests/fast/dom/createElement-with-column2-expected.txt
[rename] https://crrev.com/3b3e16e84077fec37dd1381b18bad5be154d14d2/third_party/WebKit/LayoutTests/fast/dom/createElement-with-column2.xml

It'd be easier to enforce the uniqueness of basenames (as a lint). As for WPT, there is already an issue on the topic: https://github.com/w3c/web-platform-tests/issues/7570, but the lint being discussed is WPT-specific, shall we perhaps add a lint to cover all LayoutTests?
Cc: tansell@chromium.org
Owner: ----
Status: Available (was: Untriaged)
I think a lint to cover all layout tests would be reasonable, possibly in addition to checking in run-webkit-tests after finding the list of tests. What would be the simplest way to do it, maybe a presubmit check?
Labels: -Infra-Troopers
Removing this from the trooper queue as it doesn't appear to be a trooper issue. (Feel free to re-add it and correct me if I'm wrong about that.)
This is a P2 but nobody is assigned to work on it. robertma@, if we had a lint for this, what do you think we should do when an automatic wpt import fails because of colliding file names? It seems a bit annoying to have to rename files on either side to avoid this.

Would it be feasible to just handle duplicate basenames instead? Is it merge_results.py that would have to be updated?
As far as I understand, a change to merge_results.py would not be sufficient; run-webkit-tests assumes that no two layout tests have the same path minus extension, since the baseline file path is basename + baseline extension, i.e. two tests named foo.html and foo.htm would have the same baseline path, which would lead to conflicts.
Owner: robertma@chromium.org
Status: Assigned (was: Available)
Philip, I think we already reached a conclusion from the previous discussion: fixing the underlying work is unknown amount of substantial work in our infra (and also WebKit's), so enforcing unique basenames in a directory is the reasonable compromise.

We *should* add a lint in the wpt upstream first. This will prevent colliding filenames altogether so we don't need to worry about import failures. The lint will then be synced to Chromium as well.

We *may* add another lint in Chromium to enforce the same rule over the whole LayoutTests, as the lint above would only cover LayoutTests/external/wpt after being synced to Chromium.

I'm assigning the issue to myself. The work will happen in the upstream though.
robertma@, any update on this, should it be a P2?
Labels: -Pri-2 Pri-3
Components: Blink>Infra>Ecosystem
Owner: kyleju@chromium.org
Assign to kyleju@ as the upstream issue was assigned to him.

Sign in to add a comment