Bug 203226

Summary: Add a script to run ImageDiff manually
Product: WebKit Reporter: Carlos Alberto Lopez Perez <clopez>
Component: Tools / TestsAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, bugs-noreply, webkit-bug-importer, zimmermann
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Carlos Alberto Lopez Perez 2019-10-21 17:05:54 PDT
While trying to debug a possible issue with ImageDiff I found that is really hard to run this test manually (without using the layout-test runner).

The main issue is that the tool doesn't accept the paths to the images. Instead it expects via stdin the contents of both images (as byte strings), with some fields that tell it how much bytes each image uses on stdin.
Comment 1 Carlos Alberto Lopez Perez 2019-10-21 17:52:38 PDT
Created attachment 381489 [details]
Patch
Comment 2 Carlos Alberto Lopez Perez 2019-10-21 18:22:50 PDT
Created attachment 381494 [details]
Patch
Comment 3 Adrian Perez 2019-10-22 01:02:59 PDT
Comment on attachment 381494 [details]
Patch

The new Python script looks fine. I think that the failed test case of
the “webkitperl” EWS is somewhat intermittent (for example here's another
recent failure: https://ews-build.webkit.org/#/builders/19/builds/11760),
and it should be fine to land this.
Comment 4 Carlos Alberto Lopez Perez 2019-10-22 04:34:09 PDT
Comment on attachment 381494 [details]
Patch

Clearing flags on attachment: 381494

Committed r251428: <https://trac.webkit.org/changeset/251428>
Comment 5 Carlos Alberto Lopez Perez 2019-10-22 04:34:13 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2019-10-22 04:35:16 PDT
<rdar://problem/56496270>
Comment 7 Nikolas Zimmermann 2022-07-14 14:21:26 PDT
```
nzimmermann@nzimmermann-macbook WebKit % run-imagediff  LayoutTests/svg/foreignObject/body-background-expected.png actual.png    
Traceback (most recent call last):
  File "/Users/nzimmermann/Software/GitRepositories/WebKit/Tools/Scripts/run-imagediff", line 70, in <module>
    image_diff, diff_percent, error = port.diff_image(imageContentA, imageContentB, options.tolerance)
TypeError: cannot unpack non-iterable ImageDiffResult object
```

The script is outdated. Shall we update it? Carlos?