Bug 61248 - Replace script_path with script_shell_command
Summary: Replace script_path with script_shell_command
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Patrick R. Gansterer
URL:
Keywords:
Depends on: 61251
Blocks: 55811
  Show dependency treegraph
 
Reported: 2011-05-22 08:42 PDT by Patrick R. Gansterer
Modified: 2011-05-23 08:28 PDT (History)
3 users (show)

See Also:


Attachments
Patch (3.28 KB, patch)
2011-05-22 08:55 PDT, Patrick R. Gansterer
no flags Details | Formatted Diff | Diff
Patch (3.34 KB, patch)
2011-05-22 09:59 PDT, Patrick R. Gansterer
abarth: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick R. Gansterer 2011-05-22 08:42:06 PDT
Replace script_path with script_shell_command
Comment 1 Patrick R. Gansterer 2011-05-22 08:55:11 PDT
Created attachment 94344 [details]
Patch
Comment 2 Adam Barth 2011-05-22 09:20:51 PDT
Comment on attachment 94344 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94344&action=review

> Tools/Scripts/webkitpy/common/checkout/scm/scm.py:94
> +        if sys.platform == 'win32':

This file shouldn't depend on sys.platform.  We're missing some sort of proper abstraction.
Comment 3 Adam Barth 2011-05-22 09:21:09 PDT
Also, we're missing tests.
Comment 4 Patrick R. Gansterer 2011-05-22 09:23:00 PDT
(In reply to comment #2)
> (From update of attachment 94344 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=94344&action=review
> 
> > Tools/Scripts/webkitpy/common/checkout/scm/scm.py:94
> > +        if sys.platform == 'win32':
> 
> This file shouldn't depend on sys.platform.  We're missing some sort of proper abstraction.

Any good ideas? Where is the correct/best place?
Comment 5 Adam Barth 2011-05-22 09:27:59 PDT
Comment on attachment 94344 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94344&action=review

>>> Tools/Scripts/webkitpy/common/checkout/scm/scm.py:94
>>> +        if sys.platform == 'win32':
>> 
>> This file shouldn't depend on sys.platform.  We're missing some sort of proper abstraction.
> 
> Any good ideas? Where is the correct/best place?

It seems like Executive.interpreter_for_script should do that work, possibly with a different name.  Instead of having to branch on sys.platform everywhere we use a script, we should have a common abstraction do that for us.
Comment 6 Adam Barth 2011-05-22 09:29:17 PDT
http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/ports.py#L45

There's another place we have this branch.  It should be moved to the common location also.
Comment 7 Patrick R. Gansterer 2011-05-22 09:29:54 PDT
(In reply to comment #5)
> (From update of attachment 94344 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=94344&action=review
> 
> >>> Tools/Scripts/webkitpy/common/checkout/scm/scm.py:94
> >>> +        if sys.platform == 'win32':
> >> 
> >> This file shouldn't depend on sys.platform.  We're missing some sort of proper abstraction.
> > 
> > Any good ideas? Where is the correct/best place?
> 
> It seems like Executive.interpreter_for_script should do that work, possibly with a different name.  Instead of having to branch on sys.platform everywhere we use a script, we should have a common abstraction do that for us.

Where? Is Executive the right place?
Comment 8 Adam Barth 2011-05-22 09:34:23 PDT
> Where? Is Executive the right place?

Dunno.  You should apply your design aesthetic and make a decision.
Comment 9 Patrick R. Gansterer 2011-05-22 09:59:10 PDT
Created attachment 94348 [details]
Patch
Comment 10 Adam Barth 2011-05-22 10:24:59 PDT
Comment on attachment 94348 [details]
Patch

Looks good, but we need a test.
Comment 11 Patrick R. Gansterer 2011-05-22 10:32:50 PDT
(In reply to comment #10)
> (From update of attachment 94348 [details])
> Looks good, but we need a test.

Isn't that tested with the apply_patch tests already?
Comment 12 Adam Barth 2011-05-22 10:55:30 PDT
> Isn't that tested with the apply_patch tests already?

Seemingly not if this is broken on Windows.
Comment 13 Patrick R. Gansterer 2011-05-22 10:57:22 PDT
(In reply to comment #12)
> > Isn't that tested with the apply_patch tests already?
> 
> Seemingly not if this is broken on Windows.

We do not run the test on native windows at the moment, because the don't work. ;-)
Comment 14 Adam Barth 2011-05-22 11:04:49 PDT
> We do not run the test on native windows at the moment, because the don't work. ;-)

My point is that unless this change is tested somewhere, I'm likely to break it next time I work on this code.  Are we planning to run these tests on native windows?  Can we write a test that checks that we're doing the right thing that works on every platform?

Presumably we're passing something different to execute, so this should just be a matter of calling the appropriate function with a logging executive.
Comment 15 Patrick R. Gansterer 2011-05-22 11:13:00 PDT
(In reply to comment #14)
> > We do not run the test on native windows at the moment, because the don't work. ;-)
> 
> My point is that unless this change is tested somewhere, I'm likely to break it next time I work on this code.  Are we planning to run these tests on native windows?  Can we write a test that checks that we're doing the right thing that works on every platform?
> 
> Presumably we're passing something different to execute, so this should just be a matter of calling the appropriate function with a logging executive.

IMHO that's a chicken-and-egg problem. We can't run the native win32 test, when the don't work and we can't change the code if we don't test it. :-(

The master bug for getting rid of cygwin is 48166.

We call the script with interpreter only on windows (sys.platform == 'win32'), so we can't test it on other platform if we don't mock sys. I i don't like the idea of mocking sys.

We have the same problem at bug 55925 too.
Comment 16 Adam Barth 2011-05-22 20:29:35 PDT
Hum...  Maybe Eric has an opinion.  I definitely think this is valuable work, and I don't want to discourage you.
Comment 17 Adam Roben (:aroben) 2011-05-23 06:38:39 PDT
(In reply to comment #15)
> We call the script with interpreter only on windows (sys.platform == 'win32'), so we can't test it on other platform if we don't mock sys. I i don't like the idea of mocking sys.

Presumably we have code elsewhere that makes platform-dependent decisions. How do we test that code?
Comment 18 Adam Barth 2011-05-23 08:28:24 PDT
> Presumably we have code elsewhere that makes platform-dependent decisions. How do we test that code?

We have very, very little platform-dependent code.  The layout_package has a bunch, which it tests by using a mock platform object.

Maybe the best thing to do here is to run test-webkitpy in a non-cygwin configuration with a skipped list and then gradually remove tests from the skipped list as we fix them.  That will ensure that we have test coverage.